Skip to content

Commit 51bbe14

Browse files
committed
加入UnicodeEmjoi模块
1 parent 170afac commit 51bbe14

903 files changed

Lines changed: 889 additions & 261 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/codeStyles/Project.xml

Lines changed: 112 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ dependencies {
6464
implementation project(':simpleskin-core')
6565
// implementation project(':hideapiuse')
6666

67+
implementation project(":unicode_emoji")
68+
6769
compileOnly files('libs/rt.jar')
6870

6971
}
@@ -123,9 +125,13 @@ def copyMappingTask = task copyMapping(type: Copy) {
123125

124126

125127
afterEvaluate {
128+
126129
tasks.findAll {
127130
it.name.startsWith("resguard") && it.name.endsWith("Release")
128131
}.each {
132+
it.doFirst {
133+
134+
}
129135
it.dependsOn copyMappingTask
130136
}
131137
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package cn.fxlcy.simpleskin
22

33
import android.app.Application
4+
import cn.fxlcy.libs.unicode_emoji.UnicodeEmoji
45

56
class App : Application() {
67

78
override fun onCreate() {
89
super.onCreate()
910

1011
SkinManager.getInstance().init(this)
12+
13+
UnicodeEmoji.getInstance().init(this)
1114
}
1215
}
Lines changed: 2 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
package cn.fxlcy.simpleskin.test;
22

3-
import android.content.res.Resources;
43
import android.os.Bundle;
54
import android.support.v7.app.AppCompatActivity;
6-
import android.util.Log;
7-
import android.view.View;
85

6+
import cn.fxlcy.libs.unicode_emoji.UnicodeEmoji;
97
import cn.fxlcy.simpleskin.R;
10-
import cn.fxlcy.simpleskin.SkinApplicator;
11-
import cn.fxlcy.simpleskin.SkinManager;
12-
import cn.fxlcy.simpleskin.SkinResources;
13-
import cn.fxlcy.simpleskin.ViewType;
148

159

1610
public class MainActivity extends AppCompatActivity {
@@ -20,126 +14,10 @@ public class MainActivity extends AppCompatActivity {
2014

2115
@Override
2216
protected void onCreate(Bundle savedInstanceState) {
23-
/*
24-
final Context context = new ViewStubContext(this);
25-
final LayoutInflater inflater = LayoutInflater.from(this).cloneInContext(context);
26-
LayoutInflaterCompat.setFactory2(inflater, new ViewStubInflater(this));
27-
*/
28-
29-
SkinManager.SkinConfig config = SkinManager.SkinConfig.obtain(this
30-
, new SkinManager.OnSkinConfigInitializer() {
31-
@Override
32-
public SkinManager.SkinConfig init(SkinManager.SkinConfig skinConfig) {
33-
skinConfig.registerSkinApplicator(new ViewType<View>(View.class, true), new SkinApplicator<View>() {
34-
@Override
35-
protected int[] attrIds() {
36-
return new int[]{};
37-
}
38-
39-
@Override
40-
protected void apply(final View view, final SkinResources resources, Resources.Theme theme, int attrId, final int value) {
41-
switch (attrId) {
42-
case android.R.attr.layout_width:
43-
view.post(new Runnable() {
44-
@Override
45-
public void run() {
46-
view.getLayoutParams().width = resources.getDimensionPixelSize(value);
47-
view.requestLayout();
48-
}
49-
});
50-
break;
51-
case android.R.attr.layout_height:
52-
view.post(new Runnable() {
53-
@Override
54-
public void run() {
55-
view.getLayoutParams().width = resources.getDimensionPixelSize(value);
56-
view.requestLayout();
57-
}
58-
});
59-
break;
60-
}
61-
}
62-
});
63-
64-
return skinConfig;
65-
}
66-
});
67-
68-
SkinManager.getInstance().installViewFactory(this, config);
17+
UnicodeEmoji.getInstance().replace(this);
6918
super.onCreate(savedInstanceState);
7019

71-
Log.i(TAG, String.valueOf(System.currentTimeMillis()));
72-
7320
setContentView(R.layout.activity_main);
74-
75-
Log.i(TAG, String.valueOf(System.currentTimeMillis()));
76-
77-
/* ZipInputStream zis = null;
78-
InputStream is = null;
79-
80-
List<DexFile> dexFileList = new ArrayList<>();
81-
82-
try {
83-
is = getAssets().open("fix/fix.dex");
84-
zis = new ZipInputStream(is);
85-
86-
ZipEntry zipEntry;
87-
byte[] bytes = new byte[1024 * 1000 * 10];
88-
int readLength;
89-
90-
while ((zipEntry = zis.getNextEntry()) != null) {
91-
final String name = zipEntry.getName();
92-
if (name.startsWith("classes") && name.endsWith(".dex")) {
93-
ByteArrayOutputStream byteArrayOutputStream
94-
= new ByteArrayOutputStream();
95-
96-
while ((readLength = zis.read(bytes, 0, bytes.length)) != -1) {
97-
byteArrayOutputStream.write(bytes, 0, readLength);
98-
}
99-
100-
byteArrayOutputStream.close();
101-
102-
DexFile dexFile = DexFileCompat.loadDexFile(ByteBuffer.wrap(byteArrayOutputStream
103-
.toByteArray()));
104-
105-
dexFileList.add(dexFile);
106-
}
107-
}
108-
} catch (Throwable e) {
109-
e.printStackTrace();
110-
} finally {
111-
if (zis != null) {
112-
try {
113-
zis.close();
114-
} catch (IOException e) {
115-
e.printStackTrace();
116-
}
117-
}
118-
119-
if (is != null) {
120-
try {
121-
is.close();
122-
} catch (IOException e) {
123-
e.printStackTrace();
124-
}
125-
}
126-
}
127-
128-
129-
for (DexFile dexFile : dexFileList) {
130-
Class clazz = dexFile.loadClass("cn.fxlcy.fix.TestFix", getClassLoader());
131-
132-
133-
Log.i(TAG,clazz.getName());
134-
}*/
13521
}
13622

137-
138-
public void onClick(View view) {
139-
if (view.getId() == R.id.btn_change_skin) {
140-
SkinManager.getInstance().switchSkinByAssets(this, "skin/skin1.skin", null);
141-
} else if (view.getId() == R.id.btn_restore_skin) {
142-
SkinManager.getInstance().restoreSkin(this);
143-
}
144-
}
14523
}

0 commit comments

Comments
 (0)