[GUIDE][05 AUG] How To Make Lock Screen Clock Allign To Center in Jellybean and ICS

Search This thread

blindndumb

Senior Member
Sep 3, 2011
1,097
4,945
ABOUT :
This is a easy guide which will teach you how to make the Lockscreen Clock Allign To Center

SCREENSHOT :

attachment.php

STEPS :
1. Extract the "framework-res.apk" from ROM
2. Decompile it using apktool
3. Browse To "\res\values" and open dimens.xml
4. Find These Lines
Code:
<dimen name="keyguard_lockscreen_clock_font_size">80.0dip</dimen>
<dimen name="keyguard_lockscreen_status_line_font_size">14.0dip</dimen>
<dimen name="keyguard_lockscreen_status_line_font_right_margin">42.0dip</dimen><dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen>
<dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen>
<dimen name="keyguard_lockscreen_pin_margin_left">40.0dip</dimen>

5. You basically need to edit

<dimen name="keyguard_lockscreen_status_line_font_right_margin">52.0dip</dimen> - Necessary ( Sets Margin from Right which basically alligns to center )
<dimen name="keyguard_lockscreen_clock_font_size">85.0dip</dimen> - Not Necessary ( Sets the font size of clock time display)
<dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen> - Not Necessary ( Sets Margin From Top )
<dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen> - Not Necessary ( Sets Margin From Bottom )

6. Assuming that you have a WVGA device. Without a thought do this
Code:
<dimen name="keyguard_lockscreen_status_line_font_right_margin">[B]52.0dip[/B]</dimen>
<dimen name="keyguard_lockscreen_clock_font_size">[B]85.0dip[/B]</dimen>

What I did is changed the font size to 85 dip and right margin to 52 dip. You can see the result in screenshot above

7. If you have a device with different resolution. You need to do some experiment on your own by changing margin to allign it in center.
I will suggest to keep the right allign to 54-56 dip and font size 82 dip for devices with higher resolution above 480*800

8. Thats All.. If you want too change layout to bottom or extreme top..Change te dip values for top and bottom margin

For more tutorials and guides visit - www.blindndumb.com
Cheers :)
 
Last edited:

Magnumutz

Senior Member
Jun 5, 2010
1,062
127
35
Bucharest
www.SSIG.ro
I keep getting this error:
C:\Users\Magnumutz>apktool b C:\Windows\apk C:\Windows\apk\framework-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
invalid resource directory name: C:\Windows\apk\res/anim-sw720dp
invalid resource directory name: C:\Windows\apk\res/drawable-sw600dp-hdpi
invalid resource directory name: C:\Windows\apk\res/drawable-sw600dp-nodpi
invalid resource directory name: C:\Windows\apk\res/drawable-sw720dp-nodpi
invalid resource directory name: C:\Windows\apk\res/layout-sw600dp
invalid resource directory name: C:\Windows\apk\res/layout-sw720dp
invalid resource directory name: C:\Windows\apk\res/layout-w600dp
invalid resource directory name: C:\Windows\apk\res/values-h720dp
invalid resource directory name: C:\Windows\apk\res/values-sw600dp
invalid resource directory name: C:\Windows\apk\res/values-sw600dp-land
invalid resource directory name: C:\Windows\apk\res/values-sw600dp-w960dp
invalid resource directory name: C:\Windows\apk\res/values-sw720dp
invalid resource directory name: C:\Windows\apk\res/values-sw720dp-land
invalid resource directory name: C:\Windows\apk\res/values-sw720dp-port
invalid resource directory name: C:\Windows\apk\res/values-sw720dp-w1280dp
invalid resource directory name: C:\Windows\apk\res/values-w360dp
invalid resource directory name: C:\Windows\apk\res/values-w480dp
invalid resource directory name: C:\Windows\apk\res/values-w500dp
invalid resource directory name: C:\Windows\apk\res/values-w600dp
invalid resource directory name: C:\Windows\apk\res/values-w720dp
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\Users\MAGNUM~1\AppData\Local\Tem
p\APKTOOL5388391243637841959.tmp, -x, -S, C:\Windows\apk\res, -M, C:\Windows\apk
\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\U
sers\MAGNUM~1\AppData\Local\Temp\APKTOOL5388391243637841959.tmp, -x, -S, C:\Wind
ows\apk\res, -M, C:\Windows\apk\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:191)
... 6 more
The framework-res.apk was decompiled in C:\Windows\apk folder.
What am I doing wrong here?
 

cakebomb

Senior Member
Nov 23, 2011
259
458
I keep getting this error:

The framework-res.apk was decompiled in C:\Windows\apk folder.
What am I doing wrong here?

Try to decompile and compile without changing anything. If the error appears again, you're using a false apktool version.
Or have you installed the framework with 'if framework-res.apk'?
 

IAmAN00bie

Senior Member
Dec 2, 2010
629
335
Hi, is there any way to center the lockscreen ring itself when at a lower DPI? I still haven't found any solution to this...
 

dstruct2k

Senior Member
Jan 31, 2008
1,253
938
Winnipeg
Google Pixel 4
I keep getting this error:

The framework-res.apk was decompiled in C:\Windows\apk folder.
What am I doing wrong here?
  1. Don't use the Windows folder. Try C:\APK\ instead. The last thing you want to do is mess up Windows because you're dumping 100s of files into system folders.
  2. If you're not using a folder under \Users\*USERNAME*\, you'll probably need to run apktool as an admin.
 

Magnumutz

Senior Member
Jun 5, 2010
1,062
127
35
Bucharest
www.SSIG.ro
Try to decompile and compile without changing anything. If the error appears again, you're using a false apktool version.
Or have you installed the framework with 'if framework-res.apk'?
So, i tried decompiling and then compiling without changing anything, the error is still there.
The funny thing is that i downloaded the apktool from their official site on google code.
  1. Don't use the Windows folder. Try C:\APK\ instead. The last thing you want to do is mess up Windows because you're dumping 100s of files into system folders.
  2. If you're not using a folder under \Users\*USERNAME*\, you'll probably need to run apktool as an admin.

Ok, i moved it to \users\magnumutz and it's still showing me the same error.
 

icke

Senior Member
Feb 12, 2007
2,002
1,202
Ahaus
Google Pixel 6
Was playing a lil' bit with your values and have to say for HOX best setting is:

Code:
<dimen name="keyguard_lockscreen_status_line_font_right_m argin">66.0dip</dimen>

to center clock on JB@HTC One X.
Maybe U add this value in OP for XDPI devices.:D
Thank U for your work!
 

Attachments

  • Screenshot_2012-08-13-22-08-30.jpg
    Screenshot_2012-08-13-22-08-30.jpg
    13.7 KB · Views: 1,138
Any way we can get this a flashable zip or apk? Thanks

Since its a framework mod it wouldn't be possible. That's why he posted a how to. He would have to make zips for every phone and rom available...That would be very time consuming. Hope that helps.

DarkJelly Gnex on JellyBean sent this using the app
 

n1kolaa

Inactive Recognized Developer
Oct 21, 2011
3,367
4,062
Zrenjanin
OnePlus Nord
ABOUT :
This is a easy guide which will teach you how to make the Lockscreen Clock Allign To Center

SCREENSHOT :



STEPS :
1. Extract the "framework-res.apk" from ROM
2. Decompile it using apktool
3. Browse To "\res\values" and open dimens.xml
4. Find These Lines
Code:
<dimen name="keyguard_lockscreen_clock_font_size">80.0dip</dimen>
<dimen name="keyguard_lockscreen_status_line_font_size">14.0dip</dimen>
<dimen name="keyguard_lockscreen_status_line_font_right_margin">42.0dip</dimen><dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen>
<dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen>
<dimen name="keyguard_lockscreen_pin_margin_left">40.0dip</dimen>

5. You basically need to edit

<dimen name="keyguard_lockscreen_status_line_font_right_margin">52.0dip</dimen> - Necessary ( Sets Margin from Right which basically alligns to center )
<dimen name="keyguard_lockscreen_clock_font_size">85.0dip</dimen> - Not Necessary ( Sets the font size of clock time display)
<dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen> - Not Necessary ( Sets Margin From Top )
<dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen> - Not Necessary ( Sets Margin From Bottom )

6. Assuming that you have a WVGA device. Without a thought do this
Code:
<dimen name="keyguard_lockscreen_status_line_font_right_margin">[B]52.0dip[/B]</dimen>
<dimen name="keyguard_lockscreen_clock_font_size">[B]85.0dip[/B]</dimen>

What I did is changed the font size to 85 dip and right margin to 52 dip. You can see the result in screenshot above

7. If you have a device with different resolution. You need to do some experiment on your own by changing margin to allign it in center.
I will suggest to keep the right allign to 54-56 dip and font size 82 dip for devices with higher resolution above 480*800

8. Thats All.. If you want too change layout to bottom or extreme top..Change te dip values for top and bottom margin

For more tutorials and guides visit - www.blindndumb.com
Cheers :)
best vavles for xperia arc?
 
For some reason its not working for me!!:mad:. What I did was after editing the dimens.xml, then compiled the apk back and then using 7zip moved the META-INF and AndroidManifest.xml to the edited apk and then copied(overwrite) it on the exiting apk in system/framework folder and reboot! It didn't work,.

All I did was decompile, edit the dimens, compile, signed it with generic key, placed in rom zip and flashed with the rom...No issues! Oh I did add a few images for the lockscreen weather in CM10. No need to move files and all that!

DarkJelly Gnex on JellyBro sent this from the app.
 
All I did was decompile, edit the dimens, compile, signed it with generic key, placed in rom zip and flashed with the rom...No issues! Oh I did add a few images for the lockscreen weather in CM10. No need to move files and all that!

DarkJelly Gnex on JellyBro sent this from the app.
But I don't get one thing why do we need to sign? I mean its a system apk so why sign?? and other thing is even if i compile it normally the META-INF folder is still not there in the compiled apk itself!
 
But I don't get one thing why do we need to sign? I mean its a system apk so why sign?? and other thing is even if i compile it normally the META-INF folder is still not there in the compiled apk itself!

Well I've heard many arguments on that but I've always signed system apps since gingerbread..the META-INF folder is the signature. I've seen others have issues when they don't sign system apps. I've never had those issues. If you're not seeing the META-INF folder after signing them it's your setup somewhere. Copying the META-INF folder to the apk is basically signing it manually. If it wasn't needed then there wouldn't be a folder there to copy. Try compiling it and then only copy the META-INF folder over..No need to move anything else to the apk.

DarkJelly Gnex on JellyBro sent this from the app.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    ABOUT :
    This is a easy guide which will teach you how to make the Lockscreen Clock Allign To Center

    SCREENSHOT :


    STEPS :
    1. Extract the "framework-res.apk" from ROM
    2. Decompile it using apktool
    3. Browse To "\res\values" and open dimens.xml
    4. Find These Lines
    Code:
    <dimen name="keyguard_lockscreen_clock_font_size">80.0dip</dimen>
    <dimen name="keyguard_lockscreen_status_line_font_size">14.0dip</dimen>
    <dimen name="keyguard_lockscreen_status_line_font_right_margin">42.0dip</dimen><dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen>
    <dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen>
    <dimen name="keyguard_lockscreen_pin_margin_left">40.0dip</dimen>

    5. You basically need to edit

    <dimen name="keyguard_lockscreen_status_line_font_right_margin">52.0dip</dimen> - Necessary ( Sets Margin from Right which basically alligns to center )
    <dimen name="keyguard_lockscreen_clock_font_size">85.0dip</dimen> - Not Necessary ( Sets the font size of clock time display)
    <dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22.0dip</dimen> - Not Necessary ( Sets Margin From Top )
    <dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12.0dip</dimen> - Not Necessary ( Sets Margin From Bottom )

    6. Assuming that you have a WVGA device. Without a thought do this
    Code:
    <dimen name="keyguard_lockscreen_status_line_font_right_margin">[B]52.0dip[/B]</dimen>
    <dimen name="keyguard_lockscreen_clock_font_size">[B]85.0dip[/B]</dimen>

    What I did is changed the font size to 85 dip and right margin to 52 dip. You can see the result in screenshot above

    7. If you have a device with different resolution. You need to do some experiment on your own by changing margin to allign it in center.
    I will suggest to keep the right allign to 54-56 dip and font size 82 dip for devices with higher resolution above 480*800

    8. Thats All.. If you want too change layout to bottom or extreme top..Change te dip values for top and bottom margin

    For more tutorials and guides visit - www.blindndumb.com
    Cheers :)
    3
    isn't changing the layout a way better method?

    frameworks / base / core / res / res /layout / keyguard_screen_tab_unlock.xml

    (for the decompile guys / res /layout / keyguard_screen_tab_unlock.xml)
    i did not test this btw but i think this is much cleaner then changing the margin

    Code:
    <GridLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/root"
        android:gravity="center_horizontal">
    
        <com.android.internal.widget.DigitalClock android:id="@+id/time"
            android:layout_marginTop="@dimen/keyguard_lockscreen_status_line_clockfont_top_margin"
            android:layout_marginBottom="12dip"
    -        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
    -        android:layout_gravity="right">
    +        android:layout_gravity="center">
    
            <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
            top of the other. Hence the redundant layout... -->
            <TextView android:id="@+id/timeDisplayBackground"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="none"
                android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:layout_marginBottom="6dip"
                android:textColor="@color/lockscreen_clock_background"
                />
    
            <TextView android:id="@+id/timeDisplayForeground"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="none"
                android:textSize="@dimen/keyguard_lockscreen_clock_font_size"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:layout_marginBottom="6dip"
                android:textColor="@color/lockscreen_clock_foreground"
                android:layout_alignLeft="@id/timeDisplayBackground"
                android:layout_alignTop="@id/timeDisplayBackground"
                />
    
        </com.android.internal.widget.DigitalClock>
    
        <LinearLayout
            android:orientation="horizontal"
    -        android:layout_gravity="right"
    -        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin">
    +        android:layout_gravity="center">
    
            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
                />
    
            <TextView
                android:id="@+id/alarm_status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dip"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
                android:drawablePadding="4dip"
                />
    
        </LinearLayout>
    
        <TextView
            android:id="@+id/status1"
    -        android:layout_gravity="right"
    +        android:layout_gravity="center"
    -        android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
            android:drawablePadding="4dip"
            />
    1
    anyway you could make this into a flashable zip?
    1
    Hi,
    I tried and got the same error as Magnumutz.

    Copied framework-res.apk on PC, decomplied, opened (with notepad++) dimen.xml from \res\values folder, modified the values.

    Now I'm not able to compile, since the error occurs.
    Tried many version of apktool.

    Can anyone help me to sort this......?

    Use apk manager or apk multitool to compile.

    DarkJelly Gnex on JellyBro sent this from the app.
    1
    Hi,
    I tried and got the same error as Magnumutz.

    Copied framework-res.apk on PC, decomplied, opened (with notepad++) dimen.xml from \res\values folder, modified the values.

    Now I'm not able to compile, since the error occurs.
    Tried many version of apktool.

    Can anyone help me to sort this......?

    For those receiving the same error as Magnumutz, i just got mine to work. i am using apktool and i had to copy the aapt.exe file to the C:\WINDOWS folder. Then it worked.

    Credit to powerpoint45 on this thread see step #2.
    http://xdaforums.com/showthread.php?t=1814441