Skip to content

Commit 81d4f58

Browse files
adalpariclaude
andcommitted
Add bottom margin to card text and fix bottom sheet landscape visibility
- Add bottom margin to card text when Learn more is hidden - Wrap bottom sheet content in ScrollView for landscape scrolling - Expand bottom sheet to STATE_EXPANDED on show Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent b493d58 commit 81d4f58

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/xmlrpcdisabled/XmlRpcDisabledBottomSheetFragment.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import android.os.Bundle
44
import android.view.LayoutInflater
55
import android.view.View
66
import android.view.ViewGroup
7+
import android.widget.FrameLayout
8+
import com.google.android.material.bottomsheet.BottomSheetBehavior
9+
import com.google.android.material.bottomsheet.BottomSheetDialog
710
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
811
import dagger.hilt.android.AndroidEntryPoint
12+
import com.google.android.material.R as MaterialR
913
import org.wordpress.android.databinding.XmlrpcDisabledBottomSheetBinding
1014
import org.wordpress.android.fluxc.model.SiteModel
1115
import org.wordpress.android.fluxc.store.AccountStore
@@ -37,6 +41,17 @@ class XmlRpcDisabledBottomSheetFragment : BottomSheetDialogFragment() {
3741

3842
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
3943
super.onViewCreated(view, savedInstanceState)
44+
dialog?.setOnShowListener { dialogInterface ->
45+
val bottomSheet =
46+
(dialogInterface as? BottomSheetDialog)
47+
?.findViewById<View>(
48+
MaterialR.id.design_bottom_sheet
49+
) as? FrameLayout
50+
bottomSheet?.let {
51+
BottomSheetBehavior.from(it).state =
52+
BottomSheetBehavior.STATE_EXPANDED
53+
}
54+
}
4055
val binding = XmlrpcDisabledBottomSheetBinding.bind(view)
4156
val siteLocalId = arguments?.getInt(ARG_SITE_LOCAL_ID) ?: run {
4257
dismiss()

WordPress/src/main/java/org/wordpress/android/ui/mysite/items/singleactioncard/SingleActionCardViewHolder.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ class SingleActionCardViewHolder(
2929
} else {
3030
View.GONE
3131
}
32+
val textParams = singleActionCardText.layoutParams
33+
as ConstraintLayout.LayoutParams
34+
if (!singleActionCard.showLearnMore) {
35+
textParams.bottomToBottom =
36+
ConstraintLayout.LayoutParams.PARENT_ID
37+
textParams.bottomMargin = context.resources
38+
.getDimensionPixelSize(
39+
org.wordpress.android.R.dimen.margin_extra_large
40+
)
41+
}
42+
singleActionCardText.layoutParams = textParams
3243
val params = singleActionCardImage.layoutParams
3344
as ConstraintLayout.LayoutParams
3445
if (singleActionCard.centerImageVertically) {

WordPress/src/main/res/layout/xmlrpc_disabled_bottom_sheet.xml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="wrap_content"
5-
android:orientation="vertical">
4+
android:layout_height="wrap_content">
65

7-
<include
8-
android:id="@+id/handle"
9-
layout="@layout/bottom_sheet_handle_view"
6+
<LinearLayout
107
android:layout_width="match_parent"
118
android:layout_height="wrap_content"
12-
android:layout_marginBottom="@dimen/margin_small" />
9+
android:orientation="vertical">
1310

14-
<ImageView
11+
<include
12+
android:id="@+id/handle"
13+
layout="@layout/bottom_sheet_handle_view"
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:layout_marginBottom="@dimen/margin_small" />
17+
18+
<ImageView
1519
android:layout_width="40dp"
1620
android:layout_height="40dp"
1721
android:layout_gravity="center"
@@ -59,4 +63,6 @@
5963
android:textColor="?attr/colorPrimary"
6064
android:textSize="@dimen/text_sz_large" />
6165

62-
</LinearLayout>
66+
</LinearLayout>
67+
68+
</ScrollView>

0 commit comments

Comments
 (0)