Skip to content

Commit 729ede5

Browse files
authored
Fix scroll issue on bottom dialogs and add drag handle to UI (#2333)
1 parent e97645c commit 729ede5

File tree

2 files changed

+52
-40
lines changed

2 files changed

+52
-40
lines changed

app/src/main/java/com/lagradost/cloudstream3/utils/SingleSelectionHelper.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.lagradost.cloudstream3.databinding.BottomSelectionDialogBinding
2222
import com.lagradost.cloudstream3.databinding.BottomTextDialogBinding
2323
import com.lagradost.cloudstream3.databinding.OptionsPopupTvBinding
2424
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
25+
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
2526
import com.lagradost.cloudstream3.ui.settings.Globals.TV
2627
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
2728
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
@@ -113,8 +114,12 @@ object SingleSelectionHelper {
113114
val textView = binding.text1
114115
val applyButton = binding.applyBtt
115116
val cancelButton = binding.cancelBtt
116-
val applyHolder =
117-
binding.applyBttHolder
117+
val applyHolder = binding.applyBttHolder
118+
119+
if (isLayout(PHONE or EMULATOR) && dialog is BottomSheetDialog) {
120+
binding.dragHandle.isVisible = true
121+
listView.isNestedScrollingEnabled = true
122+
}
118123

119124
applyHolder.isVisible = realShowApply
120125
if (!realShowApply) {
Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,65 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
android:orientation="vertical"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:orientation="vertical">
7+
8+
<FrameLayout
59
android:layout_width="match_parent"
6-
android:layout_height="match_parent">
10+
android:layout_height="wrap_content"
11+
android:layout_marginBottom="10dp">
12+
13+
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
14+
android:id="@+id/drag_handle"
15+
android:layout_width="match_parent"
16+
android:layout_height="wrap_content"
17+
android:visibility="gone" />
718

8-
<TextView
19+
<TextView
920
android:id="@+id/text1"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_marginTop="30dp"
1024
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
1125
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
12-
android:layout_marginTop="20dp"
13-
android:layout_marginBottom="10dp"
1426
android:textStyle="bold"
1527
android:textSize="20sp"
1628
android:textColor="?attr/textColor"
17-
android:layout_width="match_parent"
18-
android:layout_rowWeight="1"
19-
tools:text="Test"
20-
android:layout_height="wrap_content" />
29+
tools:text="Test" />
30+
</FrameLayout>
2131

2232
<ListView
23-
android:nextFocusRight="@id/cancel_btt"
24-
android:nextFocusLeft="@id/apply_btt"
25-
android:dividerHeight="1dp"
26-
android:id="@+id/listview1"
27-
android:layout_marginBottom="60dp"
28-
android:paddingTop="10dp"
29-
android:requiresFadingEdge="vertical"
30-
tools:listitem="@layout/sort_bottom_single_choice"
31-
android:layout_width="match_parent"
32-
android:layout_height="match_parent"
33-
android:layout_rowWeight="1" />
33+
android:id="@+id/listview1"
34+
android:layout_width="match_parent"
35+
android:layout_height="0dp"
36+
android:layout_weight="1"
37+
android:paddingTop="10dp"
38+
android:dividerHeight="1dp"
39+
android:requiresFadingEdge="vertical"
40+
android:nextFocusRight="@id/cancel_btt"
41+
android:nextFocusLeft="@id/apply_btt"
42+
tools:listitem="@layout/sort_bottom_single_choice" />
3443

3544
<LinearLayout
36-
android:id="@+id/apply_btt_holder"
37-
android:orientation="horizontal"
38-
android:layout_gravity="bottom"
39-
android:gravity="bottom|end"
40-
android:layout_marginTop="-60dp"
41-
android:layout_width="match_parent"
42-
android:layout_height="60dp">
45+
android:id="@+id/apply_btt_holder"
46+
android:layout_width="match_parent"
47+
android:layout_height="60dp"
48+
android:gravity="center_vertical|end"
49+
android:orientation="horizontal">
4350

4451
<com.google.android.material.button.MaterialButton
45-
style="@style/WhiteButton"
46-
android:layout_gravity="center_vertical|end"
47-
android:text="@string/sort_apply"
48-
android:id="@+id/apply_btt"
49-
android:layout_width="wrap_content" />
52+
android:id="@+id/apply_btt"
53+
android:layout_width="wrap_content"
54+
android:layout_gravity="center_vertical|end"
55+
android:text="@string/sort_apply"
56+
style="@style/WhiteButton" />
5057

5158
<com.google.android.material.button.MaterialButton
52-
style="@style/BlackButton"
53-
android:layout_gravity="center_vertical|end"
54-
android:text="@string/sort_cancel"
55-
android:id="@+id/cancel_btt"
56-
android:layout_width="wrap_content" />
59+
android:id="@+id/cancel_btt"
60+
android:layout_width="wrap_content"
61+
android:layout_gravity="center_vertical|end"
62+
android:text="@string/sort_cancel"
63+
style="@style/BlackButton" />
5764
</LinearLayout>
5865
</LinearLayout>

0 commit comments

Comments
 (0)