mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-11 13:49:15 -05:00
Split bar on Messagelist activity and some code styling.
This commit is contained in:
parent
4293914855
commit
2ec97235ec
@ -208,6 +208,7 @@
|
||||
android:name="com.fsck.k9.activity.MessageList"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="locale"
|
||||
android:uiOptions="splitActionBarWhenNarrow"
|
||||
>
|
||||
<intent-filter>
|
||||
<!-- This action is only to allow an entry point for launcher shortcuts -->
|
||||
|
32
res/layout/actionbar_indeterminate_progress.xml
Normal file
32
res/layout/actionbar_indeterminate_progress.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<!--
|
||||
Copyright 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingLeft="12dp">
|
||||
<!-- FrameLayout ignores margins so we use this padding
|
||||
to make sure the total is the same width as the icon we
|
||||
replace and no visual shifting occurs -->
|
||||
<ProgressBar android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_gravity="center"
|
||||
style="?android:attr/indeterminateProgressStyle" />
|
||||
</FrameLayout>
|
28
res/layout/actionbar_spinner.xml
Normal file
28
res/layout/actionbar_spinner.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/RelativeLayout1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:orientation="vertical" >
|
||||
<!-- android:gravity="fill_horizontal" -->
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginBottom="-4dip"
|
||||
android:text="Inbox"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/actionbar_title_sub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@android:id/text1"
|
||||
android:text="Refreshing"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</RelativeLayout>
|
16
res/layout/actionbar_top_custom.xml
Normal file
16
res/layout/actionbar_top_custom.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:focusable="true" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/ic_menu_refresh" />
|
||||
|
||||
</RelativeLayout>
|
@ -5,6 +5,7 @@
|
||||
android:alphabeticShortcut="c"
|
||||
android:title="@string/compose_action"
|
||||
android:icon="@drawable/ic_menu_compose"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:title="@string/folder_list_display_mode_label"
|
||||
@ -60,6 +61,7 @@
|
||||
android:alphabeticShortcut="r"
|
||||
android:title="@string/check_mail_action"
|
||||
android:icon="@drawable/ic_menu_refresh"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
|
@ -5,12 +5,14 @@
|
||||
android:alphabeticShortcut="c"
|
||||
android:title="@string/compose_action"
|
||||
android:icon="@drawable/ic_menu_compose"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/set_sort"
|
||||
android:title="@string/sort_by"
|
||||
android:icon="@drawable/ic_menu_set_sort">
|
||||
<menu>
|
||||
android:icon="@drawable/ic_menu_set_sort"
|
||||
android:showAsAction="always" >
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/set_sort_date"
|
||||
android:title="@string/sort_by_date"
|
||||
@ -45,6 +47,7 @@
|
||||
android:id="@+id/select_all"
|
||||
android:title="@string/batch_select_all"
|
||||
android:icon="@drawable/ic_menu_select_all"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/batch_ops"
|
||||
@ -107,12 +110,6 @@
|
||||
/>
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/list_folders"
|
||||
android:alphabeticShortcut="f"
|
||||
android:title="@string/list_folders_action"
|
||||
android:icon="@drawable/ic_menu_navigate"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/send_messages"
|
||||
android:alphabeticShortcut="r"
|
||||
@ -124,21 +121,19 @@
|
||||
android:alphabeticShortcut="r"
|
||||
android:title="@string/check_mail_action"
|
||||
android:icon="@drawable/ic_menu_refresh"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/accounts"
|
||||
android:title="@string/accounts_action"
|
||||
android:icon="@drawable/ic_menu_account_list"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/mark_all_as_read"
|
||||
android:title="@string/mark_all_as_read_action"
|
||||
android:icon="@drawable/ic_menu_inbox"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/preferences_action"
|
||||
android:icon="@drawable/ic_menu_preferences">
|
||||
android:icon="@drawable/ic_menu_preferences"
|
||||
android:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/folder_settings"
|
||||
@ -160,5 +155,6 @@
|
||||
<item
|
||||
android:id="@+id/expunge"
|
||||
android:title="@string/expunge_action"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
</menu>
|
||||
|
@ -26,7 +26,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
@ -42,6 +41,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.actionbarsherlock.view.Window;
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Account.FolderMode;
|
||||
import com.fsck.k9.AccountStats;
|
||||
@ -266,7 +266,6 @@ public class FolderList extends K9ListActivity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
|
||||
setContentView(R.layout.folder_list);
|
||||
mListView = getListView();
|
||||
mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
|
||||
@ -395,8 +394,7 @@ public class FolderList extends K9ListActivity {
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
//Shortcuts that work no matter what is selected
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_Q:
|
||||
{
|
||||
case KeyEvent.KEYCODE_Q: {
|
||||
onAccounts();
|
||||
return true;
|
||||
}
|
||||
@ -676,59 +674,63 @@ public class FolderList extends K9ListActivity {
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id) {
|
||||
switch (id) {
|
||||
case DIALOG_MARK_ALL_AS_READ:
|
||||
return ConfirmationDialog.create(this, id, R.string.mark_all_as_read_dlg_title,
|
||||
getString(R.string.mark_all_as_read_dlg_instructions_fmt,
|
||||
mSelectedContextFolder.displayName),
|
||||
R.string.okay_action, R.string.cancel_action,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
markAllAsRead();
|
||||
}
|
||||
});
|
||||
case DIALOG_FIND_FOLDER: {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.filter_folders_action);
|
||||
case DIALOG_MARK_ALL_AS_READ:
|
||||
return ConfirmationDialog.create(this, id, R.string.mark_all_as_read_dlg_title,
|
||||
getString(R.string.mark_all_as_read_dlg_instructions_fmt,
|
||||
mSelectedContextFolder.displayName),
|
||||
R.string.okay_action, R.string.cancel_action,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
markAllAsRead();
|
||||
}
|
||||
});
|
||||
case DIALOG_FIND_FOLDER: {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.filter_folders_action);
|
||||
|
||||
final EditText input = new EditText(this);
|
||||
input.setId(R.id.filter_folders);
|
||||
input.setHint(R.string.folder_list_filter_hint);
|
||||
input.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
mAdapter.getFilter().filter(input.getText());
|
||||
}
|
||||
final EditText input = new EditText(this);
|
||||
input.setId(R.id.filter_folders);
|
||||
input.setHint(R.string.folder_list_filter_hint);
|
||||
input.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
mAdapter.getFilter().filter(input.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) { /* not used */ }
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
/* not used */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) { /* not used */ }
|
||||
});
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
/* not used */
|
||||
}
|
||||
});
|
||||
|
||||
builder.setView(input);
|
||||
builder.setView(input);
|
||||
|
||||
builder.setPositiveButton(getString(R.string.okay_action),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
String value = input.getText().toString();
|
||||
mAdapter.getFilter().filter(value);
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(getString(R.string.okay_action),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
String value = input.getText().toString();
|
||||
mAdapter.getFilter().filter(value);
|
||||
}
|
||||
});
|
||||
|
||||
builder.setNegativeButton(getString(R.string.cancel_action),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
mAdapter.getFilter().filter(null);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.cancel_action),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
mAdapter.getFilter().filter(null);
|
||||
}
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
|
||||
return super.onCreateDialog(id);
|
||||
@ -737,27 +739,27 @@ public class FolderList extends K9ListActivity {
|
||||
@Override
|
||||
public void onPrepareDialog(int id, Dialog dialog) {
|
||||
switch (id) {
|
||||
case DIALOG_MARK_ALL_AS_READ: {
|
||||
AlertDialog alertDialog = (AlertDialog) dialog;
|
||||
alertDialog.setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
|
||||
mSelectedContextFolder.displayName));
|
||||
break;
|
||||
}
|
||||
case DIALOG_FIND_FOLDER: {
|
||||
AlertDialog alertDialog = (AlertDialog) dialog;
|
||||
EditText input = (EditText) alertDialog.findViewById(R.id.filter_folders);
|
||||
case DIALOG_MARK_ALL_AS_READ: {
|
||||
AlertDialog alertDialog = (AlertDialog) dialog;
|
||||
alertDialog.setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
|
||||
mSelectedContextFolder.displayName));
|
||||
break;
|
||||
}
|
||||
case DIALOG_FIND_FOLDER: {
|
||||
AlertDialog alertDialog = (AlertDialog) dialog;
|
||||
EditText input = (EditText) alertDialog.findViewById(R.id.filter_folders);
|
||||
|
||||
// Populate the EditText with the current search term
|
||||
FolderListFilter filter = (FolderListFilter) mAdapter.getFilter();
|
||||
input.setText(filter.getSearchTerm());
|
||||
// Populate the EditText with the current search term
|
||||
FolderListFilter filter = (FolderListFilter) mAdapter.getFilter();
|
||||
input.setText(filter.getSearchTerm());
|
||||
|
||||
// Place the cursor at the end of the text
|
||||
input.setSelection(input.getText().length());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
super.onPrepareDialog(id, dialog);
|
||||
}
|
||||
// Place the cursor at the end of the text
|
||||
input.setSelection(input.getText().length());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
super.onPrepareDialog(id, dialog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ public class K9PreferenceActivity extends SherlockPreferenceActivity {
|
||||
// which causes PreferenceScreens to have a black background.
|
||||
// http://code.google.com/p/android/issues/detail?id=4611
|
||||
setTheme(K9.getK9ThemeResourceId(K9.THEME_DARK));
|
||||
}else{
|
||||
setTheme(K9.getK9ThemeResourceId());
|
||||
} else {
|
||||
setTheme(K9.getK9ThemeResourceId());
|
||||
}
|
||||
|
||||
super.onCreate(icicle);
|
||||
|
@ -13,6 +13,7 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@ -30,18 +31,16 @@ import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Animation.AnimationListener;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
@ -49,9 +48,15 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.actionbarsherlock.view.Window;
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Account.SortType;
|
||||
import com.fsck.k9.AccountStats;
|
||||
@ -83,7 +88,7 @@ import com.fsck.k9.mail.store.StorageManager;
|
||||
*/
|
||||
public class MessageList
|
||||
extends K9Activity
|
||||
implements OnClickListener, AdapterView.OnItemClickListener, AnimationListener {
|
||||
implements OnClickListener, AdapterView.OnItemClickListener, AnimationListener, OnNavigationListener {
|
||||
|
||||
/**
|
||||
* Reverses the result of a {@link Comparator}.
|
||||
@ -232,6 +237,10 @@ public class MessageList
|
||||
private static final String EXTRA_LIST_POSITION = "listPosition";
|
||||
private static final String EXTRA_RETURN_FROM_MESSAGE_VIEW = "returnFromMessageView";
|
||||
|
||||
private static final Long AB_NAVIGATION_INBOX = 0l;
|
||||
private static final Long AB_NAVIGATION_FOLDERS = 1l;
|
||||
private static final Long AB_NAVIGATION_ACCOUNTS = 2l;
|
||||
|
||||
/**
|
||||
* Maps a {@link SortType} to a {@link Comparator} implementation.
|
||||
*/
|
||||
@ -308,6 +317,9 @@ public class MessageList
|
||||
|
||||
private FontSizes mFontSizes = K9.getFontSizes();
|
||||
|
||||
private MenuItem mRefreshMenuItem;
|
||||
private View mActionBarProgressView;
|
||||
|
||||
private Bundle mState = null;
|
||||
|
||||
/**
|
||||
@ -515,7 +527,7 @@ public class MessageList
|
||||
}
|
||||
}
|
||||
|
||||
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, level);
|
||||
setSupportProgress(level);
|
||||
}
|
||||
|
||||
private void setWindowTitle() {
|
||||
@ -543,7 +555,17 @@ public class MessageList
|
||||
}
|
||||
|
||||
private void progress(final boolean progress) {
|
||||
showProgressIndicator(progress);
|
||||
// Make sure we don't try this before the menu is initialized
|
||||
// this could happen while the activity is initialized.
|
||||
if (mRefreshMenuItem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
mRefreshMenuItem.setActionView(mActionBarProgressView);
|
||||
} else {
|
||||
mRefreshMenuItem.setActionView(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -636,7 +658,7 @@ public class MessageList
|
||||
}
|
||||
|
||||
public static void actionHandle(Context context, String title,
|
||||
SearchSpecification searchSpecification) {
|
||||
SearchSpecification searchSpecification) {
|
||||
Intent intent = actionHandleAccountIntent(context, title, searchSpecification);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
@ -666,6 +688,7 @@ public class MessageList
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mInflater = getLayoutInflater();
|
||||
initializeActionBar();
|
||||
initializeLayout();
|
||||
|
||||
// Only set "touchable" when we're first starting up the activity.
|
||||
@ -687,7 +710,7 @@ public class MessageList
|
||||
|
||||
private void initializeMessageList(Intent intent, boolean create) {
|
||||
boolean returnFromMessageView = intent.getBooleanExtra(
|
||||
EXTRA_RETURN_FROM_MESSAGE_VIEW, false);
|
||||
EXTRA_RETURN_FROM_MESSAGE_VIEW, false);
|
||||
|
||||
if (!create && returnFromMessageView) {
|
||||
// We're returning from the MessageView activity with "Manage back button" enabled.
|
||||
@ -879,9 +902,23 @@ public class MessageList
|
||||
refreshTitle();
|
||||
}
|
||||
|
||||
private void initializeLayout() {
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
private void initializeActionBar() {
|
||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setCustomView(R.layout.actionbar_top_custom);
|
||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
|
||||
ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||
actionBar.setListNavigationCallbacks(
|
||||
new MessageListNavigationSpinner(this,
|
||||
new String[] {"Inbox", "Folders", "Accounts"},
|
||||
new Long[] {AB_NAVIGATION_INBOX, AB_NAVIGATION_FOLDERS, AB_NAVIGATION_ACCOUNTS }),
|
||||
this);
|
||||
}
|
||||
|
||||
private void initializeLayout() {
|
||||
setContentView(R.layout.message_list);
|
||||
|
||||
mListView = (ListView) findViewById(R.id.message_list);
|
||||
@ -913,6 +950,62 @@ public class MessageList
|
||||
mBatchMoveButton.setVisibility(K9.batchButtonsMove() ? View.VISIBLE : View.GONE);
|
||||
mBatchFlagButton.setVisibility(K9.batchButtonsFlag() ? View.VISIBLE : View.GONE);
|
||||
mBatchDoneButton.setVisibility(K9.batchButtonsUnselect() ? View.VISIBLE : View.GONE);
|
||||
|
||||
mActionBarProgressView = mInflater.inflate(R.layout.actionbar_indeterminate_progress, null);
|
||||
}
|
||||
|
||||
private class MessageListNavigationSpinner extends ArrayAdapter<String> implements SpinnerAdapter {
|
||||
|
||||
private String mTitle = "";
|
||||
private String mSubTitle = "";
|
||||
|
||||
private Long[] mIds;
|
||||
|
||||
public MessageListNavigationSpinner(Context context, String[] objects, Long[] ids) {
|
||||
super(context, R.layout.actionbar_spinner,
|
||||
android.R.id.text1, objects);
|
||||
setDropDownViewResource(android.R.layout.simple_list_item_1);
|
||||
mIds = new Long[ids.length];
|
||||
mIds = ids;
|
||||
}
|
||||
|
||||
public boolean setTitle(String title) {
|
||||
if (!title.equals(mTitle)) {
|
||||
mTitle = title;
|
||||
notifyDataSetChanged();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setSubTitle(String subtitle) {
|
||||
if (!subtitle.equals(mSubTitle)) {
|
||||
mSubTitle = subtitle;
|
||||
notifyDataSetChanged();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView,
|
||||
ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDropDownView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return mIds[position];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1463,10 +1556,6 @@ public class MessageList
|
||||
onCompose();
|
||||
return true;
|
||||
}
|
||||
case R.id.accounts: {
|
||||
onAccounts();
|
||||
return true;
|
||||
}
|
||||
case R.id.set_sort_date: {
|
||||
changeSort(SortType.SORT_DATE);
|
||||
return true;
|
||||
@ -1549,10 +1638,6 @@ public class MessageList
|
||||
mController.sendPendingMessages(mAccount, mAdapter.mListener);
|
||||
return true;
|
||||
}
|
||||
case R.id.list_folders: {
|
||||
onShowFolderList();
|
||||
return true;
|
||||
}
|
||||
case R.id.mark_all_as_read: {
|
||||
if (mFolderName != null) {
|
||||
onMarkAllAsRead(mAccount, mFolderName);
|
||||
@ -1678,7 +1763,7 @@ public class MessageList
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getSupportMenuInflater().inflate(R.menu.message_list_option, menu);
|
||||
|
||||
mRefreshMenuItem = menu.findItem(R.id.check_mail);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1766,21 +1851,6 @@ public class MessageList
|
||||
mController.sendAlternate(this, account, holder.message);
|
||||
}
|
||||
|
||||
public void showProgressIndicator(boolean status) {
|
||||
setProgressBarIndeterminateVisibility(status);
|
||||
ProgressBar bar = (ProgressBar)mListView.findViewById(R.id.message_list_progress);
|
||||
if (bar == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
bar.setIndeterminate(true);
|
||||
if (status) {
|
||||
bar.setVisibility(ProgressBar.VISIBLE);
|
||||
} else {
|
||||
bar.setVisibility(ProgressBar.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSwipeRightToLeft(final MotionEvent e1, final MotionEvent e2) {
|
||||
// Handle right-to-left as an un-select
|
||||
@ -3102,4 +3172,17 @@ public class MessageList
|
||||
|
||||
return account;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
|
||||
if (itemId == AB_NAVIGATION_FOLDERS) {
|
||||
onShowFolderList();
|
||||
return true;
|
||||
} else if (itemId == AB_NAVIGATION_ACCOUNTS) {
|
||||
onAccounts();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user