Remove custom actionbar view

This commit is contained in:
cketti 2018-12-04 20:24:27 +01:00
parent 278e7d339c
commit 958c3cf29c
4 changed files with 14 additions and 168 deletions

View file

@ -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() {

View file

@ -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();

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/actionbar_message_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/title_layout"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/actionbar_title_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="start"
android:singleLine="true"
android:textSize="14sp" />
<TextView
android:id="@+id/actionbar_title_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" />
</LinearLayout>
<ProgressBar
android:id="@+id/actionbar_progress"
style="?android:attr/indeterminateProgressStyle"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:visibility="gone" />
<TextView
android:id="@+id/actionbar_unread_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="12dip"
android:paddingRight="12dip"
android:textColor="?android:attr/textColorTertiary"
android:textSize="32sp" />
</LinearLayout>
</FrameLayout>

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="@+id/actionbar_message_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/title_layout"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/actionbar_title_first"
tools:text="Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="start"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/actionbar_title_sub"
tools:text="Subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
<ProgressBar
android:id="@+id/actionbar_progress"
style="?android:attr/indeterminateProgressStyle"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>