Skip to content

Commit

Permalink
fixed bug: drawable was not mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Mondon committed Sep 28, 2017
1 parent 56d303e commit 9fc6301
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Download

```groovy
dependencies {
compile 'com.blunderer:easy-animated-vector-drawable:1.0.0'
compile 'com.blunderer:easy-animated-vector-drawable:1.0.1'
}
```

Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:2.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,6 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}

Expand Down
11 changes: 7 additions & 4 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
applicationId "com.blunderer.easyanimatedvectordrawabledemo"
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
Expand All @@ -17,10 +17,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}

dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:appcompat-v7:26.0.1'

compile project(':library')
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button playButton = (Button) findViewById(R.id.activity_main_play_button);
Button pauseButton = (Button) findViewById(R.id.activity_main_pause_button);
Button stopButton = (Button) findViewById(R.id.activity_main_stop_button);
Button playButton = findViewById(R.id.activity_main_play_button);
Button pauseButton = findViewById(R.id.activity_main_pause_button);
Button stopButton = findViewById(R.id.activity_main_stop_button);

final AppCompatImageView imageView = (AppCompatImageView) findViewById(R.id.activity_main_imageview);
final AppCompatImageView imageView = findViewById(R.id.activity_main_imageview);

playButton.setOnClickListener(new View.OnClickListener() {

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Thu Sep 28 10:46:06 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Empty file modified gradlew
100644 → 100755
Empty file.
14 changes: 7 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
targetSdkVersion 26
versionCode 2
versionName "1.0.1"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand All @@ -23,14 +23,14 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.wnafee:vector-compat:1.0.5'
}

ext {
PUBLISH_GROUP_ID = 'com.blunderer'
PUBLISH_ARTIFACT_ID = 'easy-animated-vector-drawable'
PUBLISH_VERSION = '1.0.0'
PUBLISH_VERSION = '1.0.1'
}

apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static void setImageDrawable(@NonNull ImageView imageView, @DrawableRes
Log.e(TAG, "The drawable for the " + type.name() + " type is not valid");
return;
}
Drawable drawable = ResourcesCompat.getDrawable(imageView.getContext(), drawableResId);
Drawable drawable = ResourcesCompat.getDrawable(imageView.getContext(), drawableResId).mutate();
if (tintColor != 0) {
drawable.setColorFilter(tintColor, PorterDuff.Mode.SRC_IN);
}
Expand Down

0 comments on commit 9fc6301

Please sign in to comment.