Merge pull request #3800 from k9mail/manage-folders-item
add "Manage folders" item to drawer footer
This commit is contained in:
commit
099e13f0c4
4 changed files with 38 additions and 9 deletions
|
@ -274,7 +274,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
return;
|
||||
}
|
||||
|
||||
if(isDrawerEnabled()) {
|
||||
if (isDrawerEnabled()) {
|
||||
drawer.updateUserAccountsAndFolders(account);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
|
||||
return (splitViewMode == SplitViewMode.ALWAYS ||
|
||||
(splitViewMode == SplitViewMode.WHEN_IN_LANDSCAPE &&
|
||||
orientation == Configuration.ORIENTATION_LANDSCAPE));
|
||||
orientation == Configuration.ORIENTATION_LANDSCAPE));
|
||||
}
|
||||
|
||||
private void initializeLayout() {
|
||||
|
@ -602,6 +602,15 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
actionDisplaySearch(this, SearchAccount.createUnifiedInboxAccount().getRelatedSearch(), false, false);
|
||||
}
|
||||
|
||||
public void openFolderSettings() {
|
||||
if (account == null) {
|
||||
Timber.e("Tried to open account settings, but no account selected!");
|
||||
return;
|
||||
}
|
||||
|
||||
FolderList.actionHandleAccount(this, account);
|
||||
}
|
||||
|
||||
public void openRealAccount(Account realAccount) {
|
||||
if (realAccount.getAutoExpandFolder() == null) {
|
||||
FolderList.actionHandleAccount(this, realAccount);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class K9Drawer {
|
|||
|
||||
private static final long DRAWER_ID_UNIFIED_INBOX = 0;
|
||||
private static final long DRAWER_ID_PREFERENCES = 1;
|
||||
private static final long DRAWER_ID_FOLDERS = 2;
|
||||
|
||||
|
||||
private final FolderNameFormatter folderNameFormatter = DI.get(FolderNameFormatter.class);
|
||||
|
@ -75,6 +76,8 @@ public class K9Drawer {
|
|||
public K9Drawer(MessageList parent, Bundle savedInstanceState) {
|
||||
this.parent = parent;
|
||||
|
||||
initializeFolderIcons();
|
||||
|
||||
drawer = new DrawerBuilder()
|
||||
.withActivity(parent)
|
||||
.withDisplayBelowStatusBar(false)
|
||||
|
@ -88,8 +91,6 @@ public class K9Drawer {
|
|||
.build();
|
||||
|
||||
addFooterItems();
|
||||
|
||||
initializeFolderIcons();
|
||||
}
|
||||
|
||||
private AccountHeader buildAccountHeader() {
|
||||
|
@ -160,10 +161,16 @@ public class K9Drawer {
|
|||
private void addFooterItems() {
|
||||
drawer.addItems(new DividerDrawerItem(),
|
||||
new PrimaryDrawerItem()
|
||||
.withName(R.string.preferences_action)
|
||||
.withIcon(getResId(R.attr.iconActionSettings))
|
||||
.withIdentifier(DRAWER_ID_PREFERENCES)
|
||||
.withSelectable(false));
|
||||
.withName(R.string.folders_action)
|
||||
.withIcon(iconFolderResId)
|
||||
.withIdentifier(DRAWER_ID_FOLDERS)
|
||||
.withSelectable(false),
|
||||
new PrimaryDrawerItem()
|
||||
.withName(R.string.preferences_action)
|
||||
.withIcon(getResId(R.attr.iconActionSettings))
|
||||
.withIdentifier(DRAWER_ID_PREFERENCES)
|
||||
.withSelectable(false)
|
||||
);
|
||||
}
|
||||
|
||||
private void initializeFolderIcons() {
|
||||
|
@ -218,9 +225,16 @@ public class K9Drawer {
|
|||
setUserFolders(folders);
|
||||
}
|
||||
});
|
||||
updateFolderSettingsItem();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateFolderSettingsItem() {
|
||||
IDrawerItem drawerItem = drawer.getDrawerItem(DRAWER_ID_FOLDERS);
|
||||
drawerItem.withEnabled(!unifiedInboxSelected);
|
||||
drawer.updateItem(drawerItem);
|
||||
}
|
||||
|
||||
private OnDrawerItemClickListener createItemClickListener() {
|
||||
return new OnDrawerItemClickListener() {
|
||||
@Override
|
||||
|
@ -229,6 +243,9 @@ public class K9Drawer {
|
|||
if (id == DRAWER_ID_PREFERENCES) {
|
||||
SettingsActivity.launch(parent);
|
||||
return false;
|
||||
} else if (id == DRAWER_ID_FOLDERS) {
|
||||
parent.openFolderSettings();
|
||||
return false;
|
||||
} else {
|
||||
Folder folder = (Folder) drawerItem.getTag();
|
||||
parent.openFolder(folder.getServerId());
|
||||
|
@ -285,6 +302,7 @@ public class K9Drawer {
|
|||
return;
|
||||
}
|
||||
}
|
||||
updateFolderSettingsItem();
|
||||
}
|
||||
|
||||
public void selectUnifiedInbox() {
|
||||
|
@ -293,6 +311,7 @@ public class K9Drawer {
|
|||
accountHeader.setActiveProfile(DRAWER_ID_UNIFIED_INBOX);
|
||||
accountHeader.getHeaderBackgroundView().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
|
||||
clearUserFolders();
|
||||
updateFolderSettingsItem();
|
||||
}
|
||||
|
||||
public DrawerLayout getLayout() {
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
/>
|
||||
<item
|
||||
android:id="@+id/folder_settings"
|
||||
android:title="@string/folder_settings_action"
|
||||
android:title="@string/folders_action"
|
||||
/>
|
||||
</menu>
|
||||
|
|
|
@ -145,6 +145,7 @@ Please submit bug reports, contribute new features and ask questions at
|
|||
<string name="search_action">Search</string>
|
||||
<string name="search_results">Search results</string>
|
||||
<string name="preferences_action">Settings</string>
|
||||
<string name="folders_action">Manage folders</string>
|
||||
<string name="account_settings_action">Account settings</string>
|
||||
<string name="folder_settings_action">Folder settings</string>
|
||||
<string name="global_settings_action">Global settings</string>
|
||||
|
|
Loading…
Reference in a new issue