diff --git a/res/drawable-hdpi/ic_pin_white.png b/res/drawable-hdpi/ic_pin_white.png
new file mode 100755
index 000000000..e10d8ec39
Binary files /dev/null and b/res/drawable-hdpi/ic_pin_white.png differ
diff --git a/res/drawable-hdpi/ic_unpin_white.png b/res/drawable-hdpi/ic_unpin_white.png
new file mode 100755
index 000000000..ac3b53ad6
Binary files /dev/null and b/res/drawable-hdpi/ic_unpin_white.png differ
diff --git a/res/drawable-mdpi/ic_pin_white.png b/res/drawable-mdpi/ic_pin_white.png
new file mode 100755
index 000000000..80beffef1
Binary files /dev/null and b/res/drawable-mdpi/ic_pin_white.png differ
diff --git a/res/drawable-mdpi/ic_unpin_white.png b/res/drawable-mdpi/ic_unpin_white.png
new file mode 100755
index 000000000..d4bfefdb8
Binary files /dev/null and b/res/drawable-mdpi/ic_unpin_white.png differ
diff --git a/res/drawable-xhdpi/ic_pin_white.png b/res/drawable-xhdpi/ic_pin_white.png
new file mode 100755
index 000000000..6a3eae2d7
Binary files /dev/null and b/res/drawable-xhdpi/ic_pin_white.png differ
diff --git a/res/drawable-xhdpi/ic_unpin_white.png b/res/drawable-xhdpi/ic_unpin_white.png
new file mode 100755
index 000000000..b9dcdc6d4
Binary files /dev/null and b/res/drawable-xhdpi/ic_unpin_white.png differ
diff --git a/res/drawable-xxhdpi/ic_pin_white.png b/res/drawable-xxhdpi/ic_pin_white.png
new file mode 100755
index 000000000..5028e5684
Binary files /dev/null and b/res/drawable-xxhdpi/ic_pin_white.png differ
diff --git a/res/drawable-xxhdpi/ic_unpin_white.png b/res/drawable-xxhdpi/ic_unpin_white.png
new file mode 100755
index 000000000..a3a8109e6
Binary files /dev/null and b/res/drawable-xxhdpi/ic_unpin_white.png differ
diff --git a/res/drawable-xxxhdpi/ic_pin_white.png b/res/drawable-xxxhdpi/ic_pin_white.png
new file mode 100755
index 000000000..41b605cac
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_pin_white.png differ
diff --git a/res/drawable-xxxhdpi/ic_unpin_white.png b/res/drawable-xxxhdpi/ic_unpin_white.png
new file mode 100755
index 000000000..be980d6ce
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_unpin_white.png differ
diff --git a/res/menu/conversation_list_batch_pin.xml b/res/menu/conversation_list_batch_pin.xml
new file mode 100644
index 000000000..36236cfc0
--- /dev/null
+++ b/res/menu/conversation_list_batch_pin.xml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a4b8f7009..d609cdd35 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -183,6 +183,14 @@
Messages in this chat are generated locally by your Delta Chat app. Its makers use it to inform about app updates and problems during usage.
Welcome to Delta Chat! – Delta Chat looks and feels like other popular messenger apps, but does not involve centralized control, tracking or selling you, friends, colleagues or family out to large organizations.\n\nTechnically, Delta Chat is an email application with a modern chat interface. Email in a new dress if you will 👻\n\nUse Delta Chat with anyone out of billions of people: just use their e-mail address. Recipients don\'t need to install Delta Chat, visit websites or sign up anywhere - however, of course, if they like, you may point them to 👉 https://get.delta.chat
Edit contact
+
+ Pin chat
+
+ Unpin chat
+
+ Pin
+
+ Unpin
Mute for 1 hour
Mute for 2 hours
diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java
index 73cf039b1..0b4a5dabb 100644
--- a/src/org/thoughtcrime/securesms/ConversationListFragment.java
+++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java
@@ -214,6 +214,19 @@ public class ConversationListFragment extends Fragment
getLoaderManager().restartLoader(0, null, this);
}
+ private void handlePinAllSelected() {
+ final DcContext dcContext = DcHelper.getContext(getActivity());
+ final Set selectedConversations = new HashSet<>(getListAdapter().getBatchSelections());
+ boolean doPin = areSomeSelectedChatsUnpinned();
+ for (long chatId : selectedConversations) {
+ dcContext.archiveChat((int)chatId, doPin? 2 : 0);
+ }
+ if (actionMode != null) {
+ actionMode.finish();
+ actionMode = null;
+ }
+ }
+
@SuppressLint("StaticFieldLeak")
private void handleArchiveAllSelected() {
final DcContext dcContext = DcHelper.getContext(getActivity());
@@ -405,6 +418,7 @@ public class ConversationListFragment extends Fragment
if (adapter.getBatchSelections().size() == 0) {
actionMode.finish();
} else {
+ updateActionModeItems(actionMode.getMenu());
actionMode.setTitle(String.valueOf(getListAdapter().getBatchSelections().size()));
}
@@ -419,6 +433,7 @@ public class ConversationListFragment extends Fragment
getListAdapter().initializeBatchMode(true);
getListAdapter().toggleThreadInBatchSet(item.getChatId());
getListAdapter().notifyDataSetChanged();
+ updateActionModeItems(actionMode.getMenu());
}
@Override
@@ -429,7 +444,30 @@ public class ConversationListFragment extends Fragment
public interface ConversationSelectedListener {
void onCreateConversation(int chatId);
void onSwitchToArchive();
-}
+ }
+
+ private boolean areSomeSelectedChatsUnpinned() {
+ ApplicationDcContext dcContext = DcHelper.getContext(getActivity());
+ final Set selectedChats = getListAdapter().getBatchSelections();
+ for (long chatId : selectedChats) {
+ DcChat dcChat = dcContext.getChat((int)chatId);
+ if (dcChat.getArchived()!=2) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void updateActionModeItems(Menu menu) {
+ MenuItem pinItem = menu.findItem(R.id.menu_pin_selected);
+ if (areSomeSelectedChatsUnpinned()) {
+ pinItem.setIcon(R.drawable.ic_pin_white);
+ pinItem.setTitle(R.string.pin_chat);
+ } else {
+ pinItem.setIcon(R.drawable.ic_unpin_white);
+ pinItem.setTitle(R.string.unpin_chat);
+ }
+ }
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
@@ -439,6 +477,8 @@ public class ConversationListFragment extends Fragment
MenuInflater inflater = getActivity().getMenuInflater();
+ inflater.inflate(R.menu.conversation_list_batch_pin, menu);
+
if (archive) inflater.inflate(R.menu.conversation_list_batch_unarchive, menu);
else inflater.inflate(R.menu.conversation_list_batch_archive, menu);
@@ -463,6 +503,7 @@ public class ConversationListFragment extends Fragment
switch (item.getItemId()) {
case R.id.menu_select_all: handleSelectAllThreads(); return true;
case R.id.menu_delete_selected: handleDeleteAllSelected(); return true;
+ case R.id.menu_pin_selected: handlePinAllSelected(); return true;
case R.id.menu_archive_selected: handleArchiveAllSelected(); return true;
}