Skip to content

Commit 1c0f80d

Browse files
committed
- fix insets
1 parent 63925dc commit 1c0f80d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

materialdrawer/src/main/java/com/mikepenz/materialdrawer/widget/MaterialDrawerSliderView.kt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import android.os.Handler
1010
import android.util.AttributeSet
1111
import android.view.LayoutInflater
1212
import android.view.View
13-
import android.view.View.OnClickListener
1413
import android.view.ViewGroup
1514
import android.widget.LinearLayout
1615
import android.widget.RelativeLayout
@@ -45,7 +44,8 @@ import com.mikepenz.materialdrawer.util.*
4544
* This view is a simple drop in view for the [DrawerLayout] offering a convenient API to provide a nice and flexible slider view following
4645
* the material design guidelines v2.
4746
*/
48-
open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.materialDrawerStyle) : RelativeLayout(context, attrs, defStyleAttr) {
47+
open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.materialDrawerStyle) :
48+
RelativeLayout(context, attrs, defStyleAttr) {
4949

5050
/** Temporarily disable invalidation for optimizations */
5151
private var invalidationEnabled: Boolean = true
@@ -412,9 +412,11 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
412412
if (stickyHeaderView == null) {
413413
recyclerView.updatePadding(top = insets.systemWindowInsetTop + context.resources.getDimensionPixelSize(R.dimen.material_drawer_padding_top_bottom))
414414
}
415-
if (stickyFooterView == null) {
416-
recyclerView.updatePadding(bottom = insets.systemWindowInsetBottom + context.resources.getDimensionPixelSize(R.dimen.material_drawer_padding_top_bottom))
417-
}
415+
}
416+
if (stickyFooterView == null) {
417+
recyclerView.updatePadding(bottom = insets.systemWindowInsetBottom + context.resources.getDimensionPixelSize(R.dimen.material_drawer_padding_top_bottom))
418+
} else {
419+
stickyFooterView?.updatePadding(bottom = insets.systemWindowInsetBottom + context.resources.getDimensionPixelSize(R.dimen.material_drawer_padding_top_bottom))
418420
}
419421

420422
setWillNotDraw(insetForeground == null)
@@ -559,8 +561,8 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
559561
recyclerView.layoutManager = layoutManager
560562

561563
val params = LinearLayout.LayoutParams(
562-
ViewGroup.LayoutParams.MATCH_PARENT,
563-
ViewGroup.LayoutParams.MATCH_PARENT
564+
ViewGroup.LayoutParams.MATCH_PARENT,
565+
ViewGroup.LayoutParams.MATCH_PARENT
564566
)
565567
params.weight = 1f
566568

@@ -700,7 +702,12 @@ open class MaterialDrawerSliderView @JvmOverloads constructor(context: Context,
700702
/**
701703
* method to switch the drawer content to new elements
702704
*/
703-
fun switchDrawerContent(onDrawerItemClickListenerInner: ((v: View?, item: IDrawerItem<*>, position: Int) -> Boolean)?, onDrawerItemLongClickListenerInner: ((v: View?, item: IDrawerItem<*>, position: Int) -> Boolean)?, drawerItemsInner: List<IDrawerItem<*>>, drawerSelection: Int) {
705+
fun switchDrawerContent(
706+
onDrawerItemClickListenerInner: ((v: View?, item: IDrawerItem<*>, position: Int) -> Boolean)?,
707+
onDrawerItemLongClickListenerInner: ((v: View?, item: IDrawerItem<*>, position: Int) -> Boolean)?,
708+
drawerItemsInner: List<IDrawerItem<*>>,
709+
drawerSelection: Int,
710+
) {
704711
//just allow a single switched drawer
705712
if (!switchedDrawerContent()) {
706713
//save out previous values

0 commit comments

Comments
 (0)