Changed main page titles

pull/161/head
M66B 5 years ago
parent b68532cdfe
commit 2569d090d4

@ -40,9 +40,19 @@ import java.util.HashMap;
import java.util.Map;
public class FragmentBase extends Fragment {
private String title = null;
private String subtitle = " ";
private boolean finish = false;
protected void setTitle(int resid) {
setTitle(getString(resid));
}
protected void setTitle(String title) {
this.title = title;
updateSubtitle();
}
protected void setSubtitle(int resid) {
setSubtitle(getString(resid));
}
@ -182,10 +192,12 @@ public class FragmentBase extends Fragment {
AppCompatActivity activity = (AppCompatActivity) getActivity();
if (activity != null && !isPane()) {
ActionBar actionbar = activity.getSupportActionBar();
if (actionbar != null)
if (actionbar != null) {
actionbar.setTitle(title == null ? getString(R.string.app_name) : title);
actionbar.setSubtitle(subtitle);
}
}
}
private boolean isPane() {
Bundle args = getArguments();

@ -232,6 +232,9 @@ public class FragmentCompose extends FragmentBase {
prefix_once = prefs.getBoolean("prefix_once", true);
monospaced = prefs.getBoolean("monospaced", false);
style = prefs.getBoolean("style_toolbar", true);
setTitle(R.string.page_compose);
setSubtitle(R.string.page_compose_message);
}
@Override
@ -409,7 +412,6 @@ public class FragmentCompose extends FragmentBase {
addBackPressedListener(onBackPressedListener);
// Initialize
setSubtitle(R.string.title_compose);
setHasOptionsMenu(true);
etExtra.setHint("");

@ -88,6 +88,8 @@ public class FragmentFolders extends FragmentBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
cards = prefs.getBoolean("cards", true);
setTitle(R.string.page_folders);
}
@Override

@ -300,15 +300,20 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
connected = args.getBoolean("connected", false);
if (TextUtils.isEmpty(query))
if (thread == null)
if (thread == null) {
if (folder < 0)
viewType = AdapterMessage.ViewType.UNIFIED;
else
viewType = AdapterMessage.ViewType.FOLDER;
else
setTitle(getResources().getQuantityString(R.plurals.page_conversation, 10));
} else {
viewType = AdapterMessage.ViewType.THREAD;
else
setTitle(getResources().getQuantityString(R.plurals.page_conversation, 1));
}
else {
viewType = AdapterMessage.ViewType.SEARCH;
setTitle(R.string.title_search);
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
@ -2193,8 +2198,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onChanged(TupleThreadStats stats) {
setSubtitle(getString(R.string.title_folder_thread,
stats == null || stats.accountName == null ? "" : stats.accountName));
setSubtitle(stats == null || stats.accountName == null ? "" : stats.accountName);
if (stats != null && stats.count != null && stats.seen != null) {
int unseen = stats.count - stats.seen;
@ -2224,7 +2228,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
break;
case SEARCH:
setSubtitle(getString(R.string.title_searching, query));
setSubtitle(query);
break;
}

@ -25,6 +25,7 @@
<string name="page_folders">Folders</string>
<string name="page_compose">Compose</string>
<string name="page_compose_message">Message</string>
<string name="tile_synchronize">Synchronize</string>
<string name="tile_unseen">New messages</string>
@ -443,7 +444,6 @@
<string name="title_folder_system">System</string>
<string name="title_folder_user">User</string>
<string name="title_folder_primary">Folders primary account</string>
<string name="title_folder_thread">Conversation %1$s</string>
<string name="title_folders_unified">Unified inbox folders</string>
<string name="title_no_messages">No messages</string>
<string name="title_no_folders">No folders</string>
@ -581,7 +581,6 @@
<string name="title_search">Search</string>
<string name="title_search_server">Search on server</string>
<string name="title_search_in">Search in</string>
<string name="title_searching">Searching \'%1$s\'</string>
<string name="title_sort_on">Sort on</string>
<string name="title_sort_on_time">Time</string>

Loading…
Cancel
Save