diff --git a/.gitignore b/.gitignore index 61a1401..e80e678 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,7 @@ proguard/ # OS generated files .DS_Store .DS_Store? + +.idea + +*.iml diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties b/.gradle/2.2.1/taskArtifacts/cache.properties deleted file mode 100644 index 9ef1493..0000000 --- a/.gradle/2.2.1/taskArtifacts/cache.properties +++ /dev/null @@ -1 +0,0 @@ -#Mon Nov 02 16:58:44 CST 2015 diff --git a/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/.gradle/2.2.1/taskArtifacts/cache.properties.lock deleted file mode 100644 index a894d58..0000000 Binary files a/.gradle/2.2.1/taskArtifacts/cache.properties.lock and /dev/null differ diff --git a/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/.gradle/2.2.1/taskArtifacts/fileHashes.bin deleted file mode 100644 index 5cb35bd..0000000 Binary files a/.gradle/2.2.1/taskArtifacts/fileHashes.bin and /dev/null differ diff --git a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin deleted file mode 100644 index c2df789..0000000 Binary files a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin and /dev/null differ diff --git a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin b/.gradle/2.2.1/taskArtifacts/outputFileStates.bin deleted file mode 100644 index c54459c..0000000 Binary files a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin and /dev/null differ diff --git a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin deleted file mode 100644 index 48c960c..0000000 Binary files a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin and /dev/null differ diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 992201d..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -ChangeSkin \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 9a8b7e5..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 6fa0197..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/libraries/appcompat_v7_23_0_1.xml b/.idea/libraries/appcompat_v7_23_0_1.xml deleted file mode 100644 index 50020c2..0000000 --- a/.idea/libraries/appcompat_v7_23_0_1.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/nineoldandroids_2_4_0.xml b/.idea/libraries/nineoldandroids_2_4_0.xml deleted file mode 100644 index d173cab..0000000 --- a/.idea/libraries/nineoldandroids_2_4_0.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_annotations_23_0_1.xml b/.idea/libraries/support_annotations_23_0_1.xml deleted file mode 100644 index 0010b3e..0000000 --- a/.idea/libraries/support_annotations_23_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/support_v4_23_0_1.xml b/.idea/libraries/support_v4_23_0_1.xml deleted file mode 100644 index 305c40a..0000000 --- a/.idea/libraries/support_v4_23_0_1.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index dae7a60..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.7 - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 09ad7f0..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 7c0dfa5..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,3389 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - localhost - 5050 - - - - - - - 1446454704762 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index a82a187..75ccd6b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ dependencies { ```xml dependencies { - compile 'com.zhy:changeskin:4.0.2' + compile 'com.zhy:changeskin:4.0.3' } ``` diff --git a/app/app.iml b/app/app.iml deleted file mode 100644 index 41d0edd..0000000 --- a/app/app.iml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/changeskin/changeskin.iml b/changeskin/changeskin.iml deleted file mode 100644 index 2a404c6..0000000 --- a/changeskin/changeskin.iml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttrType.java b/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttrType.java index 763bab7..1953de6 100644 --- a/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttrType.java +++ b/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttrType.java @@ -1,9 +1,11 @@ package com.zhy.changeskin.attr; import android.content.res.ColorStateList; +import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.view.View; import android.widget.ImageView; +import android.widget.ListView; import android.widget.TextView; import com.zhy.changeskin.ResourceManager; @@ -13,78 +15,64 @@ /** * Created by zhy on 15/9/28. */ -public enum SkinAttrType -{ - BACKGROUND("background") - { - @Override - public void apply(View view, String resName) - { - Drawable drawable = getResourceManager().getDrawableByName(resName); - if (drawable != null) - { - view.setBackgroundDrawable(drawable); - } else - { - try{ - int color = getResourceManager().getColor(resName); - view.setBackgroundColor(color); - } catch (Resources.NotFoundException ex) { - ex.printStackTrace(); - } - } +public enum SkinAttrType { + BACKGROUND("background") { + @Override + public void apply(View view, String resName) { + try { + Drawable drawable = getResourceManager().getDrawableByName(resName); + + if (drawable != null) { + view.setBackgroundDrawable(drawable); + } else { + int color = getResourceManager().getColor(resName); + view.setBackgroundColor(color); } - }, COLOR("textColor") - { - @Override - public void apply(View view, String resName) - { - ColorStateList colorList = getResourceManager().getColorStateList(resName); - if (colorList == null) return; - ((TextView) view).setTextColor(colorList); + } catch (Resources.NotFoundException e) { + e.printStackTrace(); } - }, SRC("src") - { - @Override - public void apply(View view, String resName) - { - if (view instanceof ImageView) - { - Drawable drawable = getResourceManager().getDrawableByName(resName); - if (drawable == null) return; - ((ImageView) view).setImageDrawable(drawable); - } - + } + }, COLOR("textColor") { + @Override + public void apply(View view, String resName) { + ColorStateList colorList = getResourceManager().getColorStateList(resName); + if (colorList == null) return; + ((TextView) view).setTextColor(colorList); + } + }, SRC("src") { + @Override + public void apply(View view, String resName) { + if (view instanceof ImageView) { + Drawable drawable = getResourceManager().getDrawableByName(resName); + if (drawable == null) return; + ((ImageView) view).setImageDrawable(drawable); } - }, DIVIDER("divider") - { - @Override - public void apply(View view, String resName) { - if (view instanceof ListView) { - Drawable divider = getResourceManager().getDrawableByName(resName); - if (divider == null) return; - ((ListView) view).setDivider(divider); - } + } + }, DIVIDER("divider") { + @Override + public void apply(View view, String resName) { + if (view instanceof ListView) { + Drawable divider = getResourceManager().getDrawableByName(resName); + if (divider == null) return; + ((ListView) view).setDivider(divider); } - }; + } + }; String attrType; - SkinAttrType(String attrType) - { + SkinAttrType(String attrType) { this.attrType = attrType; } - public String getAttrType() - { + public String getAttrType() { return attrType; } public abstract void apply(View view, String resName); - public ResourceManager getResourceManager() - { + public ResourceManager getResourceManager() { return SkinManager.getInstance().getResourceManager(); }