Add detail navigation

This commit is contained in:
Hemanth S 2020-08-12 03:01:09 +05:30
parent 4a87a900be
commit ec47bc3d2e
34 changed files with 381 additions and 324 deletions

View file

@ -31,6 +31,7 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import com.google.android.material.button.MaterialButton
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
fun Int.ripAlpha(): Int {
@ -102,4 +103,17 @@ fun ExtendedFloatingActionButton.accentColor() {
backgroundTintList = colorStateList
setTextColor(textColorStateList)
iconTint = textColorStateList
}
fun MaterialButton.applyColor(color: Int) {
val backgroundColorStateList = ColorStateList.valueOf(color)
val textColorColorStateList = ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
context,
ColorUtil.isColorLight(color)
)
)
backgroundTintList = backgroundColorStateList
setTextColor(textColorColorStateList)
iconTint = textColorColorStateList
}

View file

@ -62,6 +62,10 @@ fun <T> AppCompatActivity.whichFragment(@IdRes id: Int): T {
return supportFragmentManager.findFragmentById(id) as T
}
@Suppress("UNCHECKED_CAST")
fun <T> Fragment.whichFragment(@IdRes id: Int): T {
return childFragmentManager.findFragmentById(id) as T
}
fun Fragment.showToast(@StringRes stringRes: Int) {
showToast(getString(stringRes))