Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import one.mixin.android.extension.dayTime
import one.mixin.android.extension.dp
import one.mixin.android.extension.dpToPx
import one.mixin.android.extension.getClipboardManager
import one.mixin.android.extension.getSafeAreaInsetsBottom
import one.mixin.android.extension.localTime
import one.mixin.android.extension.navigationBarHeight
import one.mixin.android.extension.notNullWithElse
Expand Down Expand Up @@ -405,8 +406,9 @@ class GroupBottomSheetDialogFragment : MixinScrollableBottomSheetDialogFragment(
.let { layout ->
menuListLayout = layout
binding.scrollContent.addView(layout)
val safeBottomHeight = layout.getSafeAreaInsetsBottom()
layout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = requireContext().dpToPx(30f)
bottomMargin = safeBottomHeight
}
binding.moreFl.setOnClickListener {
if (behavior?.state == BottomSheetBehavior.STATE_COLLAPSED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsCompat.Type.systemBars
import androidx.core.view.doOnPreDraw
import androidx.core.view.updateLayoutParams
import androidx.core.view.updateMargins
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.internal.ViewUtils.doOnApplyWindowInsets
import one.mixin.android.R
import one.mixin.android.extension.booleanFromAttribute
import one.mixin.android.extension.getSafeAreaInsetsBottom
Expand Down Expand Up @@ -61,9 +62,10 @@ abstract class MixinComposeBottomSheetDialogFragment : SchemeBottomSheet() {

findViewById<View>(com.google.android.material.R.id.container)?.apply {
fitsSystemWindows = false
doOnApplyWindowInsets(this) { insetView, windowInsets, initialMargins ->
insetView.updateLayoutParams<ViewGroup.MarginLayoutParams> {
updateMargins(top = initialMargins.top + windowInsets.getInsets(systemBars()).top)
ViewCompat.setOnApplyWindowInsetsListener(this) { view, windowInsets ->
val insets = windowInsets.getInsets(systemBars())
view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
updateMargins(top = topMargin + insets.top)
}
windowInsets
}
Expand Down Expand Up @@ -96,7 +98,6 @@ abstract class MixinComposeBottomSheetDialogFragment : SchemeBottomSheet() {
behavior?.peekHeight = getBottomSheetHeight(view)
behavior?.isDraggable = false
behavior?.addBottomSheetCallback(internalBottomSheetBehaviorCallback)
view.setPadding(0, 0, 0, view.getSafeAreaInsetsBottom())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import one.mixin.android.extension.dpToPx
import one.mixin.android.extension.getClipboardManager
import one.mixin.android.extension.getOtherPath
import one.mixin.android.extension.getParcelableCompat
import one.mixin.android.extension.getSafeAreaInsetsBottom
import one.mixin.android.extension.localTime
import one.mixin.android.extension.navTo
import one.mixin.android.extension.navigationBarHeight
Expand Down Expand Up @@ -619,8 +620,9 @@ class UserBottomSheetDialogFragment : MixinScrollableBottomSheetDialogFragment()
list.createMenuLayout(requireContext()).let { layout ->
menuListLayout = layout
binding.scrollContent.addView(layout)
val safeBottomHeight = layout.getSafeAreaInsetsBottom()
layout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = requireContext().dpToPx(30f)
bottomMargin = safeBottomHeight
}
binding.moreFl.setOnClickListener {
if (behavior?.state == BottomSheetBehavior.STATE_COLLAPSED) {
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/one/mixin/android/ui/common/info/Menu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.util.TypedValue
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
Expand All @@ -15,13 +16,17 @@ import one.mixin.android.extension.colorAttr
import one.mixin.android.extension.colorFromAttribute
import one.mixin.android.extension.dp
import one.mixin.android.extension.dpToPx
import one.mixin.android.extension.getSafeAreaInsetsBottom
import one.mixin.android.extension.hasNavigationBar
import one.mixin.android.extension.navigationBarHeight
import one.mixin.android.extension.roundTopOrBottom
import one.mixin.android.extension.textColor
import one.mixin.android.session.Session
import one.mixin.android.vo.App
import one.mixin.android.vo.membershipIcon
import one.mixin.android.widget.FlowLayout
import one.mixin.android.widget.lottie.RLottieDrawable
import timber.log.Timber

@DslMarker
annotation class MenuDsl
Expand Down Expand Up @@ -110,7 +115,8 @@ fun MenuList.createMenuLayout(
val dp13 = context.dpToPx(13f)
val dp16 = context.dpToPx(16f)
val dp56 = context.dpToPx(56f)
groups.forEach { group ->

groups.forEachIndexed { groupIndex, group ->
val groupLayout =
LinearLayout(context).apply {
orientation = LinearLayout.VERTICAL
Expand Down Expand Up @@ -176,6 +182,7 @@ fun MenuList.createMenuLayout(
menuBinding.mixinMemberPlanIv.setImageResource(icon)
}
} else {
menuBinding.mixinMemberPlanTv.setTextColor(context.colorFromAttribute(R.attr.text_primary))
menuBinding.mixinMemberPlanIv.isVisible = false
menuBinding.mixinMemberPlanTv.isVisible = true
menuBinding.mixinMemberPlanIv.clearAnimation()
Expand Down Expand Up @@ -223,6 +230,7 @@ fun MenuList.createMenuLayout(
},
)
}

return listLayout
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.activity.result.PickVisualMediaRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.core.content.edit
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.lifecycleScope
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.uber.autodispose.autoDispose
Expand All @@ -41,6 +42,7 @@ import one.mixin.android.extension.dayTime
import one.mixin.android.extension.defaultSharedPreferences
import one.mixin.android.extension.getCapturedImage
import one.mixin.android.extension.getOtherPath
import one.mixin.android.extension.getSafeAreaInsetsBottom
import one.mixin.android.extension.inTransaction
import one.mixin.android.extension.navTo
import one.mixin.android.extension.openAsUrlOrWeb
Expand Down Expand Up @@ -174,8 +176,6 @@ class ProfileBottomSheetDialogFragment : MixinScrollableBottomSheetDialogFragmen
dismiss()
}

createdTv.text = getString(R.string.Joined_in, account.createdAt.dayTime())

bottomViewModel.loadFavoriteApps(account.userId)
bottomViewModel.observerFavoriteApps(account.userId)
.observe(this@ProfileBottomSheetDialogFragment) { apps ->
Expand Down Expand Up @@ -311,9 +311,15 @@ class ProfileBottomSheetDialogFragment : MixinScrollableBottomSheetDialogFragmen
}

menuListLayout?.removeAllViews()
list.createMenuLayout(requireContext()).let { layout ->
list.createMenuLayout(requireContext(),
getString(R.string.Joined_in, account.createdAt.dayTime())
).let { layout ->
menuListLayout = layout
binding.scrollContent.addView(layout, binding.scrollContent.childCount - 1)
binding.scrollContent.addView(layout)
val safeBottomHeight = layout.getSafeAreaInsetsBottom()
layout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = safeBottomHeight
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -241,8 +242,11 @@ fun WalletListScreen(
}
}

Column(modifier = Modifier
.fillMaxSize()) {
Column(
modifier = Modifier
.fillMaxSize()
.navigationBarsPadding()
) {
SearchBar(
query = query,
onQueryChanged = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
Expand Down Expand Up @@ -149,7 +150,11 @@ private fun WalletMultiSelectScreen(
wallets
}

Column(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier
.fillMaxSize()
.navigationBarsPadding()
) {
SearchBar(
query = query,
onQueryChanged = {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/one/mixin/android/ui/web/WebFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import one.mixin.android.extension.getClipboardManager
import one.mixin.android.extension.getOtherPath
import one.mixin.android.extension.getParcelableCompat
import one.mixin.android.extension.getPublicPicturePath
import one.mixin.android.extension.getSafeAreaInsetsBottom
import one.mixin.android.extension.indeterminateProgressDialog
import one.mixin.android.extension.isDarkColor
import one.mixin.android.extension.isExternalTransferUrl
Expand Down Expand Up @@ -1515,8 +1516,9 @@ class WebFragment : BaseFragment() {
}
list.createMenuLayout(requireContext()).let { layout ->
viewBinding.root.addView(layout)
val safeBottomHeight = layout.getSafeAreaInsetsBottom()
layout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = requireContext().dpToPx(30f)
bottomMargin = safeBottomHeight
}
}
bottomSheet.show()
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/res/layout/fragment_profile_bottom_sheet_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@
app:expandAction="@string/More"
app:expandActionColor="?attr/text_blue"/>

<TextView
android:id="@+id/created_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:layout_marginBottom="@dimen/margin16"
android:maxLines="1"
android:textSize="12sp"
android:textColor="?attr/text_assist"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
1 change: 1 addition & 0 deletions app/src/main/res/layout/layout_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/text_assist"
android:visibility="gone"/>

<TextView
Expand Down
Loading