Added batch buttons for Archive and Move. Made batch buttons configurable.

This commit is contained in:
Mark Baker 2011-12-24 18:17:12 +00:00
parent 6de081c5b0
commit af1b9f83f2
8 changed files with 207 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -26,6 +26,20 @@
android:layout_weight="1"
android:src="@drawable/ic_button_delete"
/>
<ImageButton
android:id="@+id/batch_archive_button"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/ic_button_archive"
/>
<ImageButton
android:id="@+id/batch_move_button"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/ic_button_move"
/>
<ImageButton
android:id="@+id/batch_flag_button"
android:layout_width="0dip"

View File

@ -352,6 +352,15 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="global_settings_privacy_mode_title">Lock-screen notifications</string>
<string name="global_settings_privacy_mode_summary">Don\'t display message subject in notification bar when system is locked</string>
<string name="global_settings_batch_buttons">Batch buttons</string>
<string name="global_settings_batch_buttons_summary">Configure message list batch buttons</string>
<string name="global_settings_mark_read">Mark read/unread</string>
<string name="global_settings_delete">Delete</string>
<string name="global_settings_archive">Move to archive</string>
<string name="global_settings_move">Move</string>
<string name="global_settings_flag">Flag</string>
<string name="global_settings_unselect">Unselect</string>
<string name="quiet_time">Quiet Time</string>
<string name="quiet_time_description">Disable ringing, buzzing and flashing at night</string>
<string name="quiet_time_starts">Quiet Time starts</string>

View File

@ -157,6 +157,7 @@
android:dependency="messagelist_show_contact_name"
/>
</PreferenceCategory>
<PreferenceCategory
@ -237,6 +238,50 @@
android:dialogTitle="@string/global_settings_confirm_actions_title"
android:positiveButtonText="@android:string/ok"
android:negativeButtonText="@android:string/cancel" />
<PreferenceScreen
android:title="@string/global_settings_batch_buttons"
android:summary="@string/global_settings_batch_buttons_summary"
android:key="batch_buttons_settings">
<CheckBoxPreference
android:persistent="false"
android:key="batch_buttons_mark_read"
android:title="@string/global_settings_mark_read"
/>
<CheckBoxPreference
android:persistent="false"
android:key="batch_buttons_delete"
android:title="@string/global_settings_delete"
/>
<CheckBoxPreference
android:persistent="false"
android:key="batch_buttons_archive"
android:title="@string/global_settings_archive"
/>
<CheckBoxPreference
android:persistent="false"
android:key="batch_buttons_move"
android:title="@string/global_settings_move"
/>
<CheckBoxPreference
android:persistent="false"
android:key="batch_buttons_flag"
android:title="@string/global_settings_flag"
/>
<CheckBoxPreference
android:persistent="false"
android:key="batch_buttons_unselect"
android:title="@string/global_settings_unselect"
/>
</PreferenceScreen>
</PreferenceScreen>
<PreferenceScreen

View File

