From 9ea956d06da13bda842f02ca7eee47ba394b50e0 Mon Sep 17 00:00:00 2001 From: Terence Date: Sun, 6 Nov 2016 05:34:41 +0800 Subject: [PATCH] Fix rendering issue in Android Studio --- build.gradle | 2 +- demo/build.gradle | 2 +- gradle.properties | 8 ++++---- gradle/wrapper/gradle-wrapper.properties | 4 ++-- .../java/me/philio/pinentry/PinEntryView.java | 17 +++++++++++------ 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 77ea57e..3eb825a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.0-rc1' + classpath 'com.android.tools.build:gradle:2.2.2' } } diff --git a/demo/build.gradle b/demo/build.gradle index 9e7cad5..789cc99 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -21,6 +21,6 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:23.2.0' + compile 'com.android.support:appcompat-v7:25.0.0' compile project(':pinentry') } diff --git a/gradle.properties b/gradle.properties index c6cdcb5..6224db9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -31,7 +31,7 @@ POM_LICENCE_DIST=repo POM_DEVELOPER_ID=philio POM_DEVELOPER_NAME=Phil Bayfield -ANDROID_BUILD_MIN_SDK_VERSION=7 -ANDROID_BUILD_TARGET_SDK_VERSION=23 -ANDROID_BUILD_TOOLS_VERSION=23.0.2 -ANDROID_BUILD_SDK_VERSION=23 \ No newline at end of file +ANDROID_BUILD_MIN_SDK_VERSION=9 +ANDROID_BUILD_TARGET_SDK_VERSION=25 +ANDROID_BUILD_TOOLS_VERSION=25.0.0 +ANDROID_BUILD_SDK_VERSION=25 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2c2898..c73a268 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Apr 25 23:18:24 BST 2016 +#Sun Nov 06 04:41:09 SGT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java b/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java index 8ff5e1d..787cf6e 100644 --- a/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java +++ b/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java @@ -23,6 +23,7 @@ import android.os.Build; import android.os.Parcel; import android.os.Parcelable; +import android.support.v4.content.ContextCompat; import android.text.Editable; import android.text.InputFilter; import android.text.InputType; @@ -151,16 +152,20 @@ public PinEntryView(Context context, AttributeSet attrs, int defStyle) { // Text colour, default to android:textColorPrimary from theme TypedValue textColor = new TypedValue(); theme.resolveAttribute(android.R.attr.textColorPrimary, textColor, true); - digitTextColor = array.getColor(R.styleable.PinEntryView_digitTextColor, - textColor.resourceId > 0 ? getResources().getColor(textColor.resourceId) : - textColor.data); + digitTextColor = array.getColor(R.styleable.PinEntryView_digitTextColor, -1); + + if (!isInEditMode() && digitTextColor == -1) { + digitTextColor = ContextCompat.getColor(context, textColor.resourceId); + } // Accent colour, default to android:colorAccent from theme TypedValue accentColor = new TypedValue(); theme.resolveAttribute(R.attr.colorAccent, accentColor, true); - this.accentColor = array.getColor(R.styleable.PinEntryView_pinAccentColor, - accentColor.resourceId > 0 ? getResources().getColor(accentColor.resourceId) : - accentColor.data); + this.accentColor = array.getColor(R.styleable.PinEntryView_pinAccentColor, -1); + + if (!isInEditMode() && this.accentColor == -1) { + this.accentColor = ContextCompat.getColor(context, textColor.resourceId); + } // Mask character String maskCharacter = array.getString(R.styleable.PinEntryView_mask);