From 958c3cf29c375b1d30591f46911ccaddd2b97483 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 4 Dec 2018 20:24:27 +0100 Subject: [PATCH] Remove custom actionbar view --- .../com/fsck/k9/activity/MessageList.java | 65 ++++--------------- .../fsck/k9/fragment/MessageListFragment.java | 10 --- .../main/res/layout-land/actionbar_custom.xml | 56 ---------------- .../src/main/res/layout/actionbar_custom.xml | 51 --------------- 4 files changed, 14 insertions(+), 168 deletions(-) delete mode 100644 app/ui/src/main/res/layout-land/actionbar_custom.xml delete mode 100644 app/ui/src/main/res/layout/actionbar_custom.xml diff --git a/app/ui/src/main/java/com/fsck/k9/activity/MessageList.java b/app/ui/src/main/java/com/fsck/k9/activity/MessageList.java index 098c05f0e..07c98d160 100644 --- a/app/ui/src/main/java/com/fsck/k9/activity/MessageList.java +++ b/app/ui/src/main/java/com/fsck/k9/activity/MessageList.java @@ -30,8 +30,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; -import android.widget.ProgressBar; -import android.widget.TextView; import android.widget.Toast; import com.fsck.k9.Account; @@ -163,9 +161,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen private ActionBarDrawerToggle drawerToggle; private K9Drawer drawer; private FragmentTransaction openFolderTransaction; - private View actionBarMessageList; - private TextView actionBarTitle; - private TextView actionBarSubTitle; private Menu menu; private ViewGroup messageViewContainer; @@ -179,7 +174,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen private LocalSearch search; private boolean singleFolderMode; - private ProgressBar actionBarProgress; private MenuItem menuButtonCheckMail; private View actionButtonIndeterminateProgress; private int lastDirection = (K9.messageViewShowNext()) ? NEXT : PREVIOUS; @@ -551,19 +545,9 @@ public class MessageList extends K9Activity implements MessageListFragmentListen private void initializeActionBar() { actionBar = getSupportActionBar(); - - actionBar.setDisplayShowTitleEnabled(false); - actionBar.setDisplayShowCustomEnabled(true); - actionBar.setCustomView(R.layout.actionbar_custom); - - View customView = actionBar.getCustomView(); - actionBarMessageList = customView.findViewById(R.id.actionbar_message_list); - actionBarTitle = customView.findViewById(R.id.actionbar_title_first); - actionBarSubTitle = customView.findViewById(R.id.actionbar_title_sub); - actionBarProgress = customView.findViewById(R.id.actionbar_progress); - actionButtonIndeterminateProgress = getActionButtonIndeterminateProgress(); - actionBar.setDisplayHomeAsUpEnabled(true); + + actionButtonIndeterminateProgress = getActionButtonIndeterminateProgress(); } private void initializeDrawer(Bundle savedInstanceState) { @@ -1213,21 +1197,14 @@ public class MessageList extends K9Activity implements MessageListFragmentListen } public void setActionBarTitle(String title) { - actionBarTitle.setText(title); - } - - public void setActionBarSubTitle(String subTitle) { - actionBarSubTitle.setText(subTitle); + actionBar.setTitle(title); } @Override public void setMessageListTitle(String title) { - setActionBarTitle(title); - } - - @Override - public void setMessageListSubTitle(String subTitle) { - setActionBarSubTitle(subTitle); + if (displayMode != DisplayMode.MESSAGE_VIEW) { + setActionBarTitle(title); + } } @Override @@ -1479,22 +1456,14 @@ public class MessageList extends K9Activity implements MessageListFragmentListen @Override public void enableActionBarProgress(boolean enable) { - if (menuButtonCheckMail != null && menuButtonCheckMail.isVisible()) { - actionBarProgress.setVisibility(ProgressBar.GONE); - if (enable) { - menuButtonCheckMail - .setActionView(actionButtonIndeterminateProgress); - } else { - menuButtonCheckMail.setActionView(null); - } + if (menuButtonCheckMail == null) { + return; + } + + if (menuButtonCheckMail.isVisible()) { + menuButtonCheckMail.setActionView(enable ? actionButtonIndeterminateProgress : null); } else { - if (menuButtonCheckMail != null) - menuButtonCheckMail.setActionView(null); - if (enable) { - actionBarProgress.setVisibility(ProgressBar.VISIBLE); - } else { - actionBarProgress.setVisibility(ProgressBar.GONE); - } + menuButtonCheckMail.setActionView(null); } } @@ -1621,15 +1590,13 @@ public class MessageList extends K9Activity implements MessageListFragmentListen } private void showDefaultTitleView() { - actionBarMessageList.setVisibility(View.VISIBLE); - if (messageListFragment != null) { messageListFragment.updateTitle(); } } private void showMessageTitleView() { - actionBarMessageList.setVisibility(View.GONE); + setActionBarTitle(""); } @Override @@ -1691,10 +1658,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen } configureDrawer(); - - // now we know if we are in single account mode and need a subtitle - actionBarSubTitle.setVisibility((!singleFolderMode) ? View.GONE : View.VISIBLE); - } private void configureDrawer() { diff --git a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java index 0121cfb3f..8f596b6b7 100644 --- a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +++ b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java @@ -322,13 +322,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener String displayName = FolderInfoHolder.getDisplayName(activity, account, folderServerId, folderName); fragmentListener.setMessageListTitle(displayName); - - String operation = activityListener.getOperation(activity); - if (operation.length() < 1) { - fragmentListener.setMessageListSubTitle(account.getEmail()); - } else { - fragmentListener.setMessageListSubTitle(operation); - } } else { // query result display. This may be for a search folder as opposed to a user-initiated search. if (title != null) { @@ -338,8 +331,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener // This is a search result; set it to the default search result line. fragmentListener.setMessageListTitle(getString(R.string.search_results)); } - - fragmentListener.setMessageListSubTitle(null); } } @@ -2288,7 +2279,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener void onReplyAll(MessageReference message); void openMessage(MessageReference messageReference); void setMessageListTitle(String title); - void setMessageListSubTitle(String subTitle); void onCompose(Account account); boolean startSearch(Account account, String folderServerId); void remoteSearchStarted(); diff --git a/app/ui/src/main/res/layout-land/actionbar_custom.xml b/app/ui/src/main/res/layout-land/actionbar_custom.xml deleted file mode 100644 index 6252c0173..000000000 --- a/app/ui/src/main/res/layout-land/actionbar_custom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/ui/src/main/res/layout/actionbar_custom.xml b/app/ui/src/main/res/layout/actionbar_custom.xml deleted file mode 100644 index 93dabd7a2..000000000 --- a/app/ui/src/main/res/layout/actionbar_custom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - -