1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-25 15:11:52 -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.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 * @param context
* A {@link Context} instance that is used to get the string resources. * A {@link Context} instance that is used to get the string resources.
* @param folder * @param account
* The {@link Folder} instance for which to return the display name. * 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 * @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. * folder name if it's a non-special folder.
*/ */
public static String getDisplayName(Context context, Folder folder) { public static String getDisplayName(Context context, Account account, String name) {
Account account = folder.getAccount();
String name = folder.getName();
final String displayName; final String displayName;
if (name.equals(account.getSpamFolderName())) { if (name.equals(account.getSpamFolderName())) {
displayName = String.format( displayName = String.format(

View File

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

View File

@ -74,7 +74,7 @@ public class FolderSettings extends K9PreferenceActivity {
addPreferencesFromResource(R.xml.folder_settings_preferences); 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); Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
category.setTitle(displayName); category.setTitle(displayName);