mirror of
https://github.com/kuba2k2/NavLib.git
synced 2024-11-13 21:20:26 -06:00
Fix for items not showing selection background. Inline some extensions. Update gradle.
This commit is contained in:
parent
9c8fb47c52
commit
9002237a02
@ -5,7 +5,7 @@ import com.mikepenz.materialdrawer.*
|
|||||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
|
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
|
||||||
import com.mikepenz.materialdrawer.model.interfaces.IProfile
|
import com.mikepenz.materialdrawer.model.interfaces.IProfile
|
||||||
|
|
||||||
fun DrawerBuilder.withOnDrawerItemClickListener(listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
|
inline fun DrawerBuilder.withOnDrawerItemClickListener(crossinline listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
|
||||||
return this.withOnDrawerItemClickListener(object : Drawer.OnDrawerItemClickListener {
|
return this.withOnDrawerItemClickListener(object : Drawer.OnDrawerItemClickListener {
|
||||||
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>): Boolean {
|
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>): Boolean {
|
||||||
return listener(view, position, drawerItem)
|
return listener(view, position, drawerItem)
|
||||||
@ -13,7 +13,7 @@ fun DrawerBuilder.withOnDrawerItemClickListener(listener: (view: View?, position
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun DrawerBuilder.withOnDrawerItemLongClickListener(listener: (view: View, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
|
inline fun DrawerBuilder.withOnDrawerItemLongClickListener(crossinline listener: (view: View, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
|
||||||
return this.withOnDrawerItemLongClickListener(object : Drawer.OnDrawerItemLongClickListener {
|
return this.withOnDrawerItemLongClickListener(object : Drawer.OnDrawerItemLongClickListener {
|
||||||
override fun onItemLongClick(view: View, position: Int, drawerItem: IDrawerItem<*>): Boolean {
|
override fun onItemLongClick(view: View, position: Int, drawerItem: IDrawerItem<*>): Boolean {
|
||||||
return listener(view, position, drawerItem)
|
return listener(view, position, drawerItem)
|
||||||
@ -21,7 +21,7 @@ fun DrawerBuilder.withOnDrawerItemLongClickListener(listener: (view: View, posit
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AccountHeaderBuilder.withOnAccountHeaderListener(listener: (view: View?, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
|
inline fun AccountHeaderBuilder.withOnAccountHeaderListener(crossinline listener: (view: View?, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
|
||||||
return this.withOnAccountHeaderListener(object : AccountHeader.OnAccountHeaderListener {
|
return this.withOnAccountHeaderListener(object : AccountHeader.OnAccountHeaderListener {
|
||||||
override fun onProfileChanged(view: View?, profile: IProfile<*>, current: Boolean): Boolean {
|
override fun onProfileChanged(view: View?, profile: IProfile<*>, current: Boolean): Boolean {
|
||||||
return listener(view, profile, current)
|
return listener(view, profile, current)
|
||||||
@ -29,7 +29,7 @@ fun AccountHeaderBuilder.withOnAccountHeaderListener(listener: (view: View?, pro
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AccountHeaderBuilder.withOnAccountHeaderItemLongClickListener(listener: (view: View, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
|
inline fun AccountHeaderBuilder.withOnAccountHeaderItemLongClickListener(crossinline listener: (view: View, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
|
||||||
return this.withOnAccountHeaderItemLongClickListener(object : AccountHeader.OnAccountHeaderItemLongClickListener {
|
return this.withOnAccountHeaderItemLongClickListener(object : AccountHeader.OnAccountHeaderItemLongClickListener {
|
||||||
override fun onProfileLongClick(view: View, profile: IProfile<*>, current: Boolean): Boolean {
|
override fun onProfileLongClick(view: View, profile: IProfile<*>, current: Boolean): Boolean {
|
||||||
return listener(view, profile, current)
|
return listener(view, profile, current)
|
||||||
@ -37,13 +37,13 @@ fun AccountHeaderBuilder.withOnAccountHeaderItemLongClickListener(listener: (vie
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AccountHeaderBuilder.withOnAccountHeaderProfileImageListener(
|
inline fun AccountHeaderBuilder.withOnAccountHeaderProfileImageListener(
|
||||||
onClick: (
|
crossinline onClick: (
|
||||||
view: View,
|
view: View,
|
||||||
profile: IProfile<*>,
|
profile: IProfile<*>,
|
||||||
current: Boolean
|
current: Boolean
|
||||||
) -> Boolean,
|
) -> Boolean,
|
||||||
onLongClick: (
|
crossinline onLongClick: (
|
||||||
view: View,
|
view: View,
|
||||||
profile: IProfile<*>,
|
profile: IProfile<*>,
|
||||||
current: Boolean
|
current: Boolean
|
||||||
@ -59,7 +59,7 @@ fun AccountHeaderBuilder.withOnAccountHeaderProfileImageListener(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun MiniDrawer.withOnMiniDrawerItemClickListener(listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int) -> Boolean): MiniDrawer {
|
inline fun MiniDrawer.withOnMiniDrawerItemClickListener(crossinline listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int) -> Boolean): MiniDrawer {
|
||||||
return this.withOnMiniDrawerItemClickListener(object : MiniDrawer.OnMiniDrawerItemClickListener {
|
return this.withOnMiniDrawerItemClickListener(object : MiniDrawer.OnMiniDrawerItemClickListener {
|
||||||
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int): Boolean {
|
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int): Boolean {
|
||||||
return listener(view, position, drawerItem, type)
|
return listener(view, position, drawerItem, type)
|
||||||
|
@ -80,7 +80,7 @@ class NavDrawer(
|
|||||||
val drawerBuilder = DrawerBuilder()
|
val drawerBuilder = DrawerBuilder()
|
||||||
.withActivity(activity)
|
.withActivity(activity)
|
||||||
.withDrawerLayout(R.layout.material_drawer_fits_not)
|
.withDrawerLayout(R.layout.material_drawer_fits_not)
|
||||||
.withHasStableIds(true)
|
//.withHasStableIds(true)
|
||||||
.withItemAnimator(AlphaCrossFadeAnimator())
|
.withItemAnimator(AlphaCrossFadeAnimator())
|
||||||
.withRootView(drawerContainer)
|
.withRootView(drawerContainer)
|
||||||
.withFullscreen(true)
|
.withFullscreen(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user