Sfoglia il codice sorgente

add space to have whitespace between toolbar-avatar and title for conversation and conversation info screen

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 anni fa
parent
commit
fde49c0694

+ 7 - 4
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -333,9 +333,7 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
     }
 
     private fun loadAvatarForStatusBar() {
-        if (currentConversation != null && currentConversation?.type != null &&
-                currentConversation?.type == Conversation.ConversationType
-                        .ROOM_TYPE_ONE_TO_ONE_CALL && activity != null && conversationVoiceCallMenuItem != null) {
+        if (inOneToOneCall() && activity != null && conversationVoiceCallMenuItem != null) {
             val avatarSize = DisplayUtils.convertDpToPixel(conversationVoiceCallMenuItem?.icon!!
                     .intrinsicWidth.toFloat(), activity).toInt()
 
@@ -360,6 +358,10 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
         }
     }
 
+    private fun inOneToOneCall() = currentConversation != null && currentConversation?.type != null &&
+            currentConversation?.type == Conversation.ConversationType
+            .ROOM_TYPE_ONE_TO_ONE_CALL
+
     override fun onViewBound(view: View) {
         actionBar?.show()
         var adapterWasNull = false
@@ -677,6 +679,7 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
         val bundle = Bundle()
         bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, conversationUser)
         bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken)
+        bundle.putBoolean(BundleKeys.KEY_ROOM_ONE_TO_ONE, inOneToOneCall());
         router.pushController(RouterTransaction.with(ConversationInfoController(bundle))
                 .pushChangeHandler(HorizontalChangeHandler())
                 .popChangeHandler(HorizontalChangeHandler()))
@@ -784,7 +787,7 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
 
     override fun getTitle(): String {
         currentConversation?.displayName?.let {
-            return EmojiCompat.get().process(it as CharSequence).toString()
+            return " " + EmojiCompat.get().process(it as CharSequence).toString()
         }
 
         return ""

+ 7 - 1
app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt

@@ -134,6 +134,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
 
     private val conversationToken: String?
     private val conversationUser: UserEntity?
+    private val hasAvatarSpacing: Boolean
     private val credentials: String?
     private var roomDisposable: Disposable? = null
     private var participantsDisposable: Disposable? = null
@@ -163,6 +164,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
         NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
         conversationUser = args.getParcelable(BundleKeys.KEY_USER_ENTITY)
         conversationToken = args.getString(BundleKeys.KEY_ROOM_TOKEN)
+        hasAvatarSpacing = args.getBoolean(BundleKeys.KEY_ROOM_ONE_TO_ONE, false);
         credentials = ApiUtils.getCredentials(conversationUser!!.username, conversationUser.token)
     }
 
@@ -386,7 +388,11 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
     }
 
     override fun getTitle(): String? {
-        return resources!!.getString(R.string.nc_conversation_menu_conversation_info)
+        return if (hasAvatarSpacing) {
+            " " + resources!!.getString(R.string.nc_conversation_menu_conversation_info)
+        } else {
+            resources!!.getString(R.string.nc_conversation_menu_conversation_info)
+        }
     }
 
     private fun getListOfParticipants() {

+ 1 - 0
app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt

@@ -36,6 +36,7 @@ object BundleKeys {
     val KEY_APP_ITEM_NAME = "KEY_APP_ITEM_NAME"
     val KEY_CONVERSATION_PASSWORD = "KEY_CONVERSATION_PASSWORD"
     val KEY_ROOM_TOKEN = "KEY_ROOM_TOKEN"
+    val KEY_ROOM_ONE_TO_ONE = "KEY_ROOM_ONE_TO_ONE"
     val KEY_USER_ENTITY = "KEY_USER_ENTITY"
     val KEY_NEW_CONVERSATION = "KEY_NEW_CONVERSATION"
     val KEY_ADD_PARTICIPANTS = "KEY_ADD_PARTICIPANTS"