Merge pull request #1120 from nextcloud/avatarTitleWhitespace

Add space between avatar and title in toolbar
This commit is contained in:
Marcel Hibbe 2021-04-14 09:25:57 +02:00 committed by GitHub
commit 22581628bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 5 deletions

View File

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

View File

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

View File

@ -36,6 +36,7 @@ object BundleKeys {
val KEY_APP_ITEM_NAME = "KEY_APP_ITEM_NAME" val KEY_APP_ITEM_NAME = "KEY_APP_ITEM_NAME"
val KEY_CONVERSATION_PASSWORD = "KEY_CONVERSATION_PASSWORD" val KEY_CONVERSATION_PASSWORD = "KEY_CONVERSATION_PASSWORD"
val KEY_ROOM_TOKEN = "KEY_ROOM_TOKEN" 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_USER_ENTITY = "KEY_USER_ENTITY"
val KEY_NEW_CONVERSATION = "KEY_NEW_CONVERSATION" val KEY_NEW_CONVERSATION = "KEY_NEW_CONVERSATION"
val KEY_ADD_PARTICIPANTS = "KEY_ADD_PARTICIPANTS" val KEY_ADD_PARTICIPANTS = "KEY_ADD_PARTICIPANTS"