├── .gitignore
├── .gradle
└── 2.2.1
│ └── taskArtifacts
│ ├── cache.properties
│ ├── cache.properties.lock
│ ├── fileHashes.bin
│ ├── fileSnapshots.bin
│ ├── outputFileStates.bin
│ └── taskArtifacts.bin
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── libraries
│ ├── appcompat_v7_23_0_1.xml
│ ├── nineoldandroids_2_4_0.xml
│ ├── support_annotations_23_0_1.xml
│ └── support_v4_23_0_1.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
├── vcs.xml
└── workspace.xml
├── ChangeSkin.iml
├── LICENSE
├── README.md
├── SkinChangeNow.iml
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── libs
│ └── nineoldandroids-2.4.0.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhy
│ │ └── skinchangenow
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── zhy
│ │ └── skinchangenow
│ │ ├── MainActivity.java
│ │ ├── MenuLeftFragment.java
│ │ ├── TestTagActivity.java
│ │ └── sample
│ │ └── MyApplication.java
│ └── res
│ ├── drawable-nodpi
│ ├── left_menu_icon.png
│ ├── left_menu_icon_green.png
│ ├── left_menu_icon_red.png
│ ├── main_bg.jpg
│ ├── main_bg_green.jpg
│ └── main_bg_red.jpg
│ ├── layout
│ ├── activity_main.xml
│ ├── activity_test_tag.xml
│ ├── fragment_left_menu.xml
│ └── item.xml
│ ├── menu
│ ├── menu_main.xml
│ └── menu_test_tag.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── changeskin
├── .gitignore
├── build.gradle
├── changeskin.iml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhy
│ │ └── changeskin
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── zhy
│ │ └── changeskin
│ │ ├── ResourceManager.java
│ │ ├── SkinManager.java
│ │ ├── attr
│ │ ├── SkinAttr.java
│ │ ├── SkinAttrSupport.java
│ │ ├── SkinAttrType.java
│ │ └── SkinView.java
│ │ ├── callback
│ │ ├── ISkinChangedListener.java
│ │ └── ISkinChangingCallback.java
│ │ ├── constant
│ │ └── SkinConfig.java
│ │ └── utils
│ │ ├── L.java
│ │ └── PrefUtils.java
│ └── res
│ └── values
│ ├── ids.xml
│ └── strings.xml
├── changeskin_sc.gif
├── gradle.properties
├── gradle
├── .gitignore
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── night_plugin.apk
├── npm-debug.log
├── plugin
├── .gitignore
├── build.gradle
├── plugin.iml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zhy
│ │ └── plugin
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ └── res
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── settings.gradle
└── skin_plugin.apk
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 | /*/build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # OS generated files
30 | .DS_Store
31 | .DS_Store?
32 |
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/cache.properties:
--------------------------------------------------------------------------------
1 | #Mon Nov 02 16:58:44 CST 2015
2 |
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/cache.properties.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/.gradle/2.2.1/taskArtifacts/cache.properties.lock
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/.gradle/2.2.1/taskArtifacts/fileHashes.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/outputFileStates.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/.gradle/2.2.1/taskArtifacts/outputFileStates.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | ChangeSkin
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/libraries/appcompat_v7_23_0_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/libraries/nineoldandroids_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/support_annotations_23_0_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/support_v4_23_0_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.7
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ChangeSkin.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidChangeSkin
2 | 一种完全无侵入的换肤方式,支持插件式和应用内,无需重启Activity.
3 |
4 | 与之前发布的ChangeSkin思路完全不同[https://github.com/hongyangAndroid/ChangeSkin](https://github.com/hongyangAndroid/ChangeSkin),主要因为ChangeSkin依赖V4,V7的版本,以及干涉系统构造View的过程,于是希望找到一个几乎没有侵入的方式来实现,于是产生了AndroidChangeSkin,两个项目各有特点,目前两个项目代码都保留,欢迎试用与反馈。
5 |
6 |
7 | ## 特点
8 | * 插件式换肤
9 | * 应用内换肤
10 | * 支持插件或者应用内多套皮肤
11 | * 支持动态生成addView
12 | * 无需重启Activity
13 |
14 |
15 |
16 |
17 | ## 效果图:
18 |
19 |
20 |
21 | ## 引入
22 |
23 | 下载changeskin,作为module依赖至主项目,例如:
24 |
25 | ```xml
26 | dependencies {
27 | compile project(':changeskin')
28 | }
29 | ```
30 | 或者直接添加依赖:
31 |
32 | ```xml
33 | dependencies {
34 | compile 'com.zhy:changeskin:4.0.2'
35 | }
36 | ```
37 |
38 | ## 运行
39 |
40 | Android Studio,import Project形式导入,将[skin_plugin.apk](skin_plugin.apk),放置到模拟器或者真机的sdcard根目录,然后运行项目。
41 |
42 | ## 使用
43 |
44 | * Application
45 |
46 | Application中去调用`SkinManager.getInstance().init(this);`,未来版本可能会去除该步骤。
47 |
48 |
49 | ```java
50 | public class MyApplication extends Application
51 | {
52 | @Override
53 | public void onCreate()
54 | {
55 | super.onCreate();
56 | SkinManager.getInstance().init(this);
57 | }
58 | }
59 |
60 | ```
61 |
62 | * Activity
63 |
64 | 在需要换肤的Activity的onCreate和onDestory中,分别:
65 |
66 | ```java
67 |
68 | @Override
69 | protected void onCreate(Bundle savedInstanceState)
70 | {
71 | SkinManager.getInstance().register(this);
72 | //...
73 | }
74 |
75 | @Override
76 | protected void onDestroy()
77 | {
78 | super.onDestroy();
79 | SkinManager.getInstance().unregister(this);
80 | }
81 | ```
82 |
83 | * 布局文件
84 |
85 | 布局文件中添加支持,主要依赖于tag属性:
86 |
87 | 例如:
88 |
89 | ```xml
90 |
96 | ```
97 |
98 | tag属性分为3部分组成:
99 |
100 | * skin
101 | * 资源的名称,即插件包中资源的名称,需要与当前app内使用的资源名称一致。
102 | * 支持的属性,目前支持src,background,textColor,支持扩展。
103 |
104 | 3部分,必须以:分隔拼接。
105 |
106 | 对于一个View多个属性需要换肤的,`android:tag="skin:item_text_color:textColor|skin:icon:src"`
107 | 同样使用|进行分隔。
108 |
109 | 简言之:如果你哪个View需要换肤,就添加tag属性,tag值按照上述方式设置即可。
110 |
111 |
112 | * 换肤的API
113 |
114 | 插件式:
115 |
116 | ```java
117 | SkinManager.getInstance().changeSkin(
118 | mSkinPkgPath,
119 | "com.imooc.skin_plugin",
120 | new ISkinChangingCallback()
121 | {
122 | @Override
123 | public void onStart()
124 | {
125 | }
126 |
127 | @Override
128 | public void onError(Exception e)
129 | {
130 | Toast.makeText(MainActivity.this, "换肤失败", Toast.LENGTH_SHORT).show();
131 | }
132 |
133 | @Override
134 | public void onComplete()
135 | {
136 | Toast.makeText(MainActivity.this, "换肤成功", Toast.LENGTH_SHORT).show();
137 | }
138 | });
139 | ```
140 |
141 | 应用内:
142 |
143 | ```java
144 | SkinManager.getInstance().changeSkin(suffix);
145 | ```
146 | 应用内多套皮肤以后缀就行区别,比如:main\_bg,皮肤资源可以为:main\_bg\_red,main\_bg\_green等。
147 |
148 | 换肤时,直接传入后缀,例如上面描述的red,green。
149 |
150 |
151 |
152 |
153 |
154 |
--------------------------------------------------------------------------------
/SkinChangeNow.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.zhy.skinchangenow"
9 | minSdkVersion 10
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile files('libs/nineoldandroids-2.4.0.jar')
25 | compile project(':changeskin')
26 | compile 'com.android.support:support-v4:23.0.1'
27 | compile 'com.android.support:appcompat-v7:23.0.1'
28 | }
29 |
--------------------------------------------------------------------------------
/app/libs/nineoldandroids-2.4.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/libs/nineoldandroids-2.4.0.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhy/android/sdk/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zhy/skinchangenow/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zhy.skinchangenow;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase
10 | {
11 | public ApplicationTest()
12 | {
13 | super(Application.class);
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhy/skinchangenow/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhy.skinchangenow;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.os.Environment;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.app.FragmentManager;
8 | import android.support.v4.widget.DrawerLayout;
9 | import android.support.v4.widget.DrawerLayout.DrawerListener;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.view.LayoutInflater;
12 | import android.view.Menu;
13 | import android.view.MenuItem;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 | import android.widget.ArrayAdapter;
17 | import android.widget.ListView;
18 | import android.widget.TextView;
19 | import android.widget.Toast;
20 |
21 | import com.nineoldandroids.view.ViewHelper;
22 | import com.zhy.changeskin.SkinManager;
23 |
24 | import java.io.File;
25 | import java.util.ArrayList;
26 | import java.util.Arrays;
27 | import java.util.List;
28 |
29 | /**
30 | * @author zhy
31 | */
32 | public class MainActivity extends AppCompatActivity
33 | {
34 |
35 | private DrawerLayout mDrawerLayout;
36 | private ListView mListView;
37 | private String mSkinPkgPath = Environment.getExternalStorageDirectory() + File.separator + "skin_plugin.apk";
38 | private List mDatas = new ArrayList(Arrays.asList("Activity", "Service", "Activity", "Service",
39 | "Activity", "Service", "Activity", "Service","Activity", "Service", "Activity", "Service",
40 | "Activity", "Service", "Activity", "Service","Activity", "Service", "Activity", "Service",
41 | "Activity", "Service", "Activity", "Service","Activity", "Service", "Activity", "Service",
42 | "Activity", "Service", "Activity", "Service","Activity", "Service", "Activity", "Service",
43 | "Activity", "Service", "Activity", "Service","Activity", "Service", "Activity", "Service",
44 | "Activity", "Service", "Activity", "Service"));
45 | private ArrayAdapter mAdapter ;
46 |
47 | @Override
48 | public void onCreate(Bundle savedInstanceState)
49 | {
50 | super.onCreate(savedInstanceState);
51 | SkinManager.getInstance().register(this);
52 | setContentView(R.layout.activity_main);
53 | initView();
54 | initEvents();
55 |
56 | }
57 |
58 |
59 | private void initEvents()
60 | {
61 |
62 | mListView = (ListView) findViewById(R.id.id_listview);
63 | mListView.setAdapter(mAdapter = new ArrayAdapter(this, -1, mDatas)
64 | {
65 | @Override
66 | public View getView(int position, View convertView, ViewGroup parent)
67 | {
68 | if (convertView == null)
69 | {
70 | convertView = LayoutInflater.from(MainActivity.this).inflate(R.layout.item, parent
71 | , false);
72 |
73 | }
74 | SkinManager.getInstance().injectSkin(convertView);
75 | TextView tv = (TextView) convertView.findViewById(R.id.id_tv_title);
76 | tv.setText(getItem(position));
77 | return convertView;
78 | }
79 | });
80 |
81 |
82 | mDrawerLayout.setDrawerListener(new DrawerListener()
83 | {
84 | @Override
85 | public void onDrawerStateChanged(int newState)
86 | {
87 | }
88 |
89 | @Override
90 | public void onDrawerSlide(View drawerView, float slideOffset)
91 | {
92 | View mContent = mDrawerLayout.getChildAt(0);
93 | View mMenu = drawerView;
94 | float scale = 1 - slideOffset;
95 | float rightScale = 0.8f + scale * 0.2f;
96 |
97 | if (drawerView.getTag().equals("LEFT"))
98 | {
99 |
100 | float leftScale = 1 - 0.3f * scale;
101 |
102 | ViewHelper.setScaleX(mMenu, leftScale);
103 | ViewHelper.setScaleY(mMenu, leftScale);
104 | ViewHelper.setAlpha(mMenu, 0.6f + 0.4f * (1 - scale));
105 | ViewHelper.setTranslationX(mContent,
106 | mMenu.getMeasuredWidth() * (1 - scale));
107 | ViewHelper.setPivotX(mContent, 0);
108 | ViewHelper.setPivotY(mContent,
109 | mContent.getMeasuredHeight() / 2);
110 | mContent.invalidate();
111 | ViewHelper.setScaleX(mContent, rightScale);
112 | ViewHelper.setScaleY(mContent, rightScale);
113 | }
114 | }
115 |
116 | @Override
117 | public void onDrawerOpened(View drawerView)
118 | {
119 | }
120 |
121 | @Override
122 | public void onDrawerClosed(View drawerView)
123 | {
124 | }
125 | });
126 | }
127 |
128 | private void initView()
129 | {
130 | mDrawerLayout = (DrawerLayout) findViewById(R.id.id_drawerLayout);
131 |
132 | FragmentManager fm = getSupportFragmentManager();
133 | Fragment fragment = fm.findFragmentById(R.id.id_left_menu_container);
134 | if (fragment == null)
135 | {
136 | fm.beginTransaction().add(R.id.id_left_menu_container, new MenuLeftFragment()).commit();
137 | }
138 | }
139 |
140 | @Override
141 | public boolean onCreateOptionsMenu(Menu menu)
142 | {
143 | getMenuInflater().inflate(R.menu.menu_main, menu);
144 | return true;
145 | }
146 |
147 | @Override
148 | public boolean onOptionsItemSelected(MenuItem item)
149 | {
150 | int id = item.getItemId();
151 |
152 | switch (id)
153 | {
154 | case R.id.id_action_plugin_skinchange:
155 | com.zhy.changeskin.SkinManager.getInstance().changeSkin(mSkinPkgPath, "com.imooc.skin_plugin", new com.zhy.changeskin.callback.ISkinChangingCallback()
156 | {
157 | @Override
158 | public void onStart()
159 | {
160 | }
161 |
162 | @Override
163 | public void onError(Exception e)
164 | {
165 | Toast.makeText(MainActivity.this, "换肤失败:" + e.getMessage(), Toast.LENGTH_SHORT).show();
166 | }
167 |
168 | @Override
169 | public void onComplete()
170 | {
171 | Toast.makeText(MainActivity.this, "换肤成功", Toast.LENGTH_SHORT).show();
172 | }
173 | });
174 | break;
175 | case R.id.id_action_remove_any_skin:
176 | com.zhy.changeskin.SkinManager.getInstance().removeAnySkin();
177 | break;
178 | case R.id.id_action_notify_lv:
179 |
180 | for (int i = 0, n = mDatas.size(); i < n; i++)
181 | {
182 | mDatas.set(i, mDatas.get(i) + " changed");
183 | }
184 | mAdapter.notifyDataSetChanged();
185 | break;
186 | case R.id.id_action_dynamic:
187 | Intent intent = new Intent(this,TestTagActivity.class);
188 | startActivity(intent);
189 | break;
190 |
191 | }
192 |
193 |
194 | return super.onOptionsItemSelected(item);
195 | }
196 |
197 | @Override
198 | protected void onDestroy()
199 | {
200 | super.onDestroy();
201 | SkinManager.getInstance().unregister(this);
202 | }
203 | }
204 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhy/skinchangenow/MenuLeftFragment.java:
--------------------------------------------------------------------------------
1 | package com.zhy.skinchangenow;
2 |
3 | import android.os.Bundle;
4 | import android.os.Environment;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.Toast;
10 |
11 | import com.zhy.changeskin.SkinManager;
12 |
13 | import java.io.File;
14 |
15 | public class MenuLeftFragment extends Fragment implements View.OnClickListener
16 | {
17 | private String mSkinPkgPath = Environment.getExternalStorageDirectory() + File.separator + "skin_plugin.apk";
18 | private View mInnerChange01;
19 | private View mInnerChange02;
20 |
21 | @Override
22 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
23 | Bundle savedInstanceState)
24 | {
25 | return inflater.inflate(R.layout.fragment_left_menu, container, false);
26 | }
27 |
28 | @Override
29 | public void onViewCreated(View view, Bundle savedInstanceState)
30 | {
31 | super.onViewCreated(view, savedInstanceState);
32 |
33 | mInnerChange01 = view.findViewById(R.id.id_rl_innerchange01);
34 | mInnerChange01.setOnClickListener(this);
35 |
36 | mInnerChange02 = view.findViewById(R.id.id_rl_innerchange02);
37 | mInnerChange02.setOnClickListener(this);
38 |
39 | view.findViewById(R.id.id_restore).setOnClickListener(new View.OnClickListener()
40 | {
41 | @Override
42 | public void onClick(View v)
43 | {
44 | com.zhy.changeskin.SkinManager.getInstance().removeAnySkin();
45 | }
46 | });
47 |
48 | view.findViewById(R.id.id_changeskin).setOnClickListener(new View.OnClickListener()
49 | {
50 | @Override
51 | public void onClick(View v)
52 | {
53 | com.zhy.changeskin.SkinManager.getInstance().changeSkin(mSkinPkgPath, "com.imooc.skin_plugin", new com.zhy.changeskin.callback.ISkinChangingCallback()
54 | {
55 | @Override
56 | public void onStart()
57 | {
58 | }
59 |
60 | @Override
61 | public void onError(Exception e)
62 | {
63 | Toast.makeText(getActivity(), "换肤失败", Toast.LENGTH_SHORT).show();
64 | }
65 |
66 | @Override
67 | public void onComplete()
68 | {
69 | Toast.makeText(getActivity(), "换肤成功", Toast.LENGTH_SHORT).show();
70 | }
71 | });
72 | }
73 | });
74 |
75 | }
76 |
77 | /**
78 | * Called when a view has been clicked.
79 | *
80 | * @param v The view that was clicked.
81 | */
82 | @Override
83 | public void onClick(View v)
84 | {
85 | switch (v.getId())
86 | {
87 | case R.id.id_rl_innerchange01:
88 | SkinManager.getInstance().changeSkin("red");
89 | break;
90 | case R.id.id_rl_innerchange02:
91 | SkinManager.getInstance().changeSkin("green");
92 | break;
93 | }
94 |
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhy/skinchangenow/TestTagActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhy.skinchangenow;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.Menu;
6 | import android.view.MenuItem;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import com.zhy.changeskin.SkinManager;
12 |
13 | public class TestTagActivity extends AppCompatActivity
14 | {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState)
18 | {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_test_tag);
21 |
22 | SkinManager.getInstance().register(this);
23 | }
24 |
25 | public void addNewView(View view)
26 | {
27 | //建议通过xml inflater
28 | TextView tv = new TextView(this);
29 | tv.setTag("skin:item_text_color:textColor");
30 | tv.setTextColor(getResources().getColorStateList(R.color.item_text_color));
31 | tv.setText("dymaic add!");
32 |
33 | ((ViewGroup) findViewById(R.id.id_container)).addView(tv);
34 | SkinManager.getInstance().injectSkin(tv);
35 |
36 | }
37 |
38 | @Override
39 | protected void onDestroy()
40 | {
41 | super.onDestroy();
42 | SkinManager.getInstance().unregister(this);
43 | }
44 |
45 | @Override
46 | public boolean onCreateOptionsMenu(Menu menu)
47 | {
48 | // Inflate the menu; this adds items to the action bar if it is present.
49 | getMenuInflater().inflate(R.menu.menu_test_tag, menu);
50 | return true;
51 | }
52 |
53 | @Override
54 | public boolean onOptionsItemSelected(MenuItem item)
55 | {
56 | // Handle action bar item clicks here. The action bar will
57 | // automatically handle clicks on the Home/Up button, so long
58 | // as you specify a parent activity in AndroidManifest.xml.
59 | int id = item.getItemId();
60 |
61 | //noinspection SimplifiableIfStatement
62 | if (id == R.id.action_settings)
63 | {
64 | return true;
65 | }
66 |
67 | return super.onOptionsItemSelected(item);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zhy/skinchangenow/sample/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.zhy.skinchangenow.sample;
2 |
3 | import android.app.Application;
4 |
5 | import com.zhy.changeskin.SkinManager;
6 |
7 |
8 | /**
9 | * Created by zhy on 15/9/22.
10 | */
11 | public class MyApplication extends Application
12 | {
13 | @Override
14 | public void onCreate()
15 | {
16 | super.onCreate();
17 | SkinManager.getInstance().init(this);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/left_menu_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/drawable-nodpi/left_menu_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/left_menu_icon_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/drawable-nodpi/left_menu_icon_green.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/left_menu_icon_red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/drawable-nodpi/left_menu_icon_red.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/main_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/drawable-nodpi/main_bg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/main_bg_green.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/drawable-nodpi/main_bg_green.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/main_bg_red.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/drawable-nodpi/main_bg_red.jpg
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_test_tag.xml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
19 |
20 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_left_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
28 |
29 |
39 |
40 |
41 |
45 |
46 |
55 |
56 |
66 |
67 |
68 |
71 |
72 |
81 |
82 |
92 |
93 |
94 |
95 |
99 |
100 |
109 |
110 |
120 |
121 |
122 |
126 |
127 |
136 |
137 |
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
26 |
27 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
9 |
14 |
15 |
16 |
21 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_test_tag.xml:
--------------------------------------------------------------------------------
1 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #ffffffff
4 | #ff000000
5 |
6 |
7 |
8 | #ff0000
9 | #ff0000
10 |
11 |
12 | #00ff00
13 | #00ff00
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SkinChangeNow
3 |
4 | Hello world!
5 | Settings
6 | TestTagActivity
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.2.3'
9 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
10 | classpath 'com.github.dcendents:android-maven-plugin:1.2'
11 | // // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | maven { url("https://oss.sonatype.org/content/repositories/snapshots/") }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/changeskin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/changeskin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 | apply plugin: 'com.jfrog.bintray'
4 |
5 | version = "4.0.2"
6 |
7 | android {
8 | compileSdkVersion 23
9 | buildToolsVersion "23.0.1"
10 |
11 | defaultConfig {
12 | minSdkVersion 10
13 | targetSdkVersion 23
14 | versionCode 1
15 | versionName "1.0"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | compile fileTree(dir: 'libs', include: ['*.jar'])
27 | compile 'com.android.support:appcompat-v7:23.0.1'
28 | compile 'com.android.support:support-v4:23.0.1'
29 | }
30 |
31 | def siteUrl = 'https://github.com/hongyangAndroid/AndroidChangeSkin' // #CONFIG# // project homepage
32 | def gitUrl = 'https://github.com/hongyangAndroid/AndroidChangeSkin.git' // #CONFIG# // project git
33 | group = "com.zhy"
34 |
35 | install {
36 | repositories.mavenInstaller {
37 | // This generates POM.xml with proper parameters
38 | pom {
39 | project {
40 | packaging 'aar'
41 | name 'changeSkin' // #CONFIG# // project title
42 | url siteUrl
43 | // Set your license
44 | licenses {
45 | license {
46 | name 'The Apache Software License, Version 2.0'
47 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
48 | }
49 | }
50 | developers {
51 | developer {
52 | id 'hongyangAndroid' // #CONFIG# // your user id (you can write your nickname)
53 | name 'ZhangHongyang' // #CONFIG# // your user name
54 | email '623565791@qq.com' // #CONFIG# // your email
55 | }
56 | }
57 | scm {
58 | connection gitUrl
59 | developerConnection gitUrl
60 | url siteUrl
61 | }
62 | }
63 | }
64 | }
65 | }
66 |
67 | task sourcesJar(type: Jar) {
68 | from android.sourceSets.main.java.srcDirs
69 | classifier = 'sources'
70 | }
71 |
72 | task javadoc(type: Javadoc) {
73 | source = android.sourceSets.main.java.srcDirs
74 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
75 | }
76 |
77 | task javadocJar(type: Jar, dependsOn: javadoc) {
78 | classifier = 'javadoc'
79 | from javadoc.destinationDir
80 | }
81 |
82 | artifacts {
83 | archives javadocJar
84 | archives sourcesJar
85 | }
86 | Properties properties = new Properties()
87 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
88 | bintray {
89 | user = properties.getProperty("bintray.user")
90 | key = properties.getProperty("bintray.apikey")
91 | configurations = ['archives']
92 | pkg {
93 | repo = "maven"
94 | name = "changeSkin" // #CONFIG# project name in jcenter
95 | websiteUrl = siteUrl
96 | vcsUrl = gitUrl
97 | licenses = ["Apache-2.0"]
98 | publish = true
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/changeskin/changeskin.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/changeskin/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhy/android/sdk/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/changeskin/src/androidTest/java/com/zhy/changeskin/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase
10 | {
11 | public ApplicationTest()
12 | {
13 | super(Application.class);
14 | }
15 | }
--------------------------------------------------------------------------------
/changeskin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/ResourceManager.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin;
2 |
3 | import android.content.res.ColorStateList;
4 | import android.content.res.Resources;
5 | import android.graphics.drawable.Drawable;
6 | import android.text.TextUtils;
7 |
8 | import com.zhy.changeskin.utils.L;
9 |
10 | /**
11 | * Created by zhy on 15/9/22.
12 | */
13 | public class ResourceManager
14 | {
15 | private static final String DEFTYPE_DRAWABLE = "drawable";
16 | private static final String DEFTYPE_COLOR = "color";
17 | private Resources mResources;
18 | private String mPluginPackageName;
19 | private String mSuffix;
20 |
21 |
22 | public ResourceManager(Resources res, String pluginPackageName, String suffix)
23 | {
24 | mResources = res;
25 | mPluginPackageName = pluginPackageName;
26 |
27 | if (suffix == null)
28 | {
29 | suffix = "";
30 | }
31 | mSuffix = suffix;
32 |
33 | }
34 |
35 | public Drawable getDrawableByName(String name)
36 | {
37 | try
38 | {
39 | name = appendSuffix(name);
40 | L.e("name = " + name + " , " + mPluginPackageName);
41 | return mResources.getDrawable(mResources.getIdentifier(name, DEFTYPE_DRAWABLE, mPluginPackageName));
42 | } catch (Resources.NotFoundException e)
43 | {
44 | e.printStackTrace();
45 | return null;
46 | }
47 | }
48 |
49 | public int getColor(String name) throws Resources.NotFoundException
50 | {
51 | name = appendSuffix(name);
52 | L.e("name = " + name);
53 | return mResources.getColor(mResources.getIdentifier(name, DEFTYPE_COLOR, mPluginPackageName));
54 | }
55 |
56 | public ColorStateList getColorStateList(String name)
57 | {
58 | try
59 | {
60 | name = appendSuffix(name);
61 | L.e("name = " + name);
62 | return mResources.getColorStateList(mResources.getIdentifier(name, DEFTYPE_COLOR, mPluginPackageName));
63 |
64 | } catch (Resources.NotFoundException e)
65 | {
66 | e.printStackTrace();
67 | return null;
68 | }
69 |
70 | }
71 |
72 | private String appendSuffix(String name)
73 | {
74 | if (!TextUtils.isEmpty(mSuffix))
75 | return name += "_" + mSuffix;
76 | return name;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/SkinManager.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.pm.PackageInfo;
6 | import android.content.pm.PackageManager;
7 | import android.content.res.AssetManager;
8 | import android.content.res.Resources;
9 | import android.os.AsyncTask;
10 | import android.text.TextUtils;
11 | import android.view.View;
12 |
13 | import com.zhy.changeskin.attr.SkinAttrSupport;
14 | import com.zhy.changeskin.attr.SkinView;
15 | import com.zhy.changeskin.callback.ISkinChangingCallback;
16 | import com.zhy.changeskin.utils.L;
17 | import com.zhy.changeskin.utils.PrefUtils;
18 |
19 | import java.io.File;
20 | import java.lang.reflect.Method;
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | /**
25 | * Created by zhy on 15/9/22.
26 | */
27 | public class SkinManager
28 | {
29 | private Context mContext;
30 | private Resources mResources;
31 | private ResourceManager mResourceManager;
32 | private PrefUtils mPrefUtils;
33 |
34 | private boolean usePlugin;
35 |
36 | private String mSuffix = "";
37 | private String mCurPluginPath;
38 | private String mCurPluginPkg;
39 |
40 |
41 | private List mActivities = new ArrayList();
42 |
43 | private SkinManager()
44 | {
45 | }
46 |
47 | private static class SingletonHolder
48 | {
49 | static SkinManager sInstance = new SkinManager();
50 | }
51 |
52 | public static SkinManager getInstance()
53 | {
54 | return SingletonHolder.sInstance;
55 | }
56 |
57 |
58 | public void init(Context context)
59 | {
60 | mContext = context.getApplicationContext();
61 | mPrefUtils = new PrefUtils(mContext);
62 |
63 | String skinPluginPath = mPrefUtils.getPluginPath();
64 | String skinPluginPkg = mPrefUtils.getPluginPkgName();
65 | mSuffix = mPrefUtils.getSuffix();
66 |
67 | if (!validPluginParams(skinPluginPath, skinPluginPkg))
68 | return;
69 |
70 | try
71 | {
72 | loadPlugin(skinPluginPath, skinPluginPkg, mSuffix);
73 | mCurPluginPath = skinPluginPath;
74 | mCurPluginPkg = skinPluginPkg;
75 | } catch (Exception e)
76 | {
77 | mPrefUtils.clear();
78 | e.printStackTrace();
79 | }
80 | }
81 |
82 | private PackageInfo getPackageInfo(String skinPluginPath) {
83 | PackageManager pm = mContext.getPackageManager();
84 | return pm.getPackageArchiveInfo(skinPluginPath, PackageManager.GET_ACTIVITIES);
85 | }
86 |
87 |
88 | private void loadPlugin(String skinPath, String skinPkgName, String suffix) throws Exception
89 | {
90 | AssetManager assetManager = AssetManager.class.newInstance();
91 | Method addAssetPath = assetManager.getClass().getMethod("addAssetPath", String.class);
92 | addAssetPath.invoke(assetManager, skinPath);
93 |
94 | Resources superRes = mContext.getResources();
95 | mResources = new Resources(assetManager, superRes.getDisplayMetrics(), superRes.getConfiguration());
96 | mResourceManager = new ResourceManager(mResources, skinPkgName, suffix);
97 | usePlugin = true;
98 | }
99 |
100 | private boolean validPluginParams(String skinPath, String skinPkgName)
101 | {
102 | if (TextUtils.isEmpty(skinPath) || TextUtils.isEmpty(skinPkgName))
103 | {
104 | return false;
105 | }
106 |
107 | File file = new File(skinPath);
108 | if (!file.exists())
109 | return false;
110 |
111 | PackageInfo info = getPackageInfo(skinPath);
112 | if (!info.packageName.equals(skinPkgName))
113 | return false;
114 | return true;
115 | }
116 |
117 | private void checkPluginParamsThrow(String skinPath, String skinPkgName)
118 | {
119 | if (!validPluginParams(skinPath, skinPkgName))
120 | {
121 | throw new IllegalArgumentException("skinPluginPath or skinPkgName not valid ! ");
122 | }
123 | }
124 |
125 |
126 | public void removeAnySkin()
127 | {
128 | L.e("removeAnySkin");
129 | clearPluginInfo();
130 | notifyChangedListeners();
131 | }
132 |
133 |
134 | public boolean needChangeSkin()
135 | {
136 | return usePlugin || !TextUtils.isEmpty(mSuffix);
137 | }
138 |
139 |
140 | public ResourceManager getResourceManager()
141 | {
142 | if (!usePlugin)
143 | {
144 | mResourceManager = new ResourceManager(mContext.getResources(), mContext.getPackageName(), mSuffix);
145 | }
146 | return mResourceManager;
147 | }
148 |
149 |
150 | /**
151 | * 应用内换肤,传入资源区别的后缀
152 | *
153 | * @param suffix
154 | */
155 | public void changeSkin(String suffix)
156 | {
157 | clearPluginInfo();//clear before
158 | mSuffix = suffix;
159 | mPrefUtils.putPluginSuffix(suffix);
160 | notifyChangedListeners();
161 | }
162 |
163 | private void clearPluginInfo()
164 | {
165 | mCurPluginPath = null;
166 | mCurPluginPkg = null;
167 | usePlugin = false;
168 | mSuffix = null;
169 | mPrefUtils.clear();
170 | }
171 |
172 | private void updatePluginInfo(String skinPluginPath, String pkgName, String suffix)
173 | {
174 | mPrefUtils.putPluginPath(skinPluginPath);
175 | mPrefUtils.putPluginPkg(pkgName);
176 | mPrefUtils.putPluginSuffix(suffix);
177 |
178 | mCurPluginPkg = pkgName;
179 | mCurPluginPath = skinPluginPath;
180 | mSuffix = suffix;
181 | }
182 |
183 |
184 | public void changeSkin(final String skinPluginPath, final String skinPluginPkg, ISkinChangingCallback callback)
185 | {
186 | changeSkin(skinPluginPath, skinPluginPkg, null, callback);
187 | }
188 |
189 |
190 | /**
191 | * 根据suffix选择插件内某套皮肤,默认为""
192 | *
193 | * @param skinPluginPath
194 | * @param skinPluginPkg
195 | * @param suffix
196 | * @param callback
197 | */
198 | public void changeSkin(final String skinPluginPath, final String skinPluginPkg, final String suffix, ISkinChangingCallback callback)
199 | {
200 | L.e("changeSkin = " + skinPluginPath + " , " + skinPluginPkg);
201 | if (callback == null)
202 | callback = ISkinChangingCallback.DEFAULT_SKIN_CHANGING_CALLBACK;
203 | final ISkinChangingCallback skinChangingCallback = callback;
204 |
205 | skinChangingCallback.onStart();
206 |
207 | try {
208 | checkPluginParamsThrow(skinPluginPath, skinPluginPkg);
209 | } catch (IllegalArgumentException e) {
210 | skinChangingCallback.onError(new RuntimeException("checkPlugin occur error"));
211 | return;
212 | }
213 |
214 | new AsyncTask()
215 | {
216 | @Override
217 | protected Integer doInBackground(Void... params)
218 | {
219 | try
220 | {
221 | loadPlugin(skinPluginPath, skinPluginPkg, suffix);
222 | return 1;
223 | } catch (Exception e)
224 | {
225 | e.printStackTrace();
226 | return 0;
227 | }
228 |
229 | }
230 |
231 | @Override
232 | protected void onPostExecute(Integer res)
233 | {
234 | if (res == 0)
235 | {
236 | skinChangingCallback.onError(new RuntimeException("loadPlugin occur error"));
237 | return;
238 | }
239 | try
240 | {
241 | updatePluginInfo(skinPluginPath, skinPluginPkg, suffix);
242 | notifyChangedListeners();
243 | skinChangingCallback.onComplete();
244 | } catch (Exception e)
245 | {
246 | e.printStackTrace();
247 | skinChangingCallback.onError(e);
248 | }
249 |
250 | }
251 | }.execute();
252 | }
253 |
254 |
255 | public void apply(Activity activity)
256 | {
257 | List skinViews = SkinAttrSupport.getSkinViews(activity);
258 | if (skinViews == null) return;
259 | for (SkinView skinView : skinViews)
260 | {
261 | skinView.apply();
262 | }
263 | }
264 |
265 | public void register(final Activity activity)
266 | {
267 | mActivities.add(activity);
268 |
269 | activity.findViewById(android.R.id.content).post(new Runnable()
270 | {
271 | @Override
272 | public void run()
273 | {
274 | apply(activity);
275 | }
276 | });
277 | }
278 |
279 | public void unregister(Activity activity)
280 | {
281 | mActivities.remove(activity);
282 | }
283 |
284 | public void notifyChangedListeners()
285 | {
286 |
287 | for (Activity activity : mActivities)
288 | {
289 | apply(activity);
290 | }
291 | }
292 |
293 | /**
294 | * apply for dynamic construct view
295 | *
296 | * @param view
297 | */
298 | public void injectSkin(View view)
299 | {
300 | List skinViews = new ArrayList();
301 | SkinAttrSupport.addSkinViews(view, skinViews);
302 | for (SkinView skinView : skinViews)
303 | {
304 | skinView.apply();
305 | }
306 | }
307 |
308 |
309 | }
310 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttr.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.attr;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by zhy on 15/9/22.
7 | */
8 | public class SkinAttr
9 | {
10 | public String resName;
11 | public SkinAttrType attrType;
12 |
13 |
14 | public SkinAttr(SkinAttrType attrType, String resName)
15 | {
16 | this.resName = resName;
17 | this.attrType = attrType;
18 | }
19 |
20 | public void apply(View view)
21 | {
22 | attrType.apply(view, resName);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttrSupport.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.attr;
2 |
3 | import android.app.Activity;
4 | import android.text.TextUtils;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.zhy.changeskin.R;
9 | import com.zhy.changeskin.constant.SkinConfig;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Created by zhy on 15/9/23.
16 | */
17 | public class SkinAttrSupport
18 | {
19 |
20 | private static SkinAttrType getSupportAttrType(String attrName)
21 | {
22 | for (SkinAttrType attrType : SkinAttrType.values())
23 | {
24 | if (attrType.getAttrType().equals(attrName))
25 | return attrType;
26 | }
27 | return null;
28 | }
29 |
30 | /**
31 | * 传入activity,找到content元素,递归遍历所有的子View,根据tag命名,记录需要换肤的View
32 | *
33 | * @param activity
34 | */
35 | public static List getSkinViews(Activity activity)
36 | {
37 | List skinViews = new ArrayList();
38 | ViewGroup content = (ViewGroup) activity.findViewById(android.R.id.content);
39 | addSkinViews(content, skinViews);
40 | return skinViews;
41 | }
42 |
43 | public static void addSkinViews(View view, List skinViews)
44 | {
45 | SkinView skinView = getSkinView(view);
46 | if (skinView != null) skinViews.add(skinView);
47 |
48 | if (view instanceof ViewGroup)
49 | {
50 | ViewGroup container = (ViewGroup) view;
51 |
52 | for (int i = 0, n = container.getChildCount(); i < n; i++)
53 | {
54 | View child = container.getChildAt(i);
55 | addSkinViews(child, skinViews);
56 | }
57 | }
58 |
59 | }
60 |
61 | public static SkinView getSkinView(View view)
62 | {
63 | Object tag = view.getTag(R.id.skin_tag_id);
64 | if (tag == null)
65 | {
66 | tag = view.getTag();
67 | }
68 | if (tag == null) return null;
69 | if (!(tag instanceof String)) return null;
70 | String tagStr = (String) tag;
71 |
72 | List skinAttrs = parseTag(tagStr);
73 | if (!skinAttrs.isEmpty())
74 | {
75 | changeViewTag(view);
76 | return new SkinView(view, skinAttrs);
77 | }
78 | return null;
79 | }
80 |
81 | private static void changeViewTag(View view)
82 | {
83 | Object tag = view.getTag(R.id.skin_tag_id);
84 | if(tag == null )
85 | {
86 | tag = view.getTag();
87 | view.setTag(R.id.skin_tag_id, tag);
88 | view.setTag(null);
89 | }
90 | }
91 |
92 | //skin:left_menu_icon:src|skin:color_red:textColor
93 | private static List parseTag(String tagStr)
94 | {
95 | List skinAttrs = new ArrayList();
96 | if (TextUtils.isEmpty(tagStr)) return skinAttrs;
97 |
98 | String[] items = tagStr.split("[|]");
99 | for (String item : items)
100 | {
101 | if (!item.startsWith(SkinConfig.SKIN_PREFIX))
102 | continue;
103 | String[] resItems = item.split(":");
104 | if (resItems.length != 3)
105 | continue;
106 |
107 | String resName = resItems[1];
108 | String resType = resItems[2];
109 |
110 | SkinAttrType attrType = getSupportAttrType(resType);
111 | if (attrType == null) continue;
112 | SkinAttr attr = new SkinAttr(attrType, resName);
113 | skinAttrs.add(attr);
114 | }
115 | return skinAttrs;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/attr/SkinAttrType.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.attr;
2 |
3 | import android.content.res.ColorStateList;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 | import android.widget.ImageView;
7 | import android.widget.TextView;
8 |
9 | import com.zhy.changeskin.ResourceManager;
10 | import com.zhy.changeskin.SkinManager;
11 |
12 |
13 | /**
14 | * Created by zhy on 15/9/28.
15 | */
16 | public enum SkinAttrType
17 | {
18 | BACKGROUND("background")
19 | {
20 | @Override
21 | public void apply(View view, String resName)
22 | {
23 | Drawable drawable = getResourceManager().getDrawableByName(resName);
24 | if (drawable != null)
25 | {
26 | view.setBackgroundDrawable(drawable);
27 | } else
28 | {
29 | try{
30 | int color = getResourceManager().getColor(resName);
31 | view.setBackgroundColor(color);
32 | } catch (Resources.NotFoundException ex) {
33 | ex.printStackTrace();
34 | }
35 | }
36 | }
37 | }, COLOR("textColor")
38 | {
39 | @Override
40 | public void apply(View view, String resName)
41 | {
42 | ColorStateList colorList = getResourceManager().getColorStateList(resName);
43 | if (colorList == null) return;
44 | ((TextView) view).setTextColor(colorList);
45 | }
46 | }, SRC("src")
47 | {
48 | @Override
49 | public void apply(View view, String resName)
50 | {
51 | if (view instanceof ImageView)
52 | {
53 | Drawable drawable = getResourceManager().getDrawableByName(resName);
54 | if (drawable == null) return;
55 | ((ImageView) view).setImageDrawable(drawable);
56 | }
57 |
58 | }
59 | }, DIVIDER("divider")
60 | {
61 | @Override
62 | public void apply(View view, String resName) {
63 | if (view instanceof ListView) {
64 | Drawable divider = getResourceManager().getDrawableByName(resName);
65 | if (divider == null) return;
66 | ((ListView) view).setDivider(divider);
67 | }
68 | }
69 | };
70 |
71 | String attrType;
72 |
73 | SkinAttrType(String attrType)
74 | {
75 | this.attrType = attrType;
76 | }
77 |
78 | public String getAttrType()
79 | {
80 | return attrType;
81 | }
82 |
83 |
84 | public abstract void apply(View view, String resName);
85 |
86 | public ResourceManager getResourceManager()
87 | {
88 | return SkinManager.getInstance().getResourceManager();
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/attr/SkinView.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.attr;
2 |
3 | import android.view.View;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by zhy on 15/9/22.
9 | */
10 | public class SkinView
11 | {
12 | // SoftReference viewRef;
13 | public View view ;
14 | public List attrs;
15 |
16 | public SkinView(View view, List skinAttrs)
17 | {
18 | this.view = view;
19 | this.attrs = skinAttrs;
20 | }
21 |
22 | public void apply()
23 | {
24 | // View view = viewRef.get();
25 | if (view == null) return;
26 |
27 | for (SkinAttr attr : attrs)
28 | {
29 | attr.apply(view);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/callback/ISkinChangedListener.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.callback;
2 |
3 | /**
4 | * Created by zhy on 15/9/22.
5 | */
6 | public interface ISkinChangedListener
7 | {
8 | void onSkinChanged();
9 | }
10 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/callback/ISkinChangingCallback.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.callback;
2 |
3 | /**
4 | * Created by zhy on 15/9/22.
5 | */
6 | public interface ISkinChangingCallback
7 | {
8 | void onStart();
9 |
10 | void onError(Exception e);
11 |
12 | void onComplete();
13 |
14 | public static DefaultSkinChangingCallback DEFAULT_SKIN_CHANGING_CALLBACK = new DefaultSkinChangingCallback();
15 |
16 | public class DefaultSkinChangingCallback implements ISkinChangingCallback
17 | {
18 | @Override
19 | public void onStart()
20 | {
21 |
22 | }
23 |
24 | @Override
25 | public void onError(Exception e)
26 | {
27 |
28 | }
29 |
30 | @Override
31 | public void onComplete()
32 | {
33 |
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/constant/SkinConfig.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.constant;
2 |
3 | /**
4 | * Created by zhy on 15/9/22.
5 | */
6 | public class SkinConfig
7 | {
8 | public static final String PREF_NAME = "skin_plugin_pref";
9 | public static final String KEY_PLUGIN_PATH = "key_plugin_path";
10 | public static final String KEY_PLUGIN_PKG = "key_plugin_pkg";
11 | public static final String KEY_PLUGIN_SUFFIX = "key_plugin_suffix";
12 |
13 | public static final String SKIN_PREFIX ="skin:";
14 |
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/utils/L.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.utils;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by zhy on 15/9/23.
7 | */
8 | public class L
9 | {
10 | private static final String TAG = "Skin";
11 | private static boolean debug = true;
12 |
13 | public static void e(String msg)
14 | {
15 | if (debug)
16 | Log.e(TAG, msg);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/changeskin/src/main/java/com/zhy/changeskin/utils/PrefUtils.java:
--------------------------------------------------------------------------------
1 | package com.zhy.changeskin.utils;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | import com.zhy.changeskin.constant.SkinConfig;
7 |
8 |
9 | /**
10 | * Created by zhy on 15/9/22.
11 | */
12 | public class PrefUtils
13 | {
14 | private Context mContext;
15 |
16 | public PrefUtils(Context context)
17 | {
18 | this.mContext = context;
19 | }
20 |
21 | public String getPluginPath()
22 | {
23 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
24 | return sp.getString(SkinConfig.KEY_PLUGIN_PATH, "");
25 | }
26 |
27 | public String getSuffix()
28 | {
29 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
30 | return sp.getString(SkinConfig.KEY_PLUGIN_SUFFIX, "");
31 | }
32 |
33 | public boolean clear()
34 | {
35 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
36 | return sp.edit().clear().commit();
37 | }
38 |
39 | public void putPluginPath(String path)
40 | {
41 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
42 | sp.edit().putString(SkinConfig.KEY_PLUGIN_PATH, path).apply();
43 | }
44 |
45 | public void putPluginPkg(String pkgName)
46 | {
47 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
48 | sp.edit().putString(SkinConfig.KEY_PLUGIN_PKG, pkgName).apply();
49 | }
50 |
51 | public String getPluginPkgName()
52 | {
53 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
54 | return sp.getString(SkinConfig.KEY_PLUGIN_PKG, "");
55 | }
56 |
57 | public void putPluginSuffix(String suffix)
58 | {
59 | SharedPreferences sp = mContext.getSharedPreferences(SkinConfig.PREF_NAME, Context.MODE_PRIVATE);
60 | sp.edit().putString(SkinConfig.KEY_PLUGIN_SUFFIX, suffix).apply();
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/changeskin/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/changeskin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | changeSkin
3 |
4 |
--------------------------------------------------------------------------------
/changeskin_sc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/changeskin_sc.gif
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | *Bak
6 | *BAK
7 | .DS_Store
8 | /build
9 | /captures
10 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 29 00:03:44 GMT+08:00 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/night_plugin.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/night_plugin.apk
--------------------------------------------------------------------------------
/npm-debug.log:
--------------------------------------------------------------------------------
1 | 0 info it worked if it ends with ok
2 | 1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', '-g', 'reaact-tools' ]
3 | 2 info using npm@2.11.3
4 | 3 info using node@v0.12.7
5 | 4 verbose install initial load of /usr/local/lib/package.json
6 | 5 verbose readDependencies loading dependencies from /usr/local/lib/package.json
7 | 6 silly cache add args [ 'reaact-tools', null ]
8 | 7 verbose cache add spec reaact-tools
9 | 8 silly cache add parsed spec { raw: 'reaact-tools',
10 | 8 silly cache add scope: null,
11 | 8 silly cache add name: 'reaact-tools',
12 | 8 silly cache add rawSpec: '',
13 | 8 silly cache add spec: '*',
14 | 8 silly cache add type: 'range' }
15 | 9 silly addNamed reaact-tools@*
16 | 10 verbose addNamed "*" is a valid semver range for reaact-tools
17 | 11 silly addNameRange { name: 'reaact-tools', range: '*', hasData: false }
18 | 12 silly mapToRegistry name reaact-tools
19 | 13 silly mapToRegistry using default registry
20 | 14 silly mapToRegistry registry https://registry.npmjs.org/
21 | 15 silly mapToRegistry uri https://registry.npmjs.org/reaact-tools
22 | 16 verbose addNameRange registry:https://registry.npmjs.org/reaact-tools not in flight; fetching
23 | 17 verbose request uri https://registry.npmjs.org/reaact-tools
24 | 18 verbose request no auth needed
25 | 19 info attempt registry request try #1 at 21:40:36
26 | 20 verbose request id 7ad24e8e432ba427
27 | 21 http request GET https://registry.npmjs.org/reaact-tools
28 | 22 http 404 https://registry.npmjs.org/reaact-tools
29 | 23 verbose headers { 'content-type': 'application/json',
30 | 23 verbose headers 'cache-control': 'max-age=0',
31 | 23 verbose headers 'content-length': '2',
32 | 23 verbose headers 'accept-ranges': 'bytes',
33 | 23 verbose headers date: 'Wed, 04 Nov 2015 13:40:39 GMT',
34 | 23 verbose headers via: '1.1 varnish',
35 | 23 verbose headers age: '0',
36 | 23 verbose headers connection: 'keep-alive',
37 | 23 verbose headers 'x-served-by': 'cache-hkg6825-HKG',
38 | 23 verbose headers 'x-cache': 'MISS',
39 | 23 verbose headers 'x-cache-hits': '0',
40 | 23 verbose headers 'x-timer': 'S1446644438.458475,VS0,VE948' }
41 | 24 silly get cb [ 404,
42 | 24 silly get { 'content-type': 'application/json',
43 | 24 silly get 'cache-control': 'max-age=0',
44 | 24 silly get 'content-length': '2',
45 | 24 silly get 'accept-ranges': 'bytes',
46 | 24 silly get date: 'Wed, 04 Nov 2015 13:40:39 GMT',
47 | 24 silly get via: '1.1 varnish',
48 | 24 silly get age: '0',
49 | 24 silly get connection: 'keep-alive',
50 | 24 silly get 'x-served-by': 'cache-hkg6825-HKG',
51 | 24 silly get 'x-cache': 'MISS',
52 | 24 silly get 'x-cache-hits': '0',
53 | 24 silly get 'x-timer': 'S1446644438.458475,VS0,VE948' } ]
54 | 25 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/reaact-tools
55 | 25 verbose stack at CachingRegistryClient. (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:239:14)
56 | 25 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:170:14)
57 | 25 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:354:22)
58 | 25 verbose stack at Request.emit (events.js:110:17)
59 | 25 verbose stack at Request. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1207:14)
60 | 25 verbose stack at Request.emit (events.js:129:20)
61 | 25 verbose stack at IncomingMessage. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1153:12)
62 | 25 verbose stack at IncomingMessage.emit (events.js:129:20)
63 | 25 verbose stack at _stream_readable.js:908:16
64 | 25 verbose stack at process._tickCallback (node.js:355:11)
65 | 26 verbose statusCode 404
66 | 27 verbose pkgid reaact-tools
67 | 28 verbose cwd /Users/zhy/github_repository/mine/skin/ChangeSkin
68 | 29 error Darwin 14.1.0
69 | 30 error argv "node" "/usr/local/bin/npm" "install" "-g" "reaact-tools"
70 | 31 error node v0.12.7
71 | 32 error npm v2.11.3
72 | 33 error code E404
73 | 34 error 404 Registry returned 404 for GET on https://registry.npmjs.org/reaact-tools
74 | 34 error 404
75 | 34 error 404 'reaact-tools' is not in the npm registry.
76 | 34 error 404 You should bug the author to publish it (or use the name yourself!)
77 | 34 error 404
78 | 34 error 404 Note that you can also install from a
79 | 34 error 404 tarball, folder, http url, or git url.
80 | 35 verbose exit [ 1, true ]
81 |
--------------------------------------------------------------------------------
/plugin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/plugin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.0 rc3"
6 |
7 | defaultConfig {
8 | applicationId "com.zhy.plugin"
9 | minSdkVersion 10
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:appcompat-v7:23.0.1'
25 | }
26 |
--------------------------------------------------------------------------------
/plugin/plugin.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/plugin/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/zhy/android/sdk/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/plugin/src/androidTest/java/com/zhy/plugin/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zhy.plugin;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase
10 | {
11 | public ApplicationTest()
12 | {
13 | super(Application.class);
14 | }
15 | }
--------------------------------------------------------------------------------
/plugin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/plugin/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/plugin/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/plugin/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/plugin/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/plugin/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | plugin
3 |
4 |
--------------------------------------------------------------------------------
/plugin/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':changeskin'
2 |
--------------------------------------------------------------------------------
/skin_plugin.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongyangAndroid/AndroidChangeSkin/002a464df30d3da95bb2ce147b500c50d6ca4487/skin_plugin.apk
--------------------------------------------------------------------------------