diff --git a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt index 20d3298cb..7e803a7a7 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt @@ -111,7 +111,7 @@ class MainActivity : BaseActivity(), ActionBarProvider { if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) { if (!router!!.hasRootController()) { router!!.setRoot( - RouterTransaction.with(ConversationsListController()) + RouterTransaction.with(ConversationsListController(Bundle())) .pushChangeHandler(HorizontalChangeHandler()) .popChangeHandler(HorizontalChangeHandler()) ) @@ -121,7 +121,7 @@ class MainActivity : BaseActivity(), ActionBarProvider { if (hasDb) { if (userUtils.anyUserExists()) { router!!.setRoot( - RouterTransaction.with(ConversationsListController()) + RouterTransaction.with(ConversationsListController(Bundle())) .pushChangeHandler(HorizontalChangeHandler()) .popChangeHandler(HorizontalChangeHandler()) ) @@ -174,7 +174,7 @@ class MainActivity : BaseActivity(), ActionBarProvider { fun resetConversationsList() { if (userUtils.anyUserExists()) { router!!.setRoot( - RouterTransaction.with(ConversationsListController()) + RouterTransaction.with(ConversationsListController(Bundle())) .pushChangeHandler(HorizontalChangeHandler()) .popChangeHandler(HorizontalChangeHandler()) ) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/AccountVerificationController.java b/app/src/main/java/com/nextcloud/talk/controllers/AccountVerificationController.java index 4401e6796..09a882fe4 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/AccountVerificationController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/AccountVerificationController.java @@ -443,7 +443,7 @@ public class AccountVerificationController extends BaseController { getActivity().runOnUiThread(() -> { if (userUtils.getUsers().size() == 1) { getRouter().setRoot(RouterTransaction.with(new - ConversationsListController()) + ConversationsListController(new Bundle())) .pushChangeHandler(new HorizontalChangeHandler()) .popChangeHandler(new HorizontalChangeHandler())); } else { @@ -524,7 +524,7 @@ public class AccountVerificationController extends BaseController { } else { if (userUtils.anyUserExists()) { - getRouter().setRoot(RouterTransaction.with(new ConversationsListController()) + getRouter().setRoot(RouterTransaction.with(new ConversationsListController(new Bundle())) .pushChangeHandler(new HorizontalChangeHandler()) .popChangeHandler(new HorizontalChangeHandler())); } else { diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt index da4a949fa..2875ea51d 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -2165,6 +2165,14 @@ class ChatController(args: Bundle) : clipboardManager.setPrimaryClip(clipData) true } + R.id.action_forward_message -> { + val bundle = Bundle() + bundle.putBoolean("forwardMessage", true) + getRouter().pushController( + RouterTransaction.with(ConversationsListController(bundle)).pushChangeHandler + (HorizontalChangeHandler()).popChangeHandler(HorizontalChangeHandler())) + true + } R.id.action_reply_to_message -> { val chatMessage = message as ChatMessage? replyToMessage(chatMessage, message?.jsonMessageId) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java index 673635ae4..90ca9a081 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java @@ -203,9 +203,12 @@ public class ConversationsListController extends BaseController implements Searc private String textToPaste = ""; - public ConversationsListController() { + private boolean forwardMessage = false; + + public ConversationsListController(Bundle bundle) { super(); setHasOptionsMenu(true); + forwardMessage = bundle.getBoolean("forwardMessage"); } @Override @@ -340,9 +343,13 @@ public class ConversationsListController extends BaseController implements Searc showShareToScreen = !shareToScreenWasShown && hasActivityActionSendIntent(); + if (showShareToScreen) { hideSearchBar(); getActionBar().setTitle(R.string.send_to_three_dots); + } else if (forwardMessage) { + hideSearchBar(); + getActionBar().setTitle(R.string.nc_forward_to_three_dots); } else { MainActivity activity = (MainActivity) getActivity(); @@ -752,6 +759,8 @@ public class ConversationsListController extends BaseController implements Searc if (showShareToScreen) { shareToScreenWasShown = true; handleSharedData(); + }else if (forwardMessage) { + forwardMessage(); } else { openConversation(); } @@ -759,6 +768,10 @@ public class ConversationsListController extends BaseController implements Searc return true; } + private void forwardMessage() { + System.out.println("Add code to forward a message here"); + } + private void handleSharedData() { collectDataFromIntent(); if (!textToPaste.isEmpty()) { diff --git a/app/src/main/res/menu/chat_message_menu.xml b/app/src/main/res/menu/chat_message_menu.xml index 02036213e..339705442 100644 --- a/app/src/main/res/menu/chat_message_menu.xml +++ b/app/src/main/res/menu/chat_message_menu.xml @@ -8,6 +8,12 @@ android:title="@string/nc_copy_message" app:showAsAction="always" /> + + Add to favorites Remove from favorites + Forward to … + Select participants Add participants @@ -357,6 +359,7 @@ Copy + Forward Reply Reply privately Delete