mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 23:25:20 +03:00
Allow only forwarding of regualr text messages
Also go back directly to the conversation list. Go back history is reseted. Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
b3d0ebf577
commit
00915e56ff
2 changed files with 10 additions and 6 deletions
|
@ -95,6 +95,7 @@ import com.facebook.imagepipeline.image.CloseableImage
|
|||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.MagicCallActivity
|
||||
import com.nextcloud.talk.activities.MainActivity
|
||||
import com.nextcloud.talk.adapters.messages.IncomingLocationMessageViewHolder
|
||||
import com.nextcloud.talk.adapters.messages.IncomingPreviewMessageViewHolder
|
||||
import com.nextcloud.talk.adapters.messages.IncomingVoiceMessageViewHolder
|
||||
|
@ -2061,7 +2062,7 @@ class ChatController(args: Bundle) :
|
|||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
router.popCurrentController()
|
||||
(activity as MainActivity).resetConversationsList()
|
||||
return true
|
||||
}
|
||||
R.id.conversation_video_call -> {
|
||||
|
@ -2168,6 +2169,7 @@ class ChatController(args: Bundle) :
|
|||
R.id.action_forward_message -> {
|
||||
val bundle = Bundle()
|
||||
bundle.putBoolean("forwardMessage", true)
|
||||
bundle.putString("forwardMessageText", message?.text)
|
||||
getRouter().pushController(
|
||||
RouterTransaction.with(ConversationsListController(bundle)).pushChangeHandler
|
||||
(HorizontalChangeHandler()).popChangeHandler(HorizontalChangeHandler()))
|
||||
|
@ -2311,6 +2313,10 @@ class ChatController(args: Bundle) :
|
|||
(message as ChatMessage).user.id.substring(6) != currentConversation?.actorId &&
|
||||
currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||
menu.findItem(R.id.action_delete_message).isVisible = isShowMessageDeletionButton(message)
|
||||
menu.findItem(R.id.action_forward_message).isVisible = ChatMessage.MessageType.REGULAR_TEXT_MESSAGE.equals(
|
||||
(message as ChatMessage)
|
||||
.getMessageType()
|
||||
)
|
||||
if (menu.hasVisibleItems()) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
|
||||
setForceShowIcon(true)
|
||||
|
|
|
@ -139,6 +139,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
public static final String TAG = "ConvListController";
|
||||
public static final int ID_DELETE_CONVERSATION_DIALOG = 0;
|
||||
private static final String KEY_SEARCH_QUERY = "ContactsController.searchQuery";
|
||||
private final Bundle bundle;
|
||||
@Inject
|
||||
UserUtils userUtils;
|
||||
|
||||
|
@ -209,6 +210,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
super();
|
||||
setHasOptionsMenu(true);
|
||||
forwardMessage = bundle.getBoolean("forwardMessage");
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -760,7 +762,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
shareToScreenWasShown = true;
|
||||
handleSharedData();
|
||||
}else if (forwardMessage) {
|
||||
forwardMessage();
|
||||
openConversation(bundle.getString("forwardMessageText"));
|
||||
} else {
|
||||
openConversation();
|
||||
}
|
||||
|
@ -768,10 +770,6 @@ 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()) {
|
||||
|
|
Loading…
Reference in a new issue