Batch selection mode improvements
Simplified and now the same for conversation and conversation list. Added also some styling. Closes #7410
This commit is contained in:
parent
56c95d1d1b
commit
4bdb2acd29
5 changed files with 27 additions and 11 deletions
|
@ -18,7 +18,7 @@
|
|||
<item android:title="@string/conversation_context__menu_forward_message"
|
||||
android:id="@+id/menu_context_forward"
|
||||
android:icon="?menu_forward_icon"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item android:title="@string/conversation_context__menu_resend_message"
|
||||
android:id="@+id/menu_context_resend"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<color name="conversation_compose_divider">#32000000</color>
|
||||
|
||||
<color name="action_mode_status_bar">#ff1f1f1f</color>
|
||||
<color name="action_mode_status_bar">@color/gray65</color>
|
||||
<color name="touch_highlight">#400099cc</color>
|
||||
|
||||
<color name="device_link_item_background_light">#ffffffff</color>
|
||||
|
|
|
@ -115,6 +115,8 @@
|
|||
<item name="theme_type">light</item>
|
||||
<item name="actionBarStyle">@style/TextSecure.LightActionBar</item>
|
||||
<item name="actionBarTabBarStyle">@style/TextSecure.LightActionBar.TabBar</item>
|
||||
<item name="actionModeBackground">@color/gray50</item>
|
||||
<item name="actionModeCloseDrawable">@drawable/ic_close_white_24dp</item>
|
||||
<item name="colorPrimary">@color/textsecure_primary</item>
|
||||
<item name="colorPrimaryDark">@color/textsecure_primary_dark</item>
|
||||
<item name="colorAccent">@color/textsecure_primary_dark</item>
|
||||
|
@ -241,6 +243,8 @@
|
|||
<item name="actionBarStyle">@style/TextSecure.DarkActionBar</item>
|
||||
<item name="actionBarTabBarStyle">@style/TextSecure.DarkActionBar.TabBar</item>
|
||||
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
|
||||
<item name="actionModeBackground">@color/gray50</item>
|
||||
<item name="actionModeCloseDrawable">@drawable/ic_close_white_24dp</item>
|
||||
<item name="android:textColor">@color/text_color_dark_theme</item>
|
||||
<item name="android:textColorSecondary">@color/text_color_secondary_dark_theme</item>
|
||||
<item name="colorAccent">@color/textsecure_primary_dark</item>
|
||||
|
|
|
@ -201,6 +201,7 @@ public class ConversationFragment extends Fragment
|
|||
private void setCorrectMenuVisibility(Menu menu) {
|
||||
Set<MessageRecord> messageRecords = getListAdapter().getSelectedItems();
|
||||
boolean actionMessage = false;
|
||||
boolean mediaMessage = false;
|
||||
|
||||
if (actionMode != null && messageRecords.size() == 0) {
|
||||
actionMode.finish();
|
||||
|
@ -215,6 +216,12 @@ public class ConversationFragment extends Fragment
|
|||
{
|
||||
actionMessage = true;
|
||||
break;
|
||||
} else if (messageRecord.isMms() &&
|
||||
!messageRecord.isMmsNotification() &&
|
||||
((MediaMmsMessageRecord)messageRecord).containsMediaSlide())
|
||||
{
|
||||
mediaMessage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +230,7 @@ public class ConversationFragment extends Fragment
|
|||
menu.findItem(R.id.menu_context_details).setVisible(false);
|
||||
menu.findItem(R.id.menu_context_save_attachment).setVisible(false);
|
||||
menu.findItem(R.id.menu_context_resend).setVisible(false);
|
||||
menu.findItem(R.id.menu_context_copy).setVisible(!actionMessage);
|
||||
menu.findItem(R.id.menu_context_copy).setVisible(!actionMessage && !mediaMessage);
|
||||
} else {
|
||||
MessageRecord messageRecord = messageRecords.iterator().next();
|
||||
|
||||
|
@ -235,7 +242,7 @@ public class ConversationFragment extends Fragment
|
|||
|
||||
menu.findItem(R.id.menu_context_forward).setVisible(!actionMessage);
|
||||
menu.findItem(R.id.menu_context_details).setVisible(!actionMessage);
|
||||
menu.findItem(R.id.menu_context_copy).setVisible(!actionMessage);
|
||||
menu.findItem(R.id.menu_context_copy).setVisible(!actionMessage && !mediaMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -578,7 +585,13 @@ public class ConversationFragment extends Fragment
|
|||
((ConversationAdapter) list.getAdapter()).toggleSelection(messageRecord);
|
||||
list.getAdapter().notifyDataSetChanged();
|
||||
|
||||
setCorrectMenuVisibility(actionMode.getMenu());
|
||||
if (getListAdapter().getSelectedItems().size() == 0) {
|
||||
actionMode.finish();
|
||||
} else {
|
||||
setCorrectMenuVisibility(actionMode.getMenu());
|
||||
actionMode.setTitle(String.valueOf(getListAdapter().getSelectedItems().size()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,6 +615,8 @@ public class ConversationFragment extends Fragment
|
|||
MenuInflater inflater = mode.getMenuInflater();
|
||||
inflater.inflate(R.menu.conversation_context, menu);
|
||||
|
||||
mode.setTitle("1");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = getActivity().getWindow();
|
||||
statusBarColor = window.getStatusBarColor();
|
||||
|
|
|
@ -322,8 +322,7 @@ public class ConversationListFragment extends Fragment
|
|||
|
||||
private void handleSelectAllThreads() {
|
||||
getListAdapter().selectAllThreads();
|
||||
actionMode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount,
|
||||
String.valueOf(getListAdapter().getBatchSelections().size())));
|
||||
actionMode.setTitle(String.valueOf(getListAdapter().getBatchSelections().size()));
|
||||
}
|
||||
|
||||
private void handleCreateConversation(long threadId, Recipient recipient, int distributionType, long lastSeen) {
|
||||
|
@ -374,8 +373,7 @@ public class ConversationListFragment extends Fragment
|
|||
if (adapter.getBatchSelections().size() == 0) {
|
||||
actionMode.finish();
|
||||
} else {
|
||||
actionMode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount,
|
||||
String.valueOf(adapter.getBatchSelections().size())));
|
||||
actionMode.setTitle(String.valueOf(getListAdapter().getBatchSelections().size()));
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
|
@ -410,8 +408,7 @@ public class ConversationListFragment extends Fragment
|
|||
|
||||
inflater.inflate(R.menu.conversation_list_batch, menu);
|
||||
|
||||
mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode);
|
||||
mode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount, "1"));
|
||||
mode.setTitle("1");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar));
|
||||
|
|
Loading…
Add table
Reference in a new issue