Skip to content

Commit

Permalink
tint color can now be changed without updating image type
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Mondon committed Jan 4, 2018
1 parent d590619 commit dafbc3d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 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.3'
compile 'com.blunderer:easy-animated-vector-drawable:1.0.4'
}
```

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

android {
compileSdkVersion 27
buildToolsVersion "27.0.0"

defaultConfig {
applicationId "com.blunderer.easyanimatedvectordrawabledemo"
Expand All @@ -11,19 +10,13 @@ android {
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}

dependencies {
implementation 'com.android.support:appcompat-v7:27.0.0'

implementation project(':library')

implementation 'com.android.support:appcompat-v7:27.0.2'
}
15 changes: 8 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion "27.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 4
versionName "1.0.3"
versionCode 5
versionName "1.0.4"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand All @@ -23,14 +22,16 @@ android {
}

dependencies {
implementation 'com.android.support:appcompat-v7:27.0.0'
api 'com.wnafee:vector-compat:1.0.5'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.wnafee:vector-compat:1.0.5'
}

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

apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
// Command to build artifact:
// $> ./gradlew clean build generateRelease
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public static void setImageType(@NonNull ImageView imageView, @NonNull Enum<?> t
}

final Enum<?> currentType = (Enum<?>) imageView.getTag(R.id.eavd_current_type);
if (currentType == type) {
final Object currentTintColorObject = imageView.getTag(R.id.eavd_current_tint_color);
final int currentTintColor = currentTintColorObject == null ? 0 : (int) currentTintColorObject;
if (currentType == type && currentTintColor == tintColor) {
// Both types are equals, do nothing.
return;
}
Expand Down Expand Up @@ -79,6 +81,7 @@ private static void setImageDrawable(@NonNull ImageView imageView, @DrawableRes

imageView.setImageDrawable(drawable);
imageView.setTag(R.id.eavd_current_type, type);
imageView.setTag(R.id.eavd_current_tint_color, tintColor);

if (drawable instanceof Animatable) {
Animatable animatable = (Animatable) drawable;
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<resources>

<item name="eavd_current_type" type="id"/>
<item name="eavd_current_tint_color" type="id"/>

</resources>

0 comments on commit dafbc3d

Please sign in to comment.