Эх сурвалжийг харах

Fix #361

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 жил өмнө
parent
commit
0614ba8178

+ 17 - 15
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -442,6 +442,18 @@ public class ChatController extends BaseController implements MessagesListAdapte
         messageInputView.getButton().setContentDescription(getResources()
                 .getString(R.string.nc_description_send_message_button));
 
+        if (conversationUser.hasSpreedCapabilityWithName("mention-flag") && getActivity() != null) {
+            getActivity().findViewById(R.id.toolbar).setOnClickListener(v -> {
+                Bundle bundle = new Bundle();
+                bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(conversationUser));
+                bundle.putString(BundleKeys.KEY_BASE_URL, baseUrl);
+                bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken);
+                getRouter().pushController((RouterTransaction.with(new ConversationInfoController(bundle))
+                        .pushChangeHandler(new VerticalChangeHandler())
+                        .popChangeHandler(new VerticalChangeHandler())));
+            });
+        }
+
         if (adapterWasNull) {
             // we're starting
             if (TextUtils.isEmpty(roomToken)) {
@@ -516,6 +528,11 @@ public class ChatController extends BaseController implements MessagesListAdapte
     @Override
     public void onDestroy() {
         super.onDestroy();
+
+        if (getActivity() != null) {
+            getActivity().findViewById(R.id.toolbar).setOnClickListener(null);
+        }
+
         adapter = null;
         inChat = false;
         ApplicationWideCurrentRoomHolder.getInstance().clear();
@@ -974,12 +991,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
         inflater.inflate(R.menu.menu_conversation, menu);
-
-        if (conversationUser.hasSpreedCapabilityWithName("mention-flag")) {
-            menu.findItem(R.id.nc_conversation_info).setVisible(true);
-        } else {
-            menu.findItem(R.id.nc_conversation_info).setVisible(false);
-        }
     }
 
 
@@ -995,15 +1006,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
             case R.id.conversation_voice_call:
                 startACall(true);
                 return true;
-            case R.id.nc_conversation_info:
-                Bundle bundle = new Bundle();
-                bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(conversationUser));
-                bundle.putString(BundleKeys.KEY_BASE_URL, baseUrl);
-                bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken);
-                getRouter().pushController((RouterTransaction.with(new ConversationInfoController(bundle))
-                        .pushChangeHandler(new VerticalChangeHandler())
-                        .popChangeHandler(new VerticalChangeHandler())));
-                return true;
             default:
                 return super.onOptionsItemSelected(item);
         }

+ 0 - 25
app/src/main/res/drawable/ic_info_black_24dp.xml

@@ -1,25 +0,0 @@
-<!--
-  ~ Nextcloud Talk application
-  ~
-  ~ @author Mario Danic
-  ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
-  ~
-  ~ This program is free software: you can redistribute it and/or modify
-  ~ it under the terms of the GNU General Public License as published by
-  ~ the Free Software Foundation, either version 3 of the License, or
-  ~ at your option) any later version.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
-  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  ~ GNU General Public License for more details.
-  ~
-  ~ You should have received a copy of the GNU General Public License
-  ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
-  -->
-
-<vector android:autoMirrored="true" android:height="24dp"
-    android:tint="#FFFFFF" android:viewportHeight="24.0"
-    android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
-</vector>

+ 0 - 8
app/src/main/res/menu/menu_conversation.xml

@@ -34,12 +34,4 @@
         android:orderInCategory="1"
         android:title="@string/nc_conversation_menu_video_call"
         app:showAsAction="ifRoom|withText" />
-
-    <item
-        android:id="@+id/nc_conversation_info"
-        android:icon="@drawable/ic_info_black_24dp"
-        android:orderInCategory="2"
-        android:title="@string/nc_conversation_menu_conversation_info"
-        android:visible="false"
-        app:showAsAction="ifRoom|withText" />
 </menu>

+ 0 - 1
app/src/main/res/values/strings.xml

@@ -215,7 +215,6 @@ Find Nextcloud on https://nextcloud.com</string>
     <string name="nc_date_header_today">Today</string>
     <string name="nc_conversation_menu_voice_call">Voice call</string>
     <string name="nc_conversation_menu_video_call">Video call</string>
-    <string name="nc_conversation_menu_conversation_info">Conversation info</string>
     <string name="nc_new_messages">New messages</string>
     <string name="nc_no_messages_yet">No messages yet</string>
     <string name="nc_chat_you">You</string>