1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Use "display name" of folder in action bar

This commit is contained in:
cketti 2012-08-25 03:48:43 +02:00 committed by Andrew Chen
parent 9301e94e73
commit cec2f4cdee
3 changed files with 11 additions and 9 deletions

View File

@ -97,7 +97,7 @@ public class FolderInfoHolder implements Comparable<FolderInfoHolder> {
this.status = truncateStatus(folder.getStatus());
this.displayName = getDisplayName(context, folder);
this.displayName = getDisplayName(context, account, name);
}
/**
@ -109,16 +109,15 @@ public class FolderInfoHolder implements Comparable<FolderInfoHolder> {
*
* @param context
* A {@link Context} instance that is used to get the string resources.
* @param folder
* The {@link Folder} instance for which to return the display name.
* @param account
* The {@link Account} the folder belongs to.
* @param name
* The name of the folder for which to return the display name.
*
* @return The localized name for the provided folder if it's a special folder or the original
* folder name if it's a non-special folder.
*/
public static String getDisplayName(Context context, Folder folder) {
Account account = folder.getAccount();
String name = folder.getName();
public static String getDisplayName(Context context, Account account, String name) {
final String displayName;
if (name.equals(account.getSpamFolderName())) {
displayName = String.format(

View File

@ -515,7 +515,10 @@ public class MessageList extends K9ListActivity implements
private void setWindowTitle() {
// regular folder content display
if (mFolderName != null) {
mNavigationSpinner.setTitle(mFolderName);
String displayName = FolderInfoHolder.getDisplayName(MessageList.this, mAccount,
mFolderName);
mNavigationSpinner.setTitle(displayName);
mNavigationSpinner.setSubTitle(mAccount.getEmail());
// query result display

View File

@ -74,7 +74,7 @@ public class FolderSettings extends K9PreferenceActivity {
addPreferencesFromResource(R.xml.folder_settings_preferences);
String displayName = FolderInfoHolder.getDisplayName(this, mFolder);
String displayName = FolderInfoHolder.getDisplayName(this, mAccount, mFolder.getName());
Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
category.setTitle(displayName);