Skip to content

Commit

Permalink
- fixed clipPath deprecation on android P
Browse files Browse the repository at this point in the history
- updated versions
  • Loading branch information
zagum committed Aug 13, 2018
1 parent 0d8175f commit 7f47d5c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.android.tools.build:gradle:3.1.4'
}
}

Expand All @@ -17,11 +17,11 @@ allprojects {

ext {
compileSdkVersion = 27
buildToolsVersion = '27.0.0'
buildToolsVersion = '27.0.3'
minSdkVersion = 15
targetSdkVersion = compileSdkVersion

supportLibVersion = '27.1.0'
supportLibVersion = '27.1.1'
}

task clean(type: Delete) {
Expand Down
4 changes: 2 additions & 2 deletions switchicon-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'

dependencies {
compile project(":switchicon")
compile "com.android.support:appcompat-v7:$supportLibVersion"
implementation project(":switchicon")
implementation "com.android.support:appcompat-v7:$supportLibVersion"
}

android {
Expand Down
12 changes: 6 additions & 6 deletions switchicon/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

dependencies {
compile "com.android.support:appcompat-v7:$supportLibVersion"
implementation "com.android.support:appcompat-v7:$supportLibVersion"
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
}
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight)
protected void onDraw(Canvas canvas) {
if (!noDash) {
drawDash(canvas);
canvas.clipPath(clipPath, Region.Op.XOR);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
canvas.clipOutPath(clipPath);
} else {
canvas.clipPath(clipPath, Region.Op.XOR);
}
}
super.onDraw(canvas);
}
Expand Down

0 comments on commit 7f47d5c

Please sign in to comment.