[Android Themes] AChep:
​

Features:

1. Move statusbar clock to center (need report!)

2. In development... :)

Manual:

1. Download latest version of tool

2. Unpack files

3. Copy SystemUI.apk to res\app\

4. Run statusbar.exe

5. Install update.zip using CWM Recovery

Source code:

program achep_statusbar;
var build,version,p1,p2,i,n,next{используется для ответов на вопросы}:integer;
cache:string;
source,id,name:array [1..10000] of string;
fb,bat,log,clock:text;
ex:boolean;
label labl;
begin

version:=1;

assign(fb,'build.txt');
append(fb);
writeln(fb,'+1');
close(fb);
reset(fb);
while not eof(fb) do begin
readln(fb);
build:=build+1;
end;
close(fb);

writeln('AChep');
writeln('Statusbar clock');

///версия
str(version,cache);
for i:=1 to 3-length(cache) do write('0');
write(version,'-build-');
str(build,cache);
for i:=1 to 3-length(cache) do write('0');
writeln(build);

///Спрашивалка
writeln('');
writeln('Info: Move your statusbar clock to center');
labl:
writeln(' 1. I have some questions...');
writeln(' 2. Lets go!');
repeat
write('Make your decision: ');
readln(next);
until (next=1) or (next=2);

///доп инфа))
if next=1 then begin
Writeln('');
Writeln('Дополнительная информация о использовании:');
Writeln(' 1. Возврат часов в правую часть экрана пока не поддерживается');
Writeln(' 2. После окончания вы должны самостоятельно установить update.zip через CWM Recovery');
Writeln(' 3. Вы должны скопировать SystemUI.apk в папку *res\app\ перед началом работы');
Writeln(' 4. Поддерживается только деодексированные прошивки');
writeln('Для продолжения нажмите Enter...');
readln();
writeln('');
writeln('');
goto labl;
end;

writeln('- - - - - - - - - - - - - - -');
write('Search resources... ');
if FileExists('res\app\SystemUI.apk')<>true then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: File *res\app\SystemUI.apk missed!');
readln();
exit;
end else writeln('Done!');

write('Creating bat script... ');
assign(bat,'statusbar-d.bat');
rewrite(bat);
writeln(bat,'@ECHO OFF');
writeln(bat,'cd /d "%~dp0tools\"');
writeln(bat,'rmdir "%~dp0res\app\SystemUI" /q /s');
writeln(bat,'java -jar "apktool.jar" d "%~dp0res\app\SystemUI.apk" "%~dp0res\app\SystemUI"');
writeln(bat,'if errorlevel 1 goto end');
writeln(bat,'goto continue');
writeln(bat,':end');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo FATAL ERROR: Error when decompiling *res\app\SystemUI.apk!');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo false > log.txt');
writeln(bat,'goto exit');
writeln(bat,':continue');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo Congratulations! All done perfect.');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo true > log.txt');
writeln(bat,':exit');
writeln(bat,'pause');
close(bat);
writeln('Done!');

writeln('Script runnign... ');
writeln('- - - - - - - - - - - - - - -');
exec('statusbar-d.bat');
write('When script will be done - press Enter...');
readln();
writeln('- - - - - - - - - - - - - - -');

write('Testing the script work... ');
if FileExists('log.txt')=true then begin
assign(log,'log.txt');
reset(log);
readln(log,cache);
close(log);
if (cache='false ') or (cache<>'true ') then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Error when decompiling *res\app\SystemUI.apk!');
readln();
exit;
end;
writeln('Done');
end else begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Bat script was force close!');
readln();
exit;
end;

write('Search resources... ');
if FileExists('res\app\SystemUI\res\layout\status_bar.xml')<>true then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: File *res\app\SystemUI\res\layout\status_bar.xml missed!');
readln();
exit;
end else writeln('Done!');

write('Processing .XMLs... ');
assign(clock,'res\app\SystemUI\res\layout\status_bar.xml');
reset(clock);
i:=0;
while not eof(clock) do begin
readln(clock,cache);
while cache='' do begin
readln(clock,cache);
if Eof(clock)=true then begin
ex:=true;
break;
end;
end;
if ex=true then break;

i:=i+1;
///source
source[i]:=cache;

while cache[1]=' ' do cache:=copy(cache,2,length(cache));
while cache[length(cache)]=' ' do cache:=copy(cache,1,length(cache)-1);

///id
p1:=pos('android:id="',cache)+12;
id[i]:=copy(cache,p1,length(cache));
p2:=pos('" ',id[i])-1;
id[i]:=copy(id[i],1,p2);
if p1=12 then id[i]:='';

