Drop support for Android 4.x (#2440)
* Bump minSdkVersion * Remove Android 4.x specific logic * Consolidate res assets * Add note about minimum Android version to README * Restore incorrectly removed method, remove unneeded Lollipop TargetApi annotations
This commit is contained in:
@@ -16,32 +16,26 @@ class ElevationAppBarLayout @JvmOverloads constructor(
|
||||
private var origStateAnimator: StateListAnimator? = null
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
origStateAnimator = stateListAnimator
|
||||
}
|
||||
origStateAnimator = stateListAnimator
|
||||
}
|
||||
|
||||
fun enableElevation() {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
stateListAnimator = origStateAnimator
|
||||
}
|
||||
stateListAnimator = origStateAnimator
|
||||
}
|
||||
|
||||
fun disableElevation() {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
stateListAnimator = StateListAnimator().apply {
|
||||
val objAnimator = ObjectAnimator.ofFloat(this, "elevation", 0f)
|
||||
stateListAnimator = StateListAnimator().apply {
|
||||
val objAnimator = ObjectAnimator.ofFloat(this, "elevation", 0f)
|
||||
|
||||
// Enabled and collapsible, but not collapsed means not elevated
|
||||
addState(intArrayOf(android.R.attr.enabled, R.attr.state_collapsible, -R.attr.state_collapsed),
|
||||
objAnimator)
|
||||
// Enabled and collapsible, but not collapsed means not elevated
|
||||
addState(intArrayOf(android.R.attr.enabled, R.attr.state_collapsible, -R.attr.state_collapsed),
|
||||
objAnimator)
|
||||
|
||||
// Default enabled state
|
||||
addState(intArrayOf(android.R.attr.enabled), objAnimator)
|
||||
// Default enabled state
|
||||
addState(intArrayOf(android.R.attr.enabled), objAnimator)
|
||||
|
||||
// Disabled state
|
||||
addState(IntArray(0), objAnimator)
|
||||
}
|
||||
// Disabled state
|
||||
addState(IntArray(0), objAnimator)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user