mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Changed look of action bar in MessageList
* (Temporarily) removed spinner because it wasn't doing anything useful * Created custom view that also displays the unread count
This commit is contained in:
parent
cec2f4cdee
commit
1cdb1c4fc5
42
res/layout-land/actionbar_custom.xml
Normal file
42
res/layout-land/actionbar_custom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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_weight="1"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
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>
|
||||||
|
|
||||||
|
<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>
|
42
res/layout/actionbar_custom.xml
Normal file
42
res/layout/actionbar_custom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
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_weight="1"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
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:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actionbar_title_sub"
|
||||||
|
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>
|
||||||
|
|
||||||
|
<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="36sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -34,19 +34,18 @@ import android.view.View;
|
|||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.AdapterView.OnItemLongClickListener;
|
import android.widget.AdapterView.OnItemLongClickListener;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
|
|
||||||
import com.actionbarsherlock.view.ActionMode;
|
import com.actionbarsherlock.view.ActionMode;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
@ -60,7 +59,6 @@ import com.fsck.k9.K9;
|
|||||||
import com.fsck.k9.Preferences;
|
import com.fsck.k9.Preferences;
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.SearchSpecification;
|
import com.fsck.k9.SearchSpecification;
|
||||||
import com.fsck.k9.activity.misc.ActionBarNavigationSpinner;
|
|
||||||
import com.fsck.k9.activity.misc.SwipeGestureDetector;
|
import com.fsck.k9.activity.misc.SwipeGestureDetector;
|
||||||
import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener;
|
import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener;
|
||||||
import com.fsck.k9.activity.setup.AccountSettings;
|
import com.fsck.k9.activity.setup.AccountSettings;
|
||||||
@ -84,8 +82,7 @@ import com.fsck.k9.mail.store.StorageManager;
|
|||||||
* shows a list of messages.
|
* shows a list of messages.
|
||||||
* From this Activity the user can perform all standard message operations.
|
* From this Activity the user can perform all standard message operations.
|
||||||
*/
|
*/
|
||||||
public class MessageList extends K9ListActivity implements
|
public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||||
AdapterView.OnItemClickListener, OnNavigationListener,
|
|
||||||
OnSwipeGestureListener {
|
OnSwipeGestureListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,7 +301,6 @@ public class MessageList extends K9ListActivity implements
|
|||||||
private FontSizes mFontSizes = K9.getFontSizes();
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
private MenuItem mRefreshMenuItem;
|
private MenuItem mRefreshMenuItem;
|
||||||
private ActionBarNavigationSpinner mNavigationSpinner;
|
|
||||||
private ActionBar mActionBar;
|
private ActionBar mActionBar;
|
||||||
private ActionMode mActionMode;
|
private ActionMode mActionMode;
|
||||||
private View mActionBarProgressView;
|
private View mActionBarProgressView;
|
||||||
@ -324,6 +320,10 @@ public class MessageList extends K9ListActivity implements
|
|||||||
|
|
||||||
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
||||||
|
|
||||||
|
private TextView mActionBarTitle;
|
||||||
|
private TextView mActionBarSubTitle;
|
||||||
|
private TextView mActionBarUnread;
|
||||||
|
|
||||||
private final class StorageListenerImplementation implements StorageManager.StorageListener {
|
private final class StorageListenerImplementation implements StorageManager.StorageListener {
|
||||||
@Override
|
@Override
|
||||||
public void onUnmount(String providerId) {
|
public void onUnmount(String providerId) {
|
||||||
@ -518,9 +518,15 @@ public class MessageList extends K9ListActivity implements
|
|||||||
String displayName = FolderInfoHolder.getDisplayName(MessageList.this, mAccount,
|
String displayName = FolderInfoHolder.getDisplayName(MessageList.this, mAccount,
|
||||||
mFolderName);
|
mFolderName);
|
||||||
|
|
||||||
mNavigationSpinner.setTitle(displayName);
|
mActionBarTitle.setText(displayName);
|
||||||
mNavigationSpinner.setSubTitle(mAccount.getEmail());
|
mActionBarSubTitle.setText(mAccount.getEmail());
|
||||||
|
|
||||||
|
if (mUnreadMessageCount == 0) {
|
||||||
|
mActionBarUnread.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
mActionBarUnread.setText(Integer.toString(mUnreadMessageCount));
|
||||||
|
mActionBarUnread.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
// query result display
|
// query result display
|
||||||
} else if (mQueryString != null) {
|
} else if (mQueryString != null) {
|
||||||
if (mTitle != null) {
|
if (mTitle != null) {
|
||||||
@ -902,10 +908,13 @@ public class MessageList extends K9ListActivity implements
|
|||||||
|
|
||||||
private void initializeActionBar() {
|
private void initializeActionBar() {
|
||||||
if (mQueryString == null) {
|
if (mQueryString == null) {
|
||||||
mActionBar.setDisplayShowTitleEnabled(false);
|
mActionBar.setDisplayShowCustomEnabled(true);
|
||||||
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
mActionBar.setCustomView(R.layout.actionbar_custom);
|
||||||
mNavigationSpinner = ActionBarNavigationSpinner.getDefaultSpinner(this);
|
|
||||||
mActionBar.setListNavigationCallbacks(mNavigationSpinner, this);
|
View customView = mActionBar.getCustomView();
|
||||||
|
mActionBarTitle = (TextView) customView.findViewById(R.id.actionbar_title_first);
|
||||||
|
mActionBarSubTitle = (TextView) customView.findViewById(R.id.actionbar_title_sub);
|
||||||
|
mActionBarUnread = (TextView) customView.findViewById(R.id.actionbar_unread_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
mActionBar.setDisplayHomeAsUpEnabled(true);
|
mActionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
@ -2730,19 +2739,6 @@ public class MessageList extends K9ListActivity implements
|
|||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
|
|
||||||
if (itemId == ActionBarNavigationSpinner.AB_NAVIGATION_FOLDERS) {
|
|
||||||
onShowFolderList();
|
|
||||||
return true;
|
|
||||||
} else if (itemId == ActionBarNavigationSpinner.AB_NAVIGATION_ACCOUNTS) {
|
|
||||||
onAccounts();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean handleContextRelatedClick(int position){
|
private boolean handleContextRelatedClick(int position){
|
||||||
MessageInfoHolder holder = (MessageInfoHolder) mAdapter.getItem(position);
|
MessageInfoHolder holder = (MessageInfoHolder) mAdapter.getItem(position);
|
||||||
if (mActionMode != null) {
|
if (mActionMode != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user