From fde49c0694d837af06b54d5c7e658e8904814b0c Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Tue, 13 Apr 2021 22:57:13 +0200 Subject: [PATCH] add space to have whitespace between toolbar-avatar and title for conversation and conversation info screen Signed-off-by: Andy Scherzinger --- .../com/nextcloud/talk/controllers/ChatController.kt | 11 +++++++---- .../talk/controllers/ConversationInfoController.kt | 8 +++++++- .../com/nextcloud/talk/utils/bundle/BundleKeys.kt | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) 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 f66e1014b..b76f7eeee 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/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 "" diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt index d2cb185ad..c5678fe8c 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.kt +++ b/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() { diff --git a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt index 9a3be493b..9de10f25c 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt +++ b/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"