Skip to content

Commit

Permalink
Include ref (commit/tag/branch) in title when printing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
maniac103 committed Mar 20, 2019
1 parent 2433593 commit 383a4c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/src/main/java/com/gh4a/activities/FileViewerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.print.PrintHelper;
import android.support.v7.widget.PopupMenu;
import android.text.TextUtils;
import android.util.Base64;
import android.view.Menu;
import android.view.MenuInflater;
Expand Down Expand Up @@ -175,8 +177,9 @@ private void findMatchingLines(String data) {

@Override
protected String getDocumentTitle() {
return getString(R.string.file_print_document_title, FileUtils.getFileName(mPath),
mRepoOwner, mRepoName);
@StringRes int titleResId = TextUtils.isEmpty(mRef)
? R.string.file_print_document_title : R.string.file_print_document_at_ref_title;
return getString(titleResId, FileUtils.getFileName(mPath), mRepoOwner, mRepoName, mRef);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
<string name="diff_print_document_title">Diff of file %1$s in commit %2$s in %3$s/%4$s</string>
<string name="gist_print_document_title">%1$s in gist %2$s of %3$s</string>
<string name="file_print_document_title">%1$s in %2$s/%3$s</string>
<string name="file_print_document_at_ref_title">%1$s in %2$s/%3$s (%4$s)</string>
<string name="wiki_print_document_title">Wiki page %1$s in %2$s/%3$s</string>

<string name="repository_owner_avatar">Repository owner avatar</string>
Expand Down

0 comments on commit 383a4c0

Please sign in to comment.