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()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
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()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
}
companion object {

View file

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

View file

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

View file

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

View file

@ -38,8 +38,7 @@ class ScopeDialog(
private val userInfoAdapter: ProfileController.UserInfoAdapter,
private val field: ProfileController.Field,
private val position: Int
) :
BottomSheetDialog(con) {
) : BottomSheetDialog(con) {
private lateinit var dialogScopeBinding: DialogScopeBinding
@ -79,6 +78,6 @@ class ScopeDialog(
super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
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.os.Bundle
import android.util.Log
import android.view.View
import android.view.ViewGroup
import androidx.annotation.NonNull
import androidx.recyclerview.widget.LinearLayoutManager
import autodagger.AutoInjector
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
@ -84,6 +86,13 @@ class ShowReactionsDialog(
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() {
adapter?.list?.clear()
if (chatMessage.reactions != null && chatMessage.reactions.isNotEmpty()) {

View file

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