File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
core/src/main/kotlin/com/melih/core/utils
features/list/src/main/res/layout Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,20 @@ import android.content.Context
4
4
import android.util.AttributeSet
5
5
import android.view.View
6
6
import androidx.coordinatorlayout.widget.CoordinatorLayout
7
- import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
8
7
import com.google.android.material.snackbar.Snackbar
9
8
9
+ /* *
10
+ * Simple behaviour for pushing views when snackbar is animating so none of views will remain under snackbar
11
+ */
10
12
class SnackbarBehaviour constructor(
11
13
context : Context ,
12
14
attributeSet : AttributeSet
13
- ) : CoordinatorLayout.Behavior<SwipeRefreshLayout >() {
15
+ ) : CoordinatorLayout.Behavior<View >() {
14
16
15
- override fun layoutDependsOn (parent : CoordinatorLayout , child : SwipeRefreshLayout , dependency : View ): Boolean =
17
+ override fun layoutDependsOn (parent : CoordinatorLayout , child : View , dependency : View ): Boolean =
16
18
dependency is Snackbar .SnackbarLayout
17
19
18
- override fun onDependentViewChanged (parent : CoordinatorLayout , child : SwipeRefreshLayout , dependency : View ): Boolean {
20
+ override fun onDependentViewChanged (parent : CoordinatorLayout , child : View , dependency : View ): Boolean {
19
21
val translationY = Math .min(0.0f , (dependency.translationY - dependency.height))
20
22
child.translationY = translationY
21
23
return true
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
- <layout xmlns : android =" http://schemas.android.com/apk/res/android"
2
+ <layout
3
+ xmlns : android =" http://schemas.android.com/apk/res/android"
3
4
xmlns : app =" http://schemas.android.com/apk/res-auto"
4
5
xmlns : tools =" http://schemas.android.com/tools" >
5
6
17
18
<androidx .swiperefreshlayout.widget.SwipeRefreshLayout
18
19
android : id =" @+id/swipeRefreshLayout"
19
20
android : layout_width =" match_parent"
20
- android : layout_height =" match_parent" >
21
+ android : layout_height =" match_parent"
22
+ app : layout_behavior =" com.melih.core.utils.SnackbarBehaviour" >
21
23
22
24
<androidx .recyclerview.widget.RecyclerView
23
25
android : id =" @+id/rocketList"
You can’t perform that action at this time.
0 commit comments