-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcustomize_miui_app.sh
executable file
·313 lines (265 loc) · 7.3 KB
/
customize_miui_app.sh
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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#!/bin/bash
#
# $1: dir for original miui app
# $2: dir for target miui app
#
XMLMERGYTOOL=$PORT_ROOT/tools/ResValuesModify/jar/ResValuesModify
pl=$PORT_ROOT/miuipolska/Polish/main
GIT_APPLY=$PORT_ROOT/tools/git.apply
curdir=`pwd`
function appendPart() {
for file in `find $1/smali -name *.part`
do
filepath=`dirname $file`
filename=`basename $file .part`
dstfile="out/$filepath/$filename"
cat $file >> $dstfile
done
}
function addPolish() {
for file in `find $pl -name $1.apk`
do
cp -u -r $file/* out/$1
find out/$1/res -name "drawable-pl-hdpi" | xargs rm -rf
find out/$1/res -name "drawable-pl-xxhdpi" | xargs rm -rf
done
}
if [ $1 = "AntiSpam" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Backup" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Browser" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "BugReport" ];then
addPolish $1
sed -i -e 's/<category android:name=\"android.intent.category.LAUNCHER\" \/>/<!--category android:name=\"android.intent.category.LAUNCHER\" \/-->/' out/$1/AndroidManifest.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Calculator" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Calendar" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "CalendarProvider" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "CloudService" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Contacts" ];then
addPolish $1
sed -i -e 's/<item android:id=\"@id\/menu_yellowpage_order\" android:title=\"@string\/yellowpage_navigation_menu_order\" \/>/<!--item android:id=\"@id\/menu_yellowpage_order\" android:title=\"@string\/yellowpage_navigation_menu_order\" \/-->/' out/$1/res/menu/people_options.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "ContactsProvider" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "DeskClock" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "DownloadProvider" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "DownloadProviderUi" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Email" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "FileExplorer" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "MiuiCompass" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "MiuiGallery" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "MiuiHome" ];then
addPolish $1
sed -i -e 's/<item>4x5<\/item>/<item>4x5<\/item>\
<item>5x5<\/item>/' out/$1/res/values/arrays.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "MiuiSystemUI" ];then
cp $1/*.part out/
cd out
$GIT_APPLY MiuiSystemUI.part
cd ..
for file in `find $2 -name *.rej`
do
echo "Fatal error: MiuiSystemUI patch fail"
exit 1
done
addPolish $1
sed -i -e 's/>Układ ikon/>Układ ikon i navbar/' out/$1/res/values-pl/strings.xml
$XMLMERGYTOOL $1/res/values $2/res/values
$XMLMERGYTOOL $1/res/values-xhdpi $2/res/values-xhdpi
appendPart $1
fi
if [ $1 = "MiuiVideo" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "MiWallpaper" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Mms" ];then
# cp $1/*.part out/
# cd out
# $GIT_APPLY Mms.part
# cd ..
# for file in `find $2 -name *.rej`
# do
# echo "Fatal error: Mms patch fail"
# exit 1
# done
#
addPolish $1
sed -i -e 's/android:screenOrientation=\"portrait\" //' out/$1/AndroidManifest.xml
sed -i -e 's/ android:screenOrientation=\"portrait\"//' out/$1/AndroidManifest.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Music" ];then
addPolish $1
sed -i 's#@string/app_class#com.miui.player.Application#g' out/$1/AndroidManifest.xml
sed -i -e 's/\"no_effect\">Wyłączone/\"no_effect\">ViPER FX/' out/$1/res/values-pl/strings.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "NetworkAssistant2" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Notes" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "PackageInstaller" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "PaymentService" ];then
addPolish $1
sed -i -e 's/<category android:name=\"android.intent.category.LAUNCHER\" \/>/<!--category android:name=\"android.intent.category.LAUNCHER\" \/-->/' out/$1/AndroidManifest.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Phone" ];then
# cp $1/*.part out/
# cd out
# $GIT_APPLY Phone.part
# cd ..
# for file in `find $2 -name *.rej`
# do
# echo "Fatal error: Phone patch fail"
# exit 1
# done
#
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
appendPart $1
fi
if [ $1 = "Provision" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "QuickSearchBox" ];then
cp $1/*.part out/
cd out
$GIT_APPLY QuickSearchBox.part
cd ..
for file in `find $2 -name *.rej`
do
echo "Fatal error: QuickSearchBox patch fail"
exit 1
done
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Settings" ];then
cp $1/*.part out/
cd out
$GIT_APPLY Settings.part
cd ..
for file in `find $2 -name *.rej`
do
echo "Fatal error: Settings patch fail"
exit 1
done
addPolish $1
sed -i -e 's/<item>Nie usypiaj<\/item>/<!--item>Nie usypiaj<\/item-->/' out/$1/res/values-pl/arrays.xml
sed -i -e 's/>Szybkie zdjęcie/>Wstecz to skrót aparatu/' out/$1/res/values-pl/strings.xml
sed -i -e 's/>Wyłącz okno Zasilania/>Wyłącz okno zasilania/' out/$1/res/values-pl/strings.xml
cp -f $1/res/drawable-en-xhdpi/miui_logo.png out/$1/res/drawable-pl-xhdpi/miui_logo.png
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "SoundRecorder" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "TelephonyProvider" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "ThemeManager" ];then
cp $1/*.part out/
cd out
$GIT_APPLY ThemeManager.part
cd ..
for file in `find $2 -name *.rej`
do
echo "Fatal error: Phone patch fail"
exit 1
done
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Transfer" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Updater" ];then
addPolish $1
cp -f $1/res/drawable-en-xhdpi/miui_title.png out/$1/res/drawable-pl-xhdpi/miui_title.png
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "VpnDialogs" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "Weather" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "WeatherProvider" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "XiaomiServiceFramework" ];then
addPolish $1
sed -i -e 's/<category android:name=\"android.intent.category.LAUNCHER\" \/>/<!--category android:name=\"android.intent.category.LAUNCHER\" \/-->/' out/$1/AndroidManifest.xml
$XMLMERGYTOOL $1/res/values $2/res/values
fi
if [ $1 = "YellowPage" ];then
addPolish $1
$XMLMERGYTOOL $1/res/values $2/res/values
fi