mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
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.
This commit is contained in:
parent
0de7b15aa1
commit
591a3af6dc
BIN
res/drawable/btn_check_buttonless_dark_off.png
Normal file
BIN
res/drawable/btn_check_buttonless_dark_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 879 B |
BIN
res/drawable/btn_check_buttonless_dark_on.png
Normal file
BIN
res/drawable/btn_check_buttonless_dark_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 821 B |
BIN
res/drawable/btn_check_small_off.png
Executable file
BIN
res/drawable/btn_check_small_off.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 362 B |
BIN
res/drawable/btn_check_small_on.png
Executable file
BIN
res/drawable/btn_check_small_on.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 294 B |
BIN
res/drawable/btn_star_big_buttonless_off.png
Normal file
BIN
res/drawable/btn_star_big_buttonless_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 774 B |
BIN
res/drawable/btn_star_big_buttonless_on.png
Normal file
BIN
res/drawable/btn_star_big_buttonless_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 895 B |
8
res/drawable/checkbox_small.xml
Normal file
8
res/drawable/checkbox_small.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="false"
|
||||
android:drawable="@drawable/btn_check_small_off" />
|
||||
|
||||
<item android:state_checked="true"
|
||||
android:drawable="@drawable/btn_check_small_on" />
|
||||
</selector>
|
8
res/drawable/star.xml
Normal file
8
res/drawable/star.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="false"
|
||||
android:drawable="@drawable/btn_star_big_buttonless_off" />
|
||||
|
||||
<item android:state_checked="true"
|
||||
android:drawable="@drawable/btn_star_big_buttonless_on" />
|
||||
</selector>
|
@ -4,28 +4,38 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingRight="1dip"
|
||||
android:paddingTop="2dip"
|
||||
android:background="#cccccc"
|
||||
>
|
||||
<LinearLayout android:id="@+id/widgets_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
/>
|
||||
<View
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:focusable="false"
|
||||
android:button="@drawable/star"
|
||||
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="20dip"
|
||||
android:layout_width="20dip"
|
||||
android:layout_alignParentRight="true"
|
||||
/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginRight="2dip"
|
||||
android:layout_height="20dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:padding="0dip"
|
||||
/>
|
||||
|
||||
<LinearLayout android:id="@+id/widgets_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_toRightOf="@id/chip"
|
||||
/>
|
||||
>
|
||||
<CheckBox
|
||||
android:id="@+id/selected_checkbox"
|
||||
android:layout_width="12dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/checkbox_small"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
@ -36,7 +46,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toLeftOf="@+id/widgets_right" />
|
||||
android:layout_toLeftOf="@+id/flagged"/>
|
||||
<TextView
|
||||
android:id="@+id/from"
|
||||
android:ellipsize="end"
|
||||
@ -59,6 +69,6 @@
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_marginRight="1dip"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toRightOf="@+id/widgets_left"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_toLeftOf="@+id/from" />
|
||||
</RelativeLayout>
|
||||
|
@ -7,23 +7,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:focusable="false"
|
||||
style="?android:attr/starStyle"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="15dip"
|
||||
android:layout_width="15dip"
|
||||
/>
|
||||
<!-- http://stackoverflow.com/questions/1121192/android-custom-listview-unable-to-click-on-items
|
||||
we want something a bit bigger than it is right now -->
|
||||
<CheckBox
|
||||
android:id="@+id/selected_checkbox"
|
||||
android:layout_width="18dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:focusable="false"
|
||||
android:button="@drawable/checkbox"
|
||||
android:background="@drawable/checkbox_background"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
@ -7,24 +7,38 @@
|
||||
android:paddingTop="2dip"
|
||||
android:background="#cccccc"
|
||||
>
|
||||
<LinearLayout android:id="@+id/widgets_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
/>
|
||||
<View
|
||||
<RelativeLayout
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
android:layout_width="4dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginRight="2dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
/>
|
||||
<LinearLayout android:id="@+id/widgets_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_toRightOf="@id/chip"
|
||||
/>
|
||||
>
|
||||
<CheckBox
|
||||
android:id="@+id/selected_checkbox"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/checkbox"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:focusable="false"
|
||||
android:button="@drawable/star"
|
||||
android:layout_alignParentRight="true"
|
||||
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="20dip"
|
||||
android:layout_width="20dip"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:ellipsize="end"
|
||||
@ -34,8 +48,8 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_toLeftOf="@id/widgets_right"
|
||||
android:layout_toRightOf="@+id/widgets_left"
|
||||
android:layout_toLeftOf="@id/flagged"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_marginRight="1dip" />
|
||||
<TextView
|
||||
@ -48,7 +62,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/widgets_right"
|
||||
android:layout_toLeftOf="@id/flagged"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
@ -64,7 +78,7 @@
|
||||
android:paddingLeft="12dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toLeftOf="@id/date"
|
||||
android:layout_toRightOf="@id/widgets_left"
|
||||
android:layout_toRightOf="@id/chip"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -16,12 +16,4 @@
|
||||
/>
|
||||
<!-- http://stackoverflow.com/questions/1121192/android-custom-listview-unable-to-click-on-items
|
||||
we want something a bit bigger than it is right now -->
|
||||
<CheckBox
|
||||
android:id="@+id/selected_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:focusable="false"
|
||||
android:button="@drawable/checkbox"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
@ -3,6 +3,15 @@
|
||||
<item
|
||||
android:id="@+id/open"
|
||||
android:title="@string/open_action"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/select"
|
||||
android:title="@string/select_action"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/unselect"
|
||||
android:visible="false"
|
||||
android:title="@string/unselect_action"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
|
@ -47,11 +47,6 @@
|
||||
android:title="@string/batch_flag_mode"
|
||||
android:visible="false"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/batch_select_mode"
|
||||
android:title="@string/batch_select_mode"
|
||||
android:visible="false"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/batch_plain_mode"
|
||||
android:title="@string/batch_plain_mode"
|
||||
|
@ -35,6 +35,8 @@
|
||||
<string name="okay_action">OK</string> <!-- User to confirm acceptance of dialog boxes, warnings, errors, etc. -->
|
||||
<string name="cancel_action">Cancel</string>
|
||||
<string name="send_action">Send</string>
|
||||
<string name="select_action">Select</string>
|
||||
<string name="unselect_action">Unselect</string>
|
||||
<string name="reply_action">Reply</string>
|
||||
<string name="reply_all_action">Reply all</string>
|
||||
<string name="delete_action">Delete</string>
|
||||
|
@ -464,7 +464,7 @@ public class MessagingController implements Runnable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (MessagingListener l : getListeners())
|
||||
{
|
||||
l.listFoldersFinished(account);
|
||||
|
@ -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<Message> messageList = new ArrayList<Message>();
|
||||
|
@ -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))
|
||||
{
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user