From 591a3af6dc6e10c60352b167e41ef7c200755d7f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 17 Jan 2010 04:20:39 +0000 Subject: [PATCH] Eliminate "select" mode in favor of a unified swipe and context menu -based always-available select action. For the moment, this means that widgets_on_left does nothing at all. based on feedback, I may kill the preference and multi-mode behaviour entirely in favor of "show stars?" (and possibly "show stars on left" Stars, "checkboxes" and color bars updated to actually fit in wide mode. --- .../btn_check_buttonless_dark_off.png | Bin 0 -> 879 bytes res/drawable/btn_check_buttonless_dark_on.png | Bin 0 -> 821 bytes res/drawable/btn_check_small_off.png | Bin 0 -> 362 bytes res/drawable/btn_check_small_on.png | Bin 0 -> 294 bytes res/drawable/btn_star_big_buttonless_off.png | Bin 0 -> 774 bytes res/drawable/btn_star_big_buttonless_on.png | Bin 0 -> 895 bytes res/drawable/checkbox_small.xml | 8 ++ res/drawable/star.xml | 8 ++ res/layout-land/message_list_item.xml | 48 ++++--- res/layout-land/message_list_widgets.xml | 17 --- res/layout/message_list_item.xml | 48 ++++--- res/layout/message_list_widgets.xml | 8 -- res/menu/message_list_context.xml | 9 ++ res/menu/message_list_option.xml | 5 - res/values/strings.xml | 2 + src/com/fsck/k9/MessagingController.java | 2 +- src/com/fsck/k9/activity/MessageList.java | 120 +++++++----------- src/com/fsck/k9/mail/store/ImapStore.java | 4 +- 18 files changed, 137 insertions(+), 142 deletions(-) create mode 100644 res/drawable/btn_check_buttonless_dark_off.png create mode 100644 res/drawable/btn_check_buttonless_dark_on.png create mode 100755 res/drawable/btn_check_small_off.png create mode 100755 res/drawable/btn_check_small_on.png create mode 100644 res/drawable/btn_star_big_buttonless_off.png create mode 100644 res/drawable/btn_star_big_buttonless_on.png create mode 100644 res/drawable/checkbox_small.xml create mode 100644 res/drawable/star.xml diff --git a/res/drawable/btn_check_buttonless_dark_off.png b/res/drawable/btn_check_buttonless_dark_off.png new file mode 100644 index 0000000000000000000000000000000000000000..ac9740a88e2d4f49f80bc68288b2d29720ed55f1 GIT binary patch literal 879 zcmV-#1CacQP)9K`8w^3{MZL(TA`-0^B|VA<>%n0E1o74&lzJ$L7B6j&-cm(rMXOd!now4y z>Y5PU_}IMr`xRHz#58Ih7-n{M=d-`Z{Juk`QYqrL8b#b<%M&LunXCYYwc-rhx+Cn+j-r;^DeaddP<4G#}L8Xq4w!~DfL%gtu< z7XYsq3vL1SeA{a#hhW76}0#&U_lUwU5=B)7J6Nzt7KqD@D$YPKyXuC=`0FPRGI0@7IHa`j4MJ z-_3dyF~PA|jDU<2i9{k7FgG?fRy;d5XEGU${!8Hq3-dg=v%M_~>~i^`P>71fqFKRS zuUF=Bxtbn6Ft8Bst&Ha!8(Pfsyb5BdmrA9vb(ZCmiA1odxCn-18W{KV^z<~=R9CYD z15VGu;h_|dcSg%smY0S+uu+&8d8LqpGeKA-Gl z`IiXB1dfc1G?}aV1s6*mZVx`icq*4`225)n9y%39PED+(09)CAk>G*4EZF z5F|N>S)I7v($Z3&ErFLxE`UhrDJ&wC0LEtHgMq-050jI|=H}*lIPWqEC80Yy+7~h< z5ci=vA}0+FGARj%!>DqkC|=zTM?i=~mR46+H7I~kfxb)$L@@4y{S1DxjoYn1i>)<0nsZ=J;s#^}11qsC_ z0izUFtCiE~bnbI-XjrY002ovPDHLk FV1h#{nk@hT literal 0 HcmV?d00001 diff --git a/res/drawable/btn_check_buttonless_dark_on.png b/res/drawable/btn_check_buttonless_dark_on.png new file mode 100644 index 0000000000000000000000000000000000000000..3778aae9b411a45f62db0ccbea79f4513d7408fe GIT binary patch literal 821 zcmV-51Iqk~P)q2vAD&78OHue&7fci6udfL1=uo}R4l+>7 zv)FRRDgkfsZEPENWxP>jSnURx(=ut0wh)N3T_YHSgFOV? z#lc?|6v$IUaCDOD69)S{li`7zaq?XiA#U~~xkltl^Kt5FqH&yTvY=anCkI|j#BfCp zz|tIpP2`+%I1MIUcV_x==jbf19+}1gTZm=J`jG>lCK-FWLwUgPV-B|O;T3Dum%(Y) z9acYVW|57Z_ekh#2q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=xjWnMo#-W+IX3EH5v|2_b{|d|n6Ogu~&1R4S$Aayk3AtZ>fB z*4EbRLZL9awzf99u&{8gC`!&txyv~pE0@c!R8>`WcXzKRCMN0|8yg>Du~_r3(6w5v z#{ixYLJGlP@C<-U2Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igG< z0|pm;dl0(-00RF>L_t(I%YBqfXq;6P$A9O`oy;qlOeSfD7>ihI6=J8w2gb)P2E~O{ z(2W~4piA-9ooGc&7Nsen3yW!~ikmKKkqRypQM8~meUKns*^o3%G8re6=gjxb_ucQf z$W#Y9lM8>i_uO-ThkO5rE9@{v4?FQfF?=OdoJ@+dAB|IKmTPtbwZ$X-*?r*|4Si>` z%pCA@vs`Hu96Jp0uDhLfQ9R<5FzpuN) z4)uLvX&dwfT?7RzrOmODH(g$yd80Z@m(3{?SkHJ z$Y!8DiHabq|5sGdjV&a<0*n8^QgK_Z?;JOSLoYwjZO?O8w+9YNh@gN)w9X9$M3Gbs zQhjj$?(NV@31%uo54U{&&2(Ym*3wg6ae7xm0&%nk3qeAlrusP+4Xa3@0L93m!h?ff ze{4kLQngxrXZCmJSiU&1zbEC2F{m_Y4F$CUvb=66r(a#_d*qW3Bk|0+|B_wL8@hGz zgJbE{QxA0}D+S|B_@`YDe-cWoXXe@z{X4^-ve;w^*YdZZ*DJIH;rh?%R11ZTH`0nrLJhjQkX|(y_{=vBR3+CpBQg_;^c_kKRPw%<=n+t z#FU{kV*0)vd9mkCH&nTL@}<+0pY{85KO9+Hox3(>RdcGEP}Qha?Jvz<8C(A2^xWj= zLGQ|m=P#`0|L$t|ja0WvgR1(RIOakm-hL6Vx6P=zYXYybCk))zL}W6ONT0vG|1aAB VV?Iv1i825H002ovPDHLkV1oP}qR#*T literal 0 HcmV?d00001 diff --git a/res/drawable/checkbox_small.xml b/res/drawable/checkbox_small.xml new file mode 100644 index 000000000..77e9bcb96 --- /dev/null +++ b/res/drawable/checkbox_small.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/res/drawable/star.xml b/res/drawable/star.xml new file mode 100644 index 000000000..919c114a9 --- /dev/null +++ b/res/drawable/star.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/res/layout-land/message_list_item.xml b/res/layout-land/message_list_item.xml index 01f895186..7469b8935 100644 --- a/res/layout-land/message_list_item.xml +++ b/res/layout-land/message_list_item.xml @@ -4,28 +4,38 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingRight="1dip" - android:paddingTop="2dip" android:background="#cccccc" > - - + - - + > + + + android:layout_toLeftOf="@+id/flagged"/> diff --git a/res/layout-land/message_list_widgets.xml b/res/layout-land/message_list_widgets.xml index d06ff2b18..28f16a077 100644 --- a/res/layout-land/message_list_widgets.xml +++ b/res/layout-land/message_list_widgets.xml @@ -7,23 +7,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" > - - diff --git a/res/layout/message_list_item.xml b/res/layout/message_list_item.xml index 4df55f607..9c8c7c5cd 100644 --- a/res/layout/message_list_item.xml +++ b/res/layout/message_list_item.xml @@ -7,24 +7,38 @@ android:paddingTop="2dip" android:background="#cccccc" > - - - + > + + + diff --git a/res/layout/message_list_widgets.xml b/res/layout/message_list_widgets.xml index 9172c3346..62db0cd43 100644 --- a/res/layout/message_list_widgets.xml +++ b/res/layout/message_list_widgets.xml @@ -16,12 +16,4 @@ /> - diff --git a/res/menu/message_list_context.xml b/res/menu/message_list_context.xml index aba0de499..81e4917dc 100644 --- a/res/menu/message_list_context.xml +++ b/res/menu/message_list_context.xml @@ -3,6 +3,15 @@ + + - OK Cancel Send + Select + Unselect Reply Reply all Delete diff --git a/src/com/fsck/k9/MessagingController.java b/src/com/fsck/k9/MessagingController.java index 5c741dde9..3d6e3a882 100644 --- a/src/com/fsck/k9/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -464,7 +464,7 @@ public class MessagingController implements Runnable } } } - + for (MessagingListener l : getListeners()) { l.listFoldersFinished(account); diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 1c3133b3b..10b149ba8 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -76,7 +76,6 @@ public class MessageList private static final int WIDGET_NONE = 1; private static final int WIDGET_FLAG = 2; - private static final int WIDGET_MULTISELECT = 3; private ListView mListView; @@ -309,7 +308,7 @@ public class MessageList mController.loadMoreMessages(mAccount, mFolderName, mAdapter.mListener); return; } - else if (mSelectedWidget == WIDGET_MULTISELECT || (mTouchView != false && mSelectedCount > 0)) + else if (mSelectedCount > 0) { // In multiselect mode make sure that clicking on the item results in // toggling the 'selected' checkbox @@ -726,11 +725,6 @@ public class MessageList switch (mSelectedWidget) { case WIDGET_FLAG: - { - mSelectedWidget = WIDGET_MULTISELECT; - break; - } - case WIDGET_MULTISELECT: { mSelectedWidget = WIDGET_NONE; break; @@ -753,11 +747,6 @@ public class MessageList break; } case WIDGET_NONE: - { - mSelectedWidget=WIDGET_MULTISELECT; - break; - } - case WIDGET_MULTISELECT: { mSelectedWidget=WIDGET_FLAG; break; @@ -781,9 +770,6 @@ public class MessageList case WIDGET_NONE: hideBatchButtons(); break; - case WIDGET_MULTISELECT: - toggleBatchButtons(); - break; } int count = mListView.getChildCount(); @@ -807,26 +793,14 @@ public class MessageList if (showWidget == WIDGET_NONE) { - v.findViewById(R.id.widgets).setVisibility(View.GONE); + flagged.setVisibility(View.GONE); return; } else - { - v.findViewById(R.id.widgets).setVisibility(View.VISIBLE); - } - - - - if (showWidget == WIDGET_MULTISELECT) - { - flagged.setVisibility(View.GONE); - selected.setVisibility(View.VISIBLE); - } - else { flagged.setVisibility(View.VISIBLE); - selected.setVisibility(View.GONE); } + } private void onAccounts() @@ -1290,11 +1264,6 @@ public class MessageList configureWidgets(); return true; - case R.id.batch_select_mode: - mSelectedWidget = WIDGET_MULTISELECT; - configureWidgets(); - return true; - case R.id.batch_flag_mode: mSelectedWidget = WIDGET_FLAG; configureWidgets(); @@ -1317,7 +1286,7 @@ public class MessageList R.id.batch_select_all, R.id.batch_deselect_all }; - private final int[] batch_modes = { R.id.batch_flag_mode, R.id.batch_select_mode, R.id.batch_plain_mode }; + private final int[] batch_modes = { R.id.batch_flag_mode, R.id.batch_plain_mode }; private void setOpsState(Menu menu, boolean state, boolean enabled) { @@ -1349,17 +1318,21 @@ public class MessageList menu.findItem(R.id.list_folders).setVisible(false); menu.findItem(R.id.expunge).setVisible(false); } - if (mTouchView == true || mSelectedWidget == WIDGET_MULTISELECT) + if (mSelectedWidget == WIDGET_FLAG) + { + setOpsState(menu, false, false); + setOpsMode(menu, R.id.batch_flag_mode); + } + else if (mSelectedWidget == WIDGET_NONE) + { + setOpsState(menu, false, false); + setOpsMode(menu, R.id.batch_plain_mode); + } + else { boolean anySelected = anySelected(); setOpsState(menu, true, anySelected); - if (mTouchView == false) - { - setOpsMode(menu, R.id.batch_select_mode); - } - - boolean newFlagState = computeBatchDirection(true); boolean newReadState = computeBatchDirection(false); menu.findItem(R.id.batch_flag_op).setVisible(newFlagState); @@ -1372,16 +1345,6 @@ public class MessageList menu.findItem(R.id.batch_move_op).setVisible(false); menu.findItem(R.id.batch_copy_op).setVisible(false); } - else if (mSelectedWidget == WIDGET_FLAG) - { - setOpsState(menu, false, false); - setOpsMode(menu, R.id.batch_flag_mode); - } - else if (mSelectedWidget == WIDGET_NONE) - { - setOpsState(menu, false, false); - setOpsMode(menu, R.id.batch_plain_mode); - } if (mCurrentFolder != null && mCurrentFolder.outbox) { @@ -1420,17 +1383,22 @@ public class MessageList { case R.id.open: onOpenMessage(holder); + break; + case R.id.select: + setSelected(holder, true); + break; + + case R.id.unselect: + setSelected(holder, false); break; case R.id.delete: onDelete(holder, info.position); - break; case R.id.reply: onReply(holder); - break; case R.id.reply_all: @@ -1536,13 +1504,6 @@ public class MessageList AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; MessageInfoHolder message = (MessageInfoHolder) mAdapter.getItem(info.position); - // in multi-select mode, the context menu pops up unintentionally - // causes misclicks - if (mSelectedWidget == WIDGET_MULTISELECT) - { - return; - } - if (message == null) { return; @@ -1571,6 +1532,17 @@ public class MessageList { menu.findItem(R.id.move).setVisible(false); } + if (message.selected) + { + menu.findItem(R.id.select).setVisible(false); + menu.findItem(R.id.unselect).setVisible(true); + } + else + { + menu.findItem(R.id.select).setVisible(true); + menu.findItem(R.id.unselect).setVisible(false); + } + } class MessageListAdapter extends BaseAdapter @@ -1999,18 +1971,6 @@ public class MessageList { view = mInflater.inflate(R.layout.message_list_item, parent, false); view.setId(R.layout.message_list_item); - View widgetParent; - if (mLeftHanded == false) - { - widgetParent = view.findViewById(R.id.widgets_right); - } - else - { - widgetParent = view.findViewById(R.id.widgets_left); - } - View widgets = mInflater.inflate(R.layout.message_list_widgets,parent,false); - widgets.setId(R.id.widgets); - ((LinearLayout) widgetParent).addView(widgets); } } @@ -2701,6 +2661,20 @@ public class MessageList toggleBatchButtons(); } + private void setSelected(MessageInfoHolder holder, boolean newState) + { + + if (holder.selected != newState) + { + holder.selected = newState; + mSelectedCount += (newState ? 1 : -1); + } + mAdapter.notifyDataSetChanged(); + toggleBatchButtons(); + + } + + private void flagSelected(Flag flag, boolean newState) { List messageList = new ArrayList(); diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 07ddab2e9..a7f633e84 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -610,7 +610,7 @@ public class ImapStore extends Store { return mName; } - + private boolean exists(String folderName) throws MessagingException { try @@ -741,7 +741,7 @@ public class ImapStore extends Store try { String remoteDestName = encodeFolderName(iFolder.getPrefixedName()); - + if (!exists(remoteDestName)) { /*