diff --git a/.DS_Store b/.DS_Store
index 6e5eebc..b497a30 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
index ad4c84c..03b22dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/Android-Skin-Loader.iml
# Built application files
*.ap_
@@ -8,6 +9,8 @@
*.class
# Generated files
+/.idea
+.idea/*
bin/
gen/
@@ -20,6 +23,8 @@ build/
local.properties
# Proguard folder generated by Eclipse
+/android-skin-loader-lib/android-skin-loader-lib.iml
+/.idea/workspace.xml
proguard/
# Log Files
diff --git a/.idea/.name b/.idea/.name
index 0ce78c4..e6a9698 100644
--- a/.idea/.name
+++ b/.idea/.name
@@ -1 +1 @@
-SkinLoader
\ No newline at end of file
+Android-Skin-Loader
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index ee5709d..aecd954 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,12 +11,12 @@
-
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 97626ba..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 3db38bb..b242a6d 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,9 +3,8 @@
diff --git a/.idea/libraries/appcompat_v7_23_1_1.xml b/.idea/libraries/appcompat_v7_23_1_1.xml
index bd581a0..c14c513 100644
--- a/.idea/libraries/appcompat_v7_23_1_1.xml
+++ b/.idea/libraries/appcompat_v7_23_1_1.xml
@@ -8,8 +8,9 @@
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_23_1_1.xml b/.idea/libraries/support_annotations_23_1_1.xml
index 43e048d..7ddc314 100644
--- a/.idea/libraries/support_annotations_23_1_1.xml
+++ b/.idea/libraries/support_annotations_23_1_1.xml
@@ -1,11 +1,12 @@
-
+
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_23_1_1.xml b/.idea/libraries/support_v4_23_1_1.xml
index 3ab35e3..f63eb70 100644
--- a/.idea/libraries/support_v4_23_1_1.xml
+++ b/.idea/libraries/support_v4_23_1_1.xml
@@ -2,17 +2,16 @@
-
-
+
+
-
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 93b4dee..6861a45 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,8 @@
+
+
+
@@ -37,13 +40,26 @@
-
+
-
- $USER_HOME$/.subversion
+
+
+
+
+ Android API 23 Platform
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 07215c1..61b5def 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -12,14 +9,20 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
@@ -28,11 +31,6 @@
-
-
-
-
-
@@ -45,41 +43,17 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -368,6 +342,10 @@
+
+
+
+
@@ -462,10 +440,6 @@
-
-
-
-
@@ -474,10 +448,6 @@
-
-
-
-
@@ -490,10 +460,6 @@
-
-
-
-
@@ -511,6 +477,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -519,6 +497,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -543,6 +533,10 @@
+
+
+
+
@@ -551,11 +545,21 @@
+
+
+
+
+
+
+
+
+
+
@@ -646,70 +650,26 @@
+
-
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+
+
+
+
+
+
+
+
+
+
@@ -4105,20 +3044,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -4137,20 +3064,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -4179,11 +3094,11 @@
-
+
-
+
@@ -4192,48 +3107,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -4255,41 +3133,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -4298,8 +3148,8 @@
-
-
+
+
@@ -4311,26 +3161,14 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -4342,27 +3180,15 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -4376,51 +3202,86 @@
+
+ localhost
+ 5050
+
+
+ $USER_HOME$/.subversion
+
-
- 1449048930624
+
+
+
+
+ 1454383133948
- 1449048930624
+ 1454383133948
+
+
+ 1454383513816
+
+
+ 1454383513816
+
+
+ 1454397092942
+
+
+ 1454397092942
+
+ 1454397473732
+
+
+ 1454397473732
+
+
+ 1454398777923
+
+
+ 1454398777923
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4434,91 +3295,112 @@
+
+
+
+
+
+
+
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
-
+
+
-
+
-
-
-
+
+
-
+
@@ -4526,302 +3408,328 @@
-
+
-
-
+
+
-
+
-
-
-
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
-
+
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
+
-
-
-
+
+
-
+
-
-
-
+
+
-
+
-
-
-
+
+
-
+
-
+
-
+
-
+
-
-
-
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
diff --git a/android-skin-loader-lib/.gitignore b/android-skin-loader-lib/.gitignore
index 796b96d..33a0d2c 100644
--- a/android-skin-loader-lib/.gitignore
+++ b/android-skin-loader-lib/.gitignore
@@ -1 +1,2 @@
+/android-skin-loader-lib.iml
/build
diff --git a/android-skin-loader-lib/android-skin-loader-lib.iml b/android-skin-loader-lib/android-skin-loader-lib.iml
index ccad11b..d617873 100644
--- a/android-skin-loader-lib/android-skin-loader-lib.iml
+++ b/android-skin-loader-lib/android-skin-loader-lib.iml
@@ -29,6 +29,7 @@
+
@@ -66,24 +67,22 @@
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/android-skin-loader-lib/build.gradle b/android-skin-loader-lib/build.gradle
index faa34a7..fa8a287 100644
--- a/android-skin-loader-lib/build.gradle
+++ b/android-skin-loader-lib/build.gradle
@@ -22,4 +22,6 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.1.1'
+ compile 'com.anthonycr.grant:permissions:1.0'
+
}
diff --git a/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseActivity.java b/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseActivity.java
index 6e07424..93a4ad2 100644
--- a/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseActivity.java
+++ b/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseActivity.java
@@ -1,8 +1,14 @@
package cn.feng.skin.manager.base;
+import com.anthonycr.grant.PermissionsManager;
+import com.anthonycr.grant.PermissionsResultAction;
+import com.example.android_skin_loader_lib.R;
+
+import android.Manifest;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
+import android.widget.Toast;
import java.util.List;
@@ -34,6 +40,23 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSkinInflaterFactory = new SkinInflaterFactory();
getLayoutInflater().setFactory(mSkinInflaterFactory);
+
+ PermissionsManager.getInstance().requestPermissionsIfNecessaryForResult(this, new String[]{Manifest
+ .permission.READ_EXTERNAL_STORAGE}, new PermissionsResultAction() {
+ @Override
+ public void onGranted() {
+ SkinManager.getInstance().load();
+ }
+
+ @Override
+ public void onDenied(String permission) {
+ Toast.makeText(BaseActivity.this, String.format(getResources().getString(R.string
+ .permission_request_failed), permission), Toast
+ .LENGTH_SHORT).show();
+ }
+ });
+
+
}
@Override
@@ -80,4 +103,10 @@ public void onThemeUpdate() {
public void dynamicAddView(View view, List pDAttrs) {
mSkinInflaterFactory.dynamicAddSkinEnableView(this, view, pDAttrs);
}
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ PermissionsManager.getInstance().notifyPermissionsChange(permissions,grantResults);
+ }
}
diff --git a/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseFragmentActivity.java b/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseFragmentActivity.java
index 301b1d3..207f01b 100644
--- a/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseFragmentActivity.java
+++ b/android-skin-loader-lib/src/main/java/cn/feng/skin/manager/base/BaseFragmentActivity.java
@@ -1,9 +1,15 @@
package cn.feng.skin.manager.base;
+import com.anthonycr.grant.PermissionsManager;
+import com.anthonycr.grant.PermissionsResultAction;
+import com.example.android_skin_loader_lib.R;
+
+import android.Manifest;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
+import android.widget.Toast;
import java.lang.reflect.Field;
import java.util.List;
@@ -49,8 +55,23 @@ protected void onCreate(Bundle savedInstanceState) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
- }
-
+ }
+ PermissionsManager.getInstance().requestPermissionsIfNecessaryForResult(this, new String[]{Manifest
+ .permission.READ_EXTERNAL_STORAGE}, new PermissionsResultAction() {
+ @Override
+ public void onGranted() {
+ SkinManager.getInstance().load();
+ }
+
+ @Override
+ public void onDenied(String permission) {
+ Toast.makeText(BaseFragmentActivity.this,String.format(getResources().getString(R.string
+ .permission_request_failed),permission),Toast
+ .LENGTH_SHORT).show();
+ }
+ });
+
+
}
@Override
@@ -87,4 +108,10 @@ public void onThemeUpdate() {
public void dynamicAddView(View view, List pDAttrs) {
mSkinInflaterFactory.dynamicAddSkinEnableView(this, view, pDAttrs);
}
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ PermissionsManager.getInstance().notifyPermissionsChange(permissions,grantResults);
+ }
}
diff --git a/android-skin-loader-lib/src/main/res/values/strings.xml b/android-skin-loader-lib/src/main/res/values/strings.xml
index a94a3d2..7fcd301 100644
--- a/android-skin-loader-lib/src/main/res/values/strings.xml
+++ b/android-skin-loader-lib/src/main/res/values/strings.xml
@@ -1,3 +1,4 @@
android-skin-loader-lib
+ 获取权限%s失败,无法更新皮肤插件
diff --git a/android-skin-loader-sample/.gitignore b/android-skin-loader-sample/.gitignore
index 796b96d..c109887 100644
--- a/android-skin-loader-sample/.gitignore
+++ b/android-skin-loader-sample/.gitignore
@@ -1 +1,2 @@
+/android-skin-loader-sample.iml
/build
diff --git a/android-skin-loader-sample/android-skin-loader-sample.iml b/android-skin-loader-sample/android-skin-loader-sample.iml
index 6bd8fa7..f80b0c0 100644
--- a/android-skin-loader-sample/android-skin-loader-sample.iml
+++ b/android-skin-loader-sample/android-skin-loader-sample.iml
@@ -28,6 +28,7 @@
+
@@ -64,23 +65,17 @@
-
+
+
-
-
-
-
-
-
-
-
+
diff --git a/android-skin-loader-skin/.gitignore b/android-skin-loader-skin/.gitignore
index 796b96d..4489745 100644
--- a/android-skin-loader-skin/.gitignore
+++ b/android-skin-loader-skin/.gitignore
@@ -1 +1,2 @@
+/android-skin-loader-skin.iml
/build
diff --git a/android-skin-loader-skin/android-skin-loader-skin.iml b/android-skin-loader-skin/android-skin-loader-skin.iml
index 6c3e74a..a2996b6 100644
--- a/android-skin-loader-skin/android-skin-loader-skin.iml
+++ b/android-skin-loader-skin/android-skin-loader-skin.iml
@@ -28,6 +28,7 @@
+
@@ -64,26 +65,19 @@
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index b169365..be515a8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
+ classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/skin-package/Sample.apk b/skin-package/Sample.apk
index bd1583e..70d178f 100644
Binary files a/skin-package/Sample.apk and b/skin-package/Sample.apk differ