Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set minSdk 23 #25

Merged
merged 2 commits into from
Mar 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Set minSdk to 23
  • Loading branch information
ismaeldivita committed Mar 8, 2020
commit 4b55e23016fb4e6043fe1dd5886ee4f840085484
2 changes: 1 addition & 1 deletion chip-navigation-bar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {


defaultConfig {
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@ internal fun View.setCustomRipple(
val unselected = RippleDrawable(colorStateList, null, mask)
val states = StateListDrawable()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
states.addState(intArrayOf(android.R.attr.state_selected), selectedBackground)
states.addState(intArrayOf(), ColorDrawable(Color.TRANSPARENT))
background = states
foreground = unselected
} else {
states.addState(intArrayOf(android.R.attr.state_selected), selectedBackground)
states.addState(intArrayOf(), ColorDrawable(Color.TRANSPARENT))
background = states
}
states.addState(intArrayOf(android.R.attr.state_selected), selectedBackground)
states.addState(intArrayOf(), ColorDrawable(Color.TRANSPARENT))
background = states
foreground = unselected
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ internal class VerticalMenuItemView @JvmOverloads constructor(
containerBackground.cornerAnimation(0f, 1000f)
} else {
containerBackground.cornerRadius = 1000f
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
container.setCustomRipple(containerBackground, containerForeground)
}
}
}

Expand All @@ -161,7 +158,6 @@ internal class VerticalMenuItemView @JvmOverloads constructor(
containerBackground.cornerAnimation(1000f, 0f)
} else {
containerBackground.cornerRadii = cornerRadii
restoreRippleMaskForLegacy()
}
}

Expand All @@ -172,17 +168,8 @@ internal class VerticalMenuItemView @JvmOverloads constructor(
cornerRadii =
floatArrayOf(corner, corner, 1000f, 1000f, 1000f, 1000f, corner, corner)
}
onEndListener { restoreRippleMaskForLegacy() }
duration = BACKGROUND_CORNER_ANIMATION_DURATION
start()
}
}


private fun restoreRippleMaskForLegacy() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
container.setCustomRipple(containerBackground, containerForeground)
}
}

}
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "ismaeldivita.chipnavigation"
minSdkVersion 22
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
Expand Down