@ -180,7 +180,13 @@ public class K9 extends Application {
private static boolean compactLayouts = false;
private static String mAttachmentDefaultPath = "";
private static boolean mBatchButtonsMarkRead = true;
private static boolean mBatchButtonsDelete = true;
private static boolean mBatchButtonsArchive = false;
private static boolean mBatchButtonsMove = false;
private static boolean mBatchButtonsFlag = true;
private static boolean mBatchButtonsUnselect = true;
private static boolean useGalleryBugWorkaround = false;
private static boolean galleryBuggy;
@ -432,6 +438,13 @@ public class K9 extends Application {
editor.putBoolean("messageViewReturnToList", mMessageViewReturnToList);
editor.putBoolean("messageViewShowNext", mMessageViewShowNext);
editor.putBoolean("batchButtonsMarkRead", mBatchButtonsMarkRead);
editor.putBoolean("batchButtonsDelete", mBatchButtonsDelete);
editor.putBoolean("batchButtonsArchive", mBatchButtonsArchive);
editor.putBoolean("batchButtonsMove", mBatchButtonsMove);
editor.putBoolean("batchButtonsFlag", mBatchButtonsFlag);
editor.putBoolean("batchButtonsUnselect", mBatchButtonsUnselect);
editor.putString("language", language);
editor.putInt("theme", theme);
editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround);
@ -563,6 +576,13 @@ public class K9 extends Application {
mMessageViewReturnToList = sprefs.getBoolean("messageViewReturnToList", false);
mMessageViewShowNext = sprefs.getBoolean("messageViewShowNext", false);
mBatchButtonsMarkRead = sprefs.getBoolean("batchButtonsMarkRead", true);
mBatchButtonsDelete = sprefs.getBoolean("batchButtonsDelete", true);
mBatchButtonsArchive = sprefs.getBoolean("batchButtonsArchive", true);
mBatchButtonsMove = sprefs.getBoolean("batchButtonsMove", true);
mBatchButtonsFlag = sprefs.getBoolean("batchButtonsFlag", true);
mBatchButtonsUnselect = sprefs.getBoolean("batchButtonsUnselect", true);
useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy());
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
@ -990,6 +1010,48 @@ public class K9 extends Application {
K9.compactLayouts = compactLayouts;
}
public static boolean batchButtonsMarkRead() {
return mBatchButtonsMarkRead;
}
public static void setBatchButtonsMarkRead(final boolean state) {
mBatchButtonsMarkRead = state;
}
public static boolean batchButtonsDelete() {
return mBatchButtonsDelete;
}
public static void setBatchButtonsDelete(final boolean state) {
mBatchButtonsDelete = state;
}
public static boolean batchButtonsArchive() {
return mBatchButtonsArchive;
}
public static void setBatchButtonsArchive(final boolean state) {
mBatchButtonsArchive = state;
}
public static boolean batchButtonsMove() {
return mBatchButtonsMove;
}
public static void setBatchButtonsMove(final boolean state) {
mBatchButtonsMove = state;
}
public static boolean batchButtonsFlag() {
return mBatchButtonsFlag;
}
public static void setBatchButtonsFlag(final boolean state) {
mBatchButtonsFlag = state;
}
public static boolean batchButtonsUnselect() {
return mBatchButtonsUnselect;
}
public static void setBatchButtonsUnselect(final boolean state) {
mBatchButtonsUnselect = state;
}
/**
* Check if this system contains a buggy Gallery 3D package.
*

View File

@ -292,6 +292,8 @@ public class MessageList
private ImageButton mBatchReadButton;
private ImageButton mBatchDeleteButton;
private ImageButton mBatchFlagButton;
private ImageButton mBatchArchiveButton;
private ImageButton mBatchMoveButton;
private ImageButton mBatchDoneButton;
private FontSizes mFontSizes = K9.getFontSizes();
@ -867,10 +869,20 @@ public class MessageList
mBatchDeleteButton.setOnClickListener(this);
mBatchFlagButton = (ImageButton) findViewById(R.id.batch_flag_button);
mBatchFlagButton.setOnClickListener(this);
mBatchArchiveButton = (ImageButton) findViewById(R.id.batch_archive_button);
mBatchArchiveButton.setOnClickListener(this);
mBatchMoveButton = (ImageButton) findViewById(R.id.batch_move_button);
mBatchMoveButton.setOnClickListener(this);
mBatchDoneButton = (ImageButton) findViewById(R.id.batch_done_button);
mBatchDoneButton.setOnClickListener(this);
mBatchReadButton.setVisibility(K9.batchButtonsMarkRead() ? View.VISIBLE : View.GONE);
mBatchDeleteButton.setVisibility(K9.batchButtonsDelete() ? View.VISIBLE : View.GONE);
mBatchArchiveButton.setVisibility(K9.batchButtonsArchive() ? View.VISIBLE : View.GONE);
mBatchMoveButton.setVisibility(K9.batchButtonsMove() ? View.VISIBLE : View.GONE);
mBatchFlagButton.setVisibility(K9.batchButtonsFlag() ? View.VISIBLE : View.GONE);
mBatchDoneButton.setVisibility(K9.batchButtonsUnselect() ? View.VISIBLE : View.GONE);
// Gesture detection
gestureDetector = new GestureDetector(new MyGestureDetector(true));
gestureListener = new View.OnTouchListener() {
@ -2476,8 +2488,6 @@ public class MessageList
}
});
}
static class FooterViewHolder {
@ -2537,6 +2547,18 @@ public class MessageList
newState = computeBatchDirection(false);
}
if (v == mBatchArchiveButton) {
final List<MessageInfoHolder> selection = getSelectionFromCheckboxes();
onArchive(selection);
return;
}
if (v == mBatchMoveButton) {
final List<MessageInfoHolder> selection = getSelectionFromCheckboxes();
onMove(selection);
return;
}
synchronized (mAdapter.messages) {
for (MessageInfoHolder holder : mAdapter.messages) {
if (holder.selected) {
@ -2546,6 +2568,8 @@ public class MessageList
holder.flagged = newState;
} else if (v == mBatchReadButton) {
holder.read = newState;
} else if (v == mBatchArchiveButton) {
// TODO
}
messageList.add(holder.message);
}

View File

@ -74,7 +74,12 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_QUIET_TIME_ENABLED = "quiet_time_enabled";
private static final String PREFERENCE_QUIET_TIME_STARTS = "quiet_time_starts";
private static final String PREFERENCE_QUIET_TIME_ENDS = "quiet_time_ends";
private static final String PREFERENCE_BATCH_BUTTONS_MARK_READ = "batch_buttons_mark_read";
private static final String PREFERENCE_BATCH_BUTTONS_DELETE = "batch_buttons_delete";
private static final String PREFERENCE_BATCH_BUTTONS_ARCHIVE = "batch_buttons_archive";
private static final String PREFERENCE_BATCH_BUTTONS_MOVE = "batch_buttons_move";
private static final String PREFERENCE_BATCH_BUTTONS_FLAG = "batch_buttons_flag";
private static final String PREFERENCE_BATCH_BUTTONS_UNSELECT = "batch_buttons_unselect";
private static final String PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT = "messageview_mobile_layout";
private static final String PREFERENCE_BACKGROUND_OPS = "background_ops";
@ -121,6 +126,12 @@ public class Prefs extends K9PreferenceActivity {
private com.fsck.k9.preferences.TimePickerPreference mQuietTimeEnds;
private Preference mAttachmentPathPreference;
private CheckBoxPreference mBatchButtonsMarkRead;
private CheckBoxPreference mBatchButtonsDelete;
private CheckBoxPreference mBatchButtonsArchive;
private CheckBoxPreference mBatchButtonsMove;
private CheckBoxPreference mBatchButtonsFlag;
private CheckBoxPreference mBatchButtonsUnselect;
public static void actionPrefs(Context context) {
Intent i = new Intent(context, Prefs.class);
@ -342,6 +353,19 @@ public class Prefs extends K9PreferenceActivity {
}
};
});
mBatchButtonsMarkRead = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_MARK_READ);
mBatchButtonsDelete = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_DELETE);
mBatchButtonsArchive = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_ARCHIVE);
mBatchButtonsMove = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_MOVE);
mBatchButtonsFlag = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_FLAG);
mBatchButtonsUnselect = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_UNSELECT);
mBatchButtonsMarkRead.setChecked(K9.batchButtonsMarkRead());
mBatchButtonsDelete.setChecked(K9.batchButtonsDelete());
mBatchButtonsArchive.setChecked(K9.batchButtonsArchive());
mBatchButtonsMove.setChecked(K9.batchButtonsMove());
mBatchButtonsFlag.setChecked(K9.batchButtonsFlag());
mBatchButtonsUnselect.setChecked(K9.batchButtonsUnselect());
}
private void saveSettings() {
@ -380,6 +404,12 @@ public class Prefs extends K9PreferenceActivity {
K9.setQuietTimeStarts(mQuietTimeStarts.getTime());
K9.setQuietTimeEnds(mQuietTimeEnds.getTime());
K9.setBatchButtonsMarkRead(mBatchButtonsMarkRead.isChecked());
K9.setBatchButtonsDelete(mBatchButtonsDelete.isChecked());
K9.setBatchButtonsArchive(mBatchButtonsArchive.isChecked());
K9.setBatchButtonsMove(mBatchButtonsMove.isChecked());
K9.setBatchButtonsFlag(mBatchButtonsFlag.isChecked());
K9.setBatchButtonsUnselect(mBatchButtonsUnselect.isChecked());
K9.setZoomControlsEnabled(mZoomControlsEnabled.isChecked());
K9.setAttachmentDefaultPath(mAttachmentPathPreference.getSummary().toString());

View File

@ -191,6 +191,24 @@ public class GlobalSettings {
s.put("zoomControlsEnabled", Settings.versions(
new V(1, new BooleanSetting(false))
));
s.put("batchButtonsMarkRead", Settings.versions(
new V(1, new BooleanSetting(true))
));
s.put("batchButtonsDelete", Settings.versions(
new V(1, new BooleanSetting(true))
));
s.put("batchButtonsArchive", Settings.versions(
new V(1, new BooleanSetting(false))
));
s.put("batchButtonsMove", Settings.versions(
new V(1, new BooleanSetting(false))
));
s.put("batchButtonsFlag", Settings.versions(
new V(1, new BooleanSetting(true))
));
s.put("batchButtonsUnselect", Settings.versions(
new V(1, new BooleanSetting(true))
));
SETTINGS = Collections.unmodifiableMap(s);