Go back to the old behavior for batch mark as (un)read, (un)flag
If there is at least one unread message among the selected messages the action is "mark as read". Otherwise, "mark as unread". If there is at least one unstarred message among the selected messages the action is "add star". Otherwise, "remove star".
BIN
res/drawable-hdpi/ic_action_flag_light.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/drawable-hdpi/ic_action_mark_as_read_light.png
Normal file
After Width: | Height: | Size: 982 B |
Before Width: | Height: | Size: 771 B After Width: | Height: | Size: 771 B |
Before Width: | Height: | Size: 875 B After Width: | Height: | Size: 875 B |
BIN
res/drawable-hdpi/ic_action_unflag_light.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-ldpi/ic_action_flag_light.png
Normal file
After Width: | Height: | Size: 582 B |
BIN
res/drawable-ldpi/ic_action_mark_as_read_light.png
Normal file
After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 430 B |
BIN
res/drawable-ldpi/ic_action_unflag_light.png
Normal file
After Width: | Height: | Size: 646 B |
BIN
res/drawable-mdpi/ic_action_flag_light.png
Normal file
After Width: | Height: | Size: 753 B |
BIN
res/drawable-mdpi/ic_action_mark_as_read_light.png
Normal file
After Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
BIN
res/drawable-mdpi/ic_action_unflag_light.png
Normal file
After Width: | Height: | Size: 929 B |
BIN
res/drawable-xhdpi/ic_action_flag_light.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-xhdpi/ic_action_mark_as_read_light.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1017 B After Width: | Height: | Size: 1017 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-xhdpi/ic_action_unflag_light.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
@ -7,10 +7,16 @@
|
||||
android:icon="?attr/iconActionDelete"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/read_toggle"
|
||||
android:title="@string/read_toggle_action"
|
||||
android:id="@+id/mark_as_read"
|
||||
android:title="@string/mark_as_read_action"
|
||||
android:showAsAction="always"
|
||||
android:icon="?attr/iconActionToggleRead"
|
||||
android:icon="?attr/iconActionMarkAsRead"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/mark_as_unread"
|
||||
android:title="@string/mark_as_unread_action"
|
||||
android:showAsAction="always"
|
||||
android:icon="?attr/iconActionMarkAsUnread"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/archive"
|
||||
@ -21,20 +27,26 @@
|
||||
<item
|
||||
android:id="@+id/move"
|
||||
android:title="@string/move_action"
|
||||
android:showAsAction="ifRoom"
|
||||
android:showAsAction="ifRoom"
|
||||
android:icon="?attr/iconActionMoveOrCopy"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/copy"
|
||||
android:title="@string/copy_action"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/flag_toggle"
|
||||
android:title="@string/flag_toggle_action"
|
||||
<item
|
||||
android:id="@+id/flag"
|
||||
android:title="@string/flag_action"
|
||||
android:showAsAction="ifRoom"
|
||||
android:icon="?attr/iconActionToggleFlag"
|
||||
android:icon="?attr/iconActionFlag"
|
||||
/>
|
||||
<item
|
||||
<item
|
||||
android:id="@+id/unflag"
|
||||
android:title="@string/unflag_action"
|
||||
android:showAsAction="ifRoom"
|
||||
android:icon="?attr/iconActionUnflag"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/spam"
|
||||
android:title="@string/spam_action"
|
||||
android:showAsAction="ifRoom"
|
||||
|
@ -34,9 +34,9 @@
|
||||
<item
|
||||
android:id="@+id/forward"
|
||||
android:title="@string/forward_action"/>
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
android:title="@string/send_alternate_action" />
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
android:title="@string/send_alternate_action" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
@ -61,16 +61,15 @@
|
||||
android:id="@+id/copy"
|
||||
android:title="@string/copy_action"
|
||||
/>
|
||||
<item
|
||||
<item
|
||||
android:id="@+id/toggle_unread"
|
||||
android:alphabeticShortcut="u"
|
||||
android:title="@string/read_toggle_action"
|
||||
android:icon="?attr/iconActionToggleRead"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/select_text"
|
||||
android:title="@string/select_text_action"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/select_text"
|
||||
android:title="@string/select_text_action"
|
||||
android:showAsAction="never"
|
||||
/>
|
||||
</menu>
|
||||
|
@ -14,7 +14,6 @@
|
||||
<attr name="iconActionMoveOrCopy" format="reference" />
|
||||
<attr name="iconActionNextMessage" format="reference" />
|
||||
<attr name="iconActionPreviousMessage" format="reference" />
|
||||
<attr name="iconActionRead" format="reference" />
|
||||
<attr name="iconActionRefresh" format="reference" />
|
||||
<attr name="iconActionSearch" format="reference" />
|
||||
<attr name="iconActionSend" format="reference" />
|
||||
@ -22,8 +21,10 @@
|
||||
<attr name="iconActionSingleMessageOptions" format="reference" />
|
||||
<attr name="iconActionSort" format="reference" />
|
||||
<attr name="iconActionSpam" format="reference" />
|
||||
<attr name="iconActionToggleFlag" format="reference" />
|
||||
<attr name="iconActionToggleRead" format="reference" />
|
||||
<attr name="iconActionFlag" format="reference" />
|
||||
<attr name="iconActionUnflag" format="reference" />
|
||||
<attr name="iconActionMarkAsRead" format="reference" />
|
||||
<attr name="iconActionMarkAsUnread" format="reference" />
|
||||
<attr name="iconMenuAdd" format="reference" />
|
||||
<attr name="iconMenuAttachment" format="reference" />
|
||||
<attr name="iconMenuClear" format="reference" />
|
||||
|
@ -15,7 +15,6 @@
|
||||
<item name="iconActionMoveOrCopy">@drawable/ic_action_move_or_copy_light</item>
|
||||
<item name="iconActionNextMessage">@drawable/ic_action_next_message_light</item>
|
||||
<item name="iconActionPreviousMessage">@drawable/ic_action_previous_message_light</item>
|
||||
<item name="iconActionRead">@drawable/ic_action_read_light</item>
|
||||
<item name="iconActionRefresh">@drawable/ic_action_refresh_light</item>
|
||||
<item name="iconActionSearch">@drawable/ic_action_search_light</item>
|
||||
<item name="iconActionSend">@drawable/ic_action_send_light</item>
|
||||
@ -23,8 +22,10 @@
|
||||
<item name="iconActionSingleMessageOptions">@drawable/ic_action_single_message_options_light</item>
|
||||
<item name="iconActionSort">@drawable/ic_action_sort_light</item>
|
||||
<item name="iconActionSpam">@drawable/ic_action_spam_light</item>
|
||||
<item name="iconActionToggleFlag">@drawable/ic_action_toggle_flag_light</item>
|
||||
<item name="iconActionToggleRead">@drawable/ic_action_toggle_read_light</item>
|
||||
<item name="iconActionFlag">@drawable/ic_action_flag_light</item>
|
||||
<item name="iconActionUnflag">@drawable/ic_action_unflag_light</item>
|
||||
<item name="iconActionMarkAsRead">@drawable/ic_action_mark_as_read_light</item>
|
||||
<item name="iconActionMarkAsUnread">@drawable/ic_action_mark_as_unread_light</item>
|
||||
<item name="iconMenuAdd">@drawable/ic_menu_add</item>
|
||||
<item name="iconMenuAttachment">@drawable/ic_menu_attachment</item>
|
||||
<item name="iconMenuClear">@drawable/ic_menu_clear</item>
|
||||
@ -55,7 +56,6 @@
|
||||
<item name="iconActionMoveOrCopy">@drawable/ic_action_move_or_copy_dark</item>
|
||||
<item name="iconActionNextMessage">@drawable/ic_action_next_message_dark</item>
|
||||
<item name="iconActionPreviousMessage">@drawable/ic_action_previous_message_dark</item>
|
||||
<item name="iconActionRead">@drawable/ic_action_read_dark</item>
|
||||
<item name="iconActionRefresh">@drawable/ic_action_refresh_dark</item>
|
||||
<item name="iconActionSearch">@drawable/ic_action_search_dark</item>
|
||||
<item name="iconActionSend">@drawable/ic_action_send_dark</item>
|
||||
@ -63,8 +63,10 @@
|
||||
<item name="iconActionSingleMessageOptions">@drawable/ic_action_single_message_options_dark</item>
|
||||
<item name="iconActionSort">@drawable/ic_action_sort_dark</item>
|
||||
<item name="iconActionSpam">@drawable/ic_action_spam_dark</item>
|
||||
<item name="iconActionToggleFlag">@drawable/ic_action_toggle_flag_dark</item>
|
||||
<item name="iconActionToggleRead">@drawable/ic_action_toggle_read_dark</item>
|
||||
<item name="iconActionFlag">@drawable/ic_action_flag_light</item>
|
||||
<item name="iconActionUnflag">@drawable/ic_action_unflag_light</item>
|
||||
<item name="iconActionMarkAsRead">@drawable/ic_action_mark_as_read_light</item>
|
||||
<item name="iconActionMarkAsUnread">@drawable/ic_action_mark_as_unread_light</item>
|
||||
<item name="iconMenuAdd">@drawable/ic_menu_add</item>
|
||||
<item name="iconMenuAttachment">@drawable/ic_menu_attachment</item>
|
||||
<item name="iconMenuClear">@drawable/ic_menu_clear</item>
|
||||
@ -81,4 +83,4 @@
|
||||
<item name="iconMenuShowFolders">@drawable/ic_show_folders</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -26,10 +26,8 @@ import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
@ -1402,6 +1400,8 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
messageInfo.flagged = !messageInfo.flagged;
|
||||
mAdapter.sortMessages();
|
||||
}
|
||||
|
||||
computeBatchDirection();
|
||||
}
|
||||
|
||||
private void checkMail(Account account, String folderName) {
|
||||
@ -2368,6 +2368,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mSelectedCount += (isSelected ? 1 : 0);
|
||||
}
|
||||
|
||||
computeBatchDirection();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
if (isSelected) {
|
||||
@ -2395,6 +2396,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||
updateActionModeTitle();
|
||||
computeSelectAllVisibility();
|
||||
computeBatchDirection();
|
||||
} else {
|
||||
mSelectedCount = 0;
|
||||
mActionMode.finish();
|
||||
@ -2408,8 +2410,8 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
mActionMode = MessageList.this.startActionMode(mActionModeCallback);
|
||||
}
|
||||
mActionMode = startActionMode(mActionModeCallback);
|
||||
}
|
||||
|
||||
if (holder.selected) {
|
||||
holder.selected = false;
|
||||
@ -2419,6 +2421,8 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mSelectedCount += 1;
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
computeBatchDirection();
|
||||
updateActionModeTitle();
|
||||
|
||||
// make sure the onPrepareActionMode is called
|
||||
@ -2435,6 +2439,29 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mActionModeCallback.showSelectAll(mSelectedCount != mAdapter.getCount());
|
||||
}
|
||||
|
||||
private void computeBatchDirection() {
|
||||
boolean isBatchFlag = false;
|
||||
boolean isBatchRead = false;
|
||||
|
||||
for (MessageInfoHolder holder : mAdapter.getMessages()) {
|
||||
if (holder.selected) {
|
||||
if (!holder.flagged) {
|
||||
isBatchFlag = true;
|
||||
}
|
||||
if (!holder.read) {
|
||||
isBatchRead = true;
|
||||
}
|
||||
|
||||
if (isBatchFlag && isBatchRead) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mActionModeCallback.showMarkAsRead(isBatchRead);
|
||||
mActionModeCallback.showFlag(isBatchFlag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holders
|
||||
* Messages to update. Never {@code null}.
|
||||
@ -2744,10 +2771,18 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
|
||||
class ActionModeCallback implements ActionMode.Callback {
|
||||
private MenuItem mSelectAll;
|
||||
private MenuItem mMarkAsRead;
|
||||
private MenuItem mMarkAsUnread;
|
||||
private MenuItem mFlag;
|
||||
private MenuItem mUnflag;
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
mSelectAll = menu.findItem(R.id.select_all);
|
||||
mMarkAsRead = menu.findItem(R.id.mark_as_read);
|
||||
mMarkAsUnread = menu.findItem(R.id.mark_as_unread);
|
||||
mFlag = menu.findItem(R.id.flag);
|
||||
mUnflag = menu.findItem(R.id.unflag);
|
||||
|
||||
if (mQueryString != null) {
|
||||
// show all
|
||||
@ -2777,6 +2812,10 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
mActionMode = null;
|
||||
mSelectAll = null;
|
||||
mMarkAsRead = null;
|
||||
mMarkAsUnread = null;
|
||||
mFlag = null;
|
||||
mUnflag = null;
|
||||
setAllSelected(false);
|
||||
}
|
||||
|
||||
@ -2842,6 +2881,20 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void showMarkAsRead(boolean show) {
|
||||
if (mActionMode != null) {
|
||||
mMarkAsRead.setVisible(show);
|
||||
mMarkAsUnread.setVisible(!show);
|
||||
}
|
||||
}
|
||||
|
||||
public void showFlag(boolean show) {
|
||||
if (mActionMode != null) {
|
||||
mFlag.setVisible(show);
|
||||
mUnflag.setVisible(!show);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
final List<MessageInfoHolder> selection = getSelectionFromCheckboxes();
|
||||
@ -2859,12 +2912,24 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
mSelectedCount = 0;
|
||||
break;
|
||||
}
|
||||
case R.id.read_toggle: {
|
||||
onToggleRead(selection);
|
||||
case R.id.mark_as_read: {
|
||||
setFlag(selection, Flag.SEEN, true);
|
||||
computeBatchDirection();
|
||||
break;
|
||||
}
|
||||
case R.id.flag_toggle: {
|
||||
onToggleFlag(selection);
|
||||
case R.id.mark_as_unread: {
|
||||
setFlag(selection, Flag.SEEN, false);
|
||||
computeBatchDirection();
|
||||
break;
|
||||
}
|
||||
case R.id.flag: {
|
||||
setFlag(selection, Flag.FLAGGED, true);
|
||||
computeBatchDirection();
|
||||
break;
|
||||
}
|
||||
case R.id.unflag: {
|
||||
setFlag(selection, Flag.FLAGGED, false);
|
||||
computeBatchDirection();
|
||||
break;
|
||||
}
|
||||
case R.id.select_all: {
|
||||
@ -2900,6 +2965,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener {
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|