mirror of
https://github.com/kuba2k2/NavLib.git
synced 2025-01-18 06:16:43 -06:00
Optimized toolbar code
This commit is contained in:
parent
01c787405e
commit
84d6447887
@ -7,8 +7,6 @@ import com.google.android.material.appbar.MaterialToolbar
|
|||||||
|
|
||||||
class NavToolbar : MaterialToolbar {
|
class NavToolbar : MaterialToolbar {
|
||||||
|
|
||||||
var toolbar: MaterialToolbar = this
|
|
||||||
|
|
||||||
constructor(context: Context) : super(context) {
|
constructor(context: Context) : super(context) {
|
||||||
create(null, 0)
|
create(null, 0)
|
||||||
}
|
}
|
||||||
@ -30,11 +28,11 @@ class NavToolbar : MaterialToolbar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun setSubtitle(subtitle: CharSequence?) {
|
override fun setSubtitle(subtitle: CharSequence?) {
|
||||||
if(subtitle == null || subtitle.isEmpty()) {
|
if(subtitle.isNullOrEmpty()) {
|
||||||
toolbar.setPadding(0, 0, 0, 0)
|
setPadding(0, 0, 0, 0)
|
||||||
toolbarImage?.translationY = 0f
|
toolbarImage?.translationY = 0f
|
||||||
} else {
|
} else {
|
||||||
toolbar.setPadding(0, -1, 0, 5)
|
setPadding(0, -1, 0, 5)
|
||||||
toolbarImage?.translationY = 6f
|
toolbarImage?.translationY = 6f
|
||||||
}
|
}
|
||||||
super.setSubtitle(subtitle)
|
super.setSubtitle(subtitle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user