File tree Expand file tree Collapse file tree 5 files changed +42
-2
lines changed
customselector/ui/selector Expand file tree Collapse file tree 5 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,10 @@ import fr.free.nrw.commons.databinding.CustomSelectorBottomLayoutBinding
54
54
import fr.free.nrw.commons.databinding.CustomSelectorToolbarBinding
55
55
import fr.free.nrw.commons.media.ZoomableActivity
56
56
import fr.free.nrw.commons.theme.BaseActivity
57
- import fr.free.nrw.commons.utils.applyEdgeToEdgeAllInsets
58
57
import fr.free.nrw.commons.upload.FileUtilsWrapper
59
58
import fr.free.nrw.commons.utils.CustomSelectorUtils
59
+ import fr.free.nrw.commons.utils.applyEdgeToEdgeBottomPaddingInsets
60
+ import fr.free.nrw.commons.utils.applyEdgeToEdgeTopInsets
60
61
import kotlinx.coroutines.CoroutineDispatcher
61
62
import kotlinx.coroutines.CoroutineScope
62
63
import kotlinx.coroutines.Dispatchers
@@ -199,7 +200,8 @@ class CustomSelectorActivity :
199
200
.fillMaxWidth(),
200
201
)
201
202
}
202
- applyEdgeToEdgeAllInsets(binding.root)
203
+ applyEdgeToEdgeTopInsets(toolbarBinding.toolbarLayout)
204
+ bottomSheetBinding.bottomLayout.applyEdgeToEdgeBottomPaddingInsets()
203
205
val view = binding.root
204
206
setContentView(view)
205
207
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import fr.free.nrw.commons.databinding.FragmentCustomSelectorBinding
18
18
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment
19
19
import fr.free.nrw.commons.media.MediaClient
20
20
import fr.free.nrw.commons.upload.FileProcessor
21
+ import fr.free.nrw.commons.utils.applyEdgeToEdgeBottomPaddingInsets
21
22
import javax.inject.Inject
22
23
23
24
/* *
@@ -99,6 +100,7 @@ class FolderFragment : CommonsDaggerSupportFragment() {
99
100
selectorRV = binding?.selectorRv
100
101
loader = binding?.loader
101
102
with (binding?.selectorRv) {
103
+ this ?.applyEdgeToEdgeBottomPaddingInsets()
102
104
this ?.layoutManager = gridLayoutManager
103
105
this ?.setHasFixedSize(true )
104
106
this ?.adapter = folderAdapter
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ import fr.free.nrw.commons.media.MediaClient
41
41
import fr.free.nrw.commons.theme.BaseActivity
42
42
import fr.free.nrw.commons.upload.FileProcessor
43
43
import fr.free.nrw.commons.upload.FileUtilsWrapper
44
+ import fr.free.nrw.commons.utils.applyEdgeToEdgeBottomPaddingInsets
44
45
import io.reactivex.schedulers.Schedulers
45
46
import kotlinx.coroutines.flow.MutableStateFlow
46
47
import kotlinx.coroutines.flow.asStateFlow
@@ -217,6 +218,7 @@ class ImageFragment :
217
218
imageAdapter.setSingleSelection(singleSelection)
218
219
gridLayoutManager = GridLayoutManager (context, getSpanCount())
219
220
with (binding?.selectorRv) {
221
+ this ?.applyEdgeToEdgeBottomPaddingInsets()
220
222
this ?.layoutManager = gridLayoutManager
221
223
this ?.setHasFixedSize(true )
222
224
this ?.adapter = imageAdapter
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import androidx.core.view.marginLeft
9
9
import androidx.core.view.marginRight
10
10
import androidx.core.view.marginTop
11
11
import androidx.core.view.updateLayoutParams
12
+ import androidx.core.view.updatePadding
12
13
import fr.free.nrw.commons.R
13
14
14
15
fun View.applyEdgeToEdgeInsets (
@@ -65,6 +66,38 @@ fun View.applyEdgeToEdgeInsets(
65
66
}
66
67
}
67
68
69
+ fun View.applyEdgeToEdgeTopPaddingInsets (
70
+ typeMask : Int = WindowInsetsCompat .Type .systemBars(),
71
+ ) {
72
+ ViewCompat .setOnApplyWindowInsetsListener(this ) { view, windowInsets ->
73
+ val insets = windowInsets.getInsets(typeMask)
74
+
75
+ view.updatePadding(
76
+ left = insets.left,
77
+ right = insets.right,
78
+ top = insets.top
79
+ )
80
+
81
+ WindowInsetsCompat .CONSUMED
82
+ }
83
+ }
84
+
85
+ fun View.applyEdgeToEdgeBottomPaddingInsets (
86
+ typeMask : Int = WindowInsetsCompat .Type .systemBars(),
87
+ ) {
88
+ ViewCompat .setOnApplyWindowInsetsListener(this ) { view, windowInsets ->
89
+ val insets = windowInsets.getInsets(typeMask)
90
+
91
+ view.updatePadding(
92
+ left = insets.left,
93
+ right = insets.right,
94
+ bottom = insets.bottom
95
+ )
96
+
97
+ WindowInsetsCompat .CONSUMED
98
+ }
99
+ }
100
+
68
101
fun applyEdgeToEdgeAllInsets (view : View ) = view.applyEdgeToEdgeInsets { insets ->
69
102
leftMargin = insets.left
70
103
rightMargin = insets.right
Original file line number Diff line number Diff line change 34
34
app : layout_constraintEnd_toEndOf =" parent"
35
35
app : layout_constraintStart_toStartOf =" parent"
36
36
app : layout_constraintTop_toBottomOf =" @id/switchWidget"
37
+ android : clipToPadding =" false"
37
38
/>
38
39
39
40
<TextView
You can’t perform that action at this time.
0 commit comments