///name
p1:=pos('<',cache)+1;
p2:=pos(' ',cache)-1;
name[i]:=copy(cache,p1,p2-1);
end;
n:=i;
writeln('Done!');
close(clock);

write('Editing .XMLs... ');
ex:=false;
assign(clock,'statusbar.xml');
rewrite(clock);
for i:=1 to n do begin
if (name[i]<>'com.android.systemui.statusbar.Clock') then writeln(clock,source[i]);
if (name[i+1]='LinearLayout') and (id[i+1]='@id/icons') then begin
writeln(clock,' <LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">');
writeln(clock,' <com.android.systemui.statusbar.Clock android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:gravity="center" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" />');
writeln(clock,' </LinearLayout>');
end;
end;
close(clock);
writeln('Done!');

write('Creating bat script... ');
assign(bat,'statusbar-b.bat');
rewrite(bat);
writeln(bat,'@ECHO OFF');
writeln(bat,'cd /d "%~dp0tools\"');
writeln(bat,'java -jar "apktool.jar" b "%~dp0res\app\SystemUI"');
writeln(bat,'if errorlevel 1 goto end1');
writeln(bat,'goto continue1');
writeln(bat,':end1');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo FATAL ERROR: Error when compiling *res\app\SystemUI.apk!');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo false1 > log.txt');
writeln(bat,'goto exit');
writeln(bat,':continue1');
writeln(bat,'7za a -tzip "%~dp0res\app\SystemUI\dist\SystemUI.apk" "%~dp0res\app\SystemUI\build\apk\resources.arsc" -mx=0');
writeln(bat,'if errorlevel 1 goto end2');
writeln(bat,'goto continue2');
writeln(bat,':end2');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo FATAL ERROR: Error when adding resources.arsc to *res\app\SystemUI.apk!');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo false2 > log.txt');
writeln(bat,'goto exit');
writeln(bat,':continue2');
writeln(bat,'del "%~dp0update-centerclock-patch.zip"');
writeln(bat,'copy "%~dp0tools\update-cwmrecovery.zip" "%~dp0update-centerclock-patch.zip"');
writeln(bat,'if errorlevel 1 goto end3');
writeln(bat,'goto continue3');
writeln(bat,':end3');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo FATAL ERROR: Error when copying *tools\update-cwmrecovery.zip');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo false3 > log.txt');
writeln(bat,'goto exit');
writeln(bat,':continue3');
writeln(bat,'rmdir "%~dp0tools\update\system" /q /s');
writeln(bat,'mkdir "%~dp0tools\update\system" /s ');
writeln(bat,'mkdir "%~dp0tools\update\system\app" /s ');
writeln(bat,'copy "%~dp0res\app\SystemUI\dist\SystemUI.apk" "%~dp0tools\update\system\app\"');
writeln(bat,'if errorlevel 1 goto end4');
writeln(bat,'goto continue4');
writeln(bat,':end4');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo FATAL ERROR: Error when creating update-centerclock-patch.zip');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo false4 > log.txt');
writeln(bat,'goto exit');
writeln(bat,':continue4');
writeln(bat,'7za a -tzip "%~dp0update-centerclock-patch.zip" "%~dp0tools\update\system"');
writeln(bat,'echo.');
writeln(bat,'echo.');
writeln(bat,'echo Congratulations! All done perfect.');
writeln(bat,'cd /d "%~dp0"');
writeln(bat,'echo true > log.txt');
writeln(bat,':exit');
writeln(bat,'pause');
close(bat);
writeln('Done!');

writeln('Script runnign... ');
writeln('- - - - - - - - - - - - - - -');
exec('statusbar-b.bat');
write('When script will be done - press Enter...');
readln();
writeln('- - - - - - - - - - - - - - -');

write('Testing the script work... ');
if FileExists('log.txt')=true then begin
assign(log,'log.txt');
reset(log);
readln(log,cache);
close(log);
if (cache='false1 ') then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Error when compiling *res\app\SystemUI.apk!');
readln();
exit;
end else begin
if (cache='false2 ') then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Error when adding resources.arsc to *res\app\SystemUI.apk!');
readln();
exit;
end else begin
if (cache='false3 ') then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Error when copying *tools\update-cwmrecovery.zip');
readln();
exit;
end else begin
if (cache='false4 ') then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Error when creating update-centerclock-patch.zip');
readln();
exit;
end else begin
if cache<>'true ' then begin
writeln('');
writeln('');
writeln('');
writeln('FATAL ERROR: Bat script was force close!');
end else begin
writeln('Done');
writeln('');
writeln('');
writeln('Congratulations! All done perfect.');
writeln('');
writeln('Install update-centerclock-patch.zip using CWM Recovery');
readln();
exit;
end;
end;
end;
end;
end;
end;

end.