1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Made batch op button's text sensitive to which messages are selected

This commit is contained in:
Bao-Long Nguyen-Trong 2010-01-12 19:39:20 +00:00
parent 47f9b38d2e
commit 1c5d240564
3 changed files with 41 additions and 9 deletions

View File

@ -21,21 +21,21 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Read"
android:text="@string/message_list_mark_read_action"
/>
<Button
android:id="@+id/batch_delete_button"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Delete"
android:text="@string/message_list_delete_action"
/>
<Button
android:id="@+id/batch_flag_button"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Flag"
android:text="@string/message_list_flag_action"
/>
</LinearLayout>
<ListView

View File

@ -211,10 +211,13 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<xliff:g id="polling">%s</xliff:g>
<xliff:g id="sending">%s</xliff:g>
<xliff:g id="push">%s</xliff:g></string>
<string name="message_list_load_more_messages_action">Load more messages</string>
<string name="message_list_load_more_messages_action">Load more messages</string>
<string name="message_list_to_fmt">To:<xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_list_delete_action">Delete</string>
<string name="message_list_mark_read_action">Mark read</string>
<string name="message_list_mark_unread_action">Mark unread</string>
<string name="message_list_flag_action">Flag</string>
<string name="message_list_unflag_action">Unflag</string>
<string name="message_compose_to_hint">To</string>
<string name="message_compose_cc_hint">Cc</string>
@ -228,7 +231,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="message_compose_downloading_attachments_toast">Some attachments were not downloaded. They will be downloaded automatically before this message is sent.</string>
<string name="message_compose_attachments_skipped_toast">Some attachments cannot be forwarded because they have not downloaded.</string>
<string name="message_list_to_fmt">To:<xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_view_from_format">From: <xliff:g id="name">%s</xliff:g> &lt;<xliff:g id="email">%s</xliff:g>&gt;</string>
<string name="message_view_to_label">To:</string>

View File

@ -2310,8 +2310,10 @@ public class MessageList
{
mSelectedCount--;
}
showBatchButtons();
//We must set the flag before showing the buttons
//as the buttons text depends on what is selected
message.selected = isChecked;
showBatchButtons();
}
}
}
@ -2349,14 +2351,41 @@ public class MessageList
{
mSelectedCount = 0;
}
int readButtonStringId;
int flagButtonStringId;
if (mSelectedCount==0)
{
readButtonStringId = R.string.message_list_mark_read_action;
flagButtonStringId = R.string.message_list_flag_action;
disableBatchButtons();
}
else
{
boolean newReadState = computeBatchDirection(false);
if (newReadState)
{
readButtonStringId = R.string.message_list_mark_read_action;
}
else
{
readButtonStringId = R.string.message_list_mark_unread_action;
}
boolean newFlagState = computeBatchDirection(true);
if (newFlagState)
{
flagButtonStringId = R.string.message_list_flag_action;
}
else
{
flagButtonStringId = R.string.message_list_unflag_action;
}
enableBatchButtons();
}
mBatchReadButton.setText(readButtonStringId);
mBatchFlagButton.setText(flagButtonStringId);
}
class FooterViewHolder