make bottom_sheets initial state collapsed for the rounded top corners

Resolves #2035

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-05-13 12:42:44 +02:00
parent 1b1a863832
commit c7ac8a3074
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
8 changed files with 26 additions and 15 deletions

View File

@ -90,6 +90,6 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
super.onStart() super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet) val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View) val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
} }

View File

@ -158,7 +158,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
super.onStart() super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet) val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View) val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
companion object { companion object {

View File

@ -40,7 +40,7 @@ import com.nextcloud.talk.databinding.DialogBottomContactsBinding
class ContactsBottomDialog( class ContactsBottomDialog(
val activity: Activity, val activity: Activity,
val bundle: Bundle val bundle: Bundle
) : BottomSheetDialog(activity, R.style.BottomSheetDialogThemeNoFloating) { ) : BottomSheetDialog(activity) {
private var dialogRouter: Router? = null private var dialogRouter: Router? = null
@ -73,7 +73,7 @@ class ContactsBottomDialog(
super.onStart() super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet) val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View) val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
companion object { companion object {

View File

@ -72,7 +72,7 @@ class ConversationsListBottomDialog(
val controller: ConversationsListController, val controller: ConversationsListController,
val currentUser: UserEntity, val currentUser: UserEntity,
val conversation: Conversation val conversation: Conversation
) : BottomSheetDialog(activity, R.style.BottomSheetDialogThemeNoFloating) { ) : BottomSheetDialog(activity) {
private var dialogRouter: Router? = null private var dialogRouter: Router? = null
@ -309,7 +309,7 @@ class ConversationsListBottomDialog(
super.onStart() super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet) val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View) val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
companion object { companion object {

View File

@ -60,7 +60,7 @@ class MessageActionsDialog(
private val showMessageDeletionButton: Boolean, private val showMessageDeletionButton: Boolean,
private val hasChatPermission: Boolean, private val hasChatPermission: Boolean,
private val ncApi: NcApi private val ncApi: NcApi
) : BottomSheetDialog(chatController.activity!!, R.style.BottomSheetDialogThemeNoFloating) { ) : BottomSheetDialog(chatController.activity!!) {
private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding
@ -97,7 +97,7 @@ class MessageActionsDialog(
super.onStart() super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet) val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View) val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
private fun hasUserId(user: UserEntity?): Boolean { private fun hasUserId(user: UserEntity?): Boolean {

View File

@ -38,8 +38,7 @@ class ScopeDialog(
private val userInfoAdapter: ProfileController.UserInfoAdapter, private val userInfoAdapter: ProfileController.UserInfoAdapter,
private val field: ProfileController.Field, private val field: ProfileController.Field,
private val position: Int private val position: Int
) : ) : BottomSheetDialog(con) {
BottomSheetDialog(con) {
private lateinit var dialogScopeBinding: DialogScopeBinding private lateinit var dialogScopeBinding: DialogScopeBinding
@ -79,6 +78,6 @@ class ScopeDialog(
super.onStart() super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet) val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View) val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_COLLAPSED
} }
} }

View File

@ -29,10 +29,12 @@ package com.nextcloud.talk.ui.dialog
import android.app.Activity import android.app.Activity
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.NonNull import androidx.annotation.NonNull
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import autodagger.AutoInjector import autodagger.AutoInjector
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
@ -84,6 +86,13 @@ class ShowReactionsDialog(
initEmojiReactions() initEmojiReactions()
} }
override fun onStart() {
super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
}
private fun initEmojiReactions() { private fun initEmojiReactions() {
adapter?.list?.clear() adapter?.list?.clear()
if (chatMessage.reactions != null && chatMessage.reactions.isNotEmpty()) { if (chatMessage.reactions != null && chatMessage.reactions.isNotEmpty()) {

View File

@ -62,6 +62,7 @@
<style name="Talk.BottomSheetDialog" parent="Widget.MaterialComponents.BottomSheet.Modal"> <style name="Talk.BottomSheetDialog" parent="Widget.MaterialComponents.BottomSheet.Modal">
<item name="backgroundTint">@color/bg_bottom_sheet</item> <item name="backgroundTint">@color/bg_bottom_sheet</item>
<item name="shapeAppearanceOverlay">@style/CustomShapeAppearanceBottomSheetDialog</item>
</style> </style>
<style name="TransparentTheme" parent="Theme.MaterialComponents.NoActionBar.Bridge"> <style name="TransparentTheme" parent="Theme.MaterialComponents.NoActionBar.Bridge">
@ -244,9 +245,12 @@
<item name="android:colorControlNormal">#ffffff</item> <item name="android:colorControlNormal">#ffffff</item>
</style> </style>
<style name="BottomSheetDialogThemeNoFloating" parent="ThemeOverlay.MaterialComponents.DayNight.BottomSheetDialog"> <style name="CustomShapeAppearanceBottomSheetDialog" parent="">
<item name="android:windowIsFloating">false</item> <item name="cornerFamily">rounded</item>
<item name="android:windowSoftInputMode">adjustResize</item> <item name="cornerSizeTopRight">16dp</item>
<item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
</style> </style>
<style name="OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton"> <style name="OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton">
@ -262,5 +266,4 @@
<item name="android:textAllCaps">false</item> <item name="android:textAllCaps">false</item>
</style> </style>
</resources> </resources>