1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Add a "done" to the batch buttons.

Make the "done" entry in batch buttons only show up in touch mode
This commit is contained in:
Jesse Vincent 2010-01-13 03:37:04 +00:00
parent b1c9d8918f
commit d5c185545b
2 changed files with 26 additions and 1 deletions

View File

@ -37,6 +37,13 @@
android:layout_weight="1"
android:text="@string/message_list_flag_action"
/>
<Button
android:id="@+id/batch_done_button"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/done_action"
/>
</LinearLayout>
<ListView
android:id="@+id/message_list"

View File

@ -120,6 +120,7 @@ public class MessageList
private Button mBatchReadButton;
private Button mBatchDeleteButton;
private Button mBatchFlagButton;
private Button mBatchDoneButton;
class MessageListHandler extends Handler
{
@ -358,6 +359,16 @@ public class MessageList
mBatchDeleteButton.setOnClickListener(this);
mBatchFlagButton = (Button) findViewById(R.id.batch_flag_button);
mBatchFlagButton.setOnClickListener(this);
mBatchDoneButton = (Button) findViewById(R.id.batch_done_button);
if (mTouchView == true)
{
mBatchDoneButton.setOnClickListener(this);
}
else
{
mBatchDoneButton.setVisibility(View.GONE);
}
Intent intent = getIntent();
mAccount = (Account)intent.getSerializableExtra(EXTRA_ACCOUNT);
@ -2537,6 +2548,12 @@ str.setSpan(new TextAppearanceSpan(null ,Typeface.BOLD ,-1, holder.subject.getTe
List<Message> messageList = new ArrayList<Message>();
List<MessageInfoHolder> removeHolderList = new ArrayList<MessageInfoHolder>();
if (v == mBatchDoneButton)
{
setAllSelected(false);
return;
}
if (v == mBatchFlagButton)
{
newState = computeBatchDirection(true);
@ -2547,6 +2564,7 @@ str.setSpan(new TextAppearanceSpan(null ,Typeface.BOLD ,-1, holder.subject.getTe
}
for (MessageInfoHolder holder : mAdapter.messages)
{
if (holder.selected)
{
if (v == mBatchDeleteButton)
@ -2597,7 +2615,7 @@ str.setSpan(new TextAppearanceSpan(null ,Typeface.BOLD ,-1, holder.subject.getTe
mSelectedCount += (isSelected ? 1 : 0);
}
mAdapter.notifyDataSetChanged();
showBatchButtons();
toggleBatchButtons();
}
private void flagSelected(Flag flag, boolean newState)