mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-16 07:00:14 -05:00
Batch-update buttons now show up when you actually have selected items.
This commit is contained in:
parent
1c5d240564
commit
23e46b82ce
@ -137,7 +137,7 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
configureBatchButtons();
|
toggleBatchButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -305,6 +305,7 @@ public class MessageList
|
|||||||
// toggling the 'selected' checkbox
|
// toggling the 'selected' checkbox
|
||||||
CheckBox selected = (CheckBox) v.findViewById(R.id.selected_checkbox);
|
CheckBox selected = (CheckBox) v.findViewById(R.id.selected_checkbox);
|
||||||
selected.setChecked(!selected.isChecked());
|
selected.setChecked(!selected.isChecked());
|
||||||
|
toggleBatchButtons();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2313,26 +2314,12 @@ public class MessageList
|
|||||||
//We must set the flag before showing the buttons
|
//We must set the flag before showing the buttons
|
||||||
//as the buttons text depends on what is selected
|
//as the buttons text depends on what is selected
|
||||||
message.selected = isChecked;
|
message.selected = isChecked;
|
||||||
showBatchButtons();
|
toggleBatchButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableBatchButtons()
|
|
||||||
{
|
|
||||||
mBatchDeleteButton.setEnabled(true);
|
|
||||||
mBatchReadButton.setEnabled(true);
|
|
||||||
mBatchFlagButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disableBatchButtons()
|
|
||||||
{
|
|
||||||
mBatchDeleteButton.setEnabled(false);
|
|
||||||
mBatchReadButton.setEnabled(false);
|
|
||||||
mBatchFlagButton.setEnabled(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
private void hideBatchButtons()
|
private void hideBatchButtons()
|
||||||
{
|
{
|
||||||
//TODO: Fade out animation
|
//TODO: Fade out animation
|
||||||
@ -2340,12 +2327,11 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
private void showBatchButtons()
|
private void showBatchButtons()
|
||||||
{
|
{
|
||||||
configureBatchButtons();
|
|
||||||
//TODO: Fade in animation
|
//TODO: Fade in animation
|
||||||
mBatchButtonArea.setVisibility(View.VISIBLE);
|
mBatchButtonArea.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureBatchButtons()
|
private void toggleBatchButtons()
|
||||||
{
|
{
|
||||||
if (mSelectedCount < 0)
|
if (mSelectedCount < 0)
|
||||||
{
|
{
|
||||||
@ -2359,7 +2345,7 @@ public class MessageList
|
|||||||
{
|
{
|
||||||
readButtonStringId = R.string.message_list_mark_read_action;
|
readButtonStringId = R.string.message_list_mark_read_action;
|
||||||
flagButtonStringId = R.string.message_list_flag_action;
|
flagButtonStringId = R.string.message_list_flag_action;
|
||||||
disableBatchButtons();
|
hideBatchButtons();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2381,7 +2367,7 @@ public class MessageList
|
|||||||
{
|
{
|
||||||
flagButtonStringId = R.string.message_list_unflag_action;
|
flagButtonStringId = R.string.message_list_unflag_action;
|
||||||
}
|
}
|
||||||
enableBatchButtons();
|
showBatchButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
mBatchReadButton.setText(readButtonStringId);
|
mBatchReadButton.setText(readButtonStringId);
|
||||||
@ -2532,7 +2518,7 @@ public class MessageList
|
|||||||
{
|
{
|
||||||
mController.deleteMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), null);
|
mController.deleteMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), null);
|
||||||
mSelectedCount = 0;
|
mSelectedCount = 0;
|
||||||
configureBatchButtons();
|
toggleBatchButtons();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2599,7 +2585,7 @@ public class MessageList
|
|||||||
|
|
||||||
mController.deleteMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), null);
|
mController.deleteMessages(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]), null);
|
||||||
mSelectedCount = 0;
|
mSelectedCount = 0;
|
||||||
configureBatchButtons();
|
toggleBatchButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveOrCopySelected(boolean isMove)
|
private void moveOrCopySelected(boolean isMove)
|
||||||
|
Loading…
Reference in New Issue
Block a user