Android OS Forum banner

[How-To]Center Lockscreen Clock on ICS and Jellybean 2 different mods 8/17/12

1 reading
33K views 149 replies 20 participants last post by  cphelps76  
#1 · (Edited by Moderator)
Mod Type:: Mod

Difficulty:: Moderate

Mod Status:: Stable

Apply In:: CWM Recovery

Requires Root:: Yes

Source::
Lockscreen center clock mods.

If you are using CM9/CM10 and would like to replace the weather images like I have, I will place instructions at the bottom of this post and attach the images.

Ok you will need to know this first:

1. How to decompile and compile the framework "This is not a how to for that" I will provide links to my tools!
2. How to ADB push or use 7zip to place your modded framework to an update.zip. I will provide a base to use to flash it in recovery after you mod your framework"
3. Edit XML's
That's it!!!

The reason behind doing a how to is because Frameworks change all the time with rom updates and phones all have different values in framework.

If you don't know how to do those things, please learn that before posting questions!!!! "Google is a wonderful thing"

SIMPLE MOD 1

This is a mod that's easy to make but I only have the values for the Gnex sized screens:

I got this mod from here: [GUIDE][05 AUG] How To Make Lock Screen Clock Allign To Center in Jellybean and ICS

ALL CREDIT GOES TO blindndumb
Go thank/donate to him for finding the location and how to!!! I just wanted to share the values I found for Gnex screens.

This is my screenshot on CM10 JellyBro:

Image


Ok here we go:

1. Extract the framework-res.apk from your phone or rom zip located in system/framework
2. Decompile using APK TOOL...here are my tools do decompile ICS or JB Frameworks: Tools
3. Locate the folder res/values inside the decompiled framework-res folder
4. Open the dimens.xml using an XML editor like XML Marker or Notepad++
5. locate the line:

Code:
<dimen name="keyguard_lockscreen_status_line_font_right_margin">42.0dip</dimen>
6. Change it to :

Code:
<dimen name="keyguard_lockscreen_status_line_font_right_margin">82.0dip</dimen>
"This is specific to Gnex phones only..if your phone has a different resolution you might have to change the 82 to something else"

7. Save your changes and compile the apk using the APK Multitool in the Tools zip from above!! ***You will need to move the framework folder to "projects" and the original framework-res.apk to the "place-apk-here-for-modding" of APK Multitool***
8. SIGN IT or Move the META-INF folder from the original apk to the modded one!!!! "I SIGNED MINE USING APK MULITITOOL"
9. Now that it's made you can either push it back with ADB or copy the framework-res.apk you modded to the system/framework folder in my Flashable-zip-template.zip attached at the bottom of the OP using 7zip.
10. Flash in recovery or if you did ADB reboot!!!
11. Enjoy!!!!!

ADVANCED MOD 2:

Image


This mod was created and given to me from willyjay and bouchigo Go to thank them!!!

Advanced centered clock:

Ok this will be a better looking centered clock but is a bit harder to make.

1. Extract the framework-res.apk from your phone or rom zip located in system/framework
2. Decompile using APK TOOL...here are my tools do decompile ICS or JB Frameworks: Tools
3. Locate the folder res/layout inside the decompiled framework-res folder
4. Open the keyguard_screen_tab_unlock.xml using an XML editor like XML Marker or Notepad++
5. Just to make things easier I will just have you copy and paste the lines to replace:

Take this and paste over lines 1-19

Code:
<?xml version="1.0" encoding="utf-8"?><br />
<GridLayout android:gravity="center_horizontal" android:orientation="vertical" android:id="@id/root" android:layout_width="match_parent" android:layout_height="match_parent"<br />
  xmlns:android="http://schemas.android.com/apk/res/android"><br />
    <com.android.internal.widget.DigitalClock android:layout_gravity="center" android:id="@id/time" android:layout_marginTop="@dimen/keyguard_lockscreen_status_line_clockfont_top_margin" android:layout_marginBottom="12.0dip"><br />
        <TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_clock_font_size" android:textColor="@color/lockscreen_clock_background" android:ellipsize="none" android:id="@id/timeDisplayBackground" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6.0dip" android:singleLine="true" /><br />
        <TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_clock_font_size" android:textColor="@color/lockscreen_clock_foreground" android:ellipsize="none" android:id="@id/timeDisplayForeground" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6.0dip" android:singleLine="true" android:layout_alignLeft="@id/timeDisplayBackground" android:layout_alignTop="@id/timeDisplayBackground" /><br />
</com.android.internal.widget.DigitalClock><br />
        <LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
            <TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:ellipsize="marquee" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" /><br />
</LinearLayout><br />
<LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
            <TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:ellipsize="marquee" android:id="@id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:drawablePadding="4.0dip" /><br />
        </LinearLayout><br />
    <TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:ellipsize="marquee" android:layout_gravity="center" android:id="@id/status1" android:singleLine="true" android:drawablePadding="4.0dip" /><br />
    <RelativeLayout android:orientation="horizontal" android:id="@id/weather_panel" android:paddingTop="4.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content"><br />
        <ImageView android:id="@id/weather_image" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_dialog_alert" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /><br />
        <RelativeLayout android:orientation="horizontal" android:padding="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/weather_image" android:layout_centerVertical="true"><br />
            <TextView android:textSize="14.0sp" android:textStyle="bold" android:textColor="?textColorPrimary" android:ellipsize="marquee" android:gravity="right" android:id="@id/weather_city" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_alignParentRight="true" /><br />
            <TextView android:textSize="12.0sp" android:textColor="?textColorPrimary" android:ellipsize="marquee" android:gravity="right" android:id="@id/weather_condition" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_below="@id/weather_city" android:layout_alignParentRight="true" /><br />
            <TextView android:textSize="8.0sp" android:textColor="?textColorSecondary" android:gravity="right" android:id="@id/update_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/weather_condition" android:layout_alignParentRight="true" /><br />
        </RelativeLayout>
6. Save your changes and compile the apk using the APK Multitool in the Tools zip from above!! ***You will need to move the framework folder to "projects" and the original framework-res.apk to the "place-apk-here-for-modding" of APK Multitool***
7. SIGN IT or Move the META-INF folder from the original apk to the modded one!!!! "I SIGNED MINE USING APK MULITITOOL"
8. Now that it's made you can either push it back with ADB or copy the framework-res.apk you modded to the system/framework folder in my Flashable-zip-template.zip attached at the bottom of the OP using 7zip.
9. Flash in recovery or if you did ADB reboot!!!
10. Enjoy!!!!!

Weather Images

I have taken these images from AOKP but themed them Black and White to match the lockscreen font color.

1. Download the Weather Icons.zip from the Bottom of the OP.
2. Use 7zip to open your framework-res.apk "Take it from the rom zip or adb pull yours from the phone"
3. You will see a folder named "res" in the opened framework-res.apk - drop the folder "res" from my
Weather Icons zip into your framework-res.apk "NO NEED TO SIGN THE APK"
4. Close 7zip and place it in the system/framework folder in my Flashable-zip-template.zip attached at the bottom of the OP using 7zip then flash it in recovery - OR adb push it back to your phone.
5. Enjoy!!!!

If you want to add this the the center clock mod, just use these steps after you compile the apk.

Hope you like this mod, I love it!!! :victory:

DJ
 

Attachments

#9 ·
Is there something special about the MultiTool for Windows that the Linux version isn't updated for? I keep getting stuck at boot animation when I use the repackaged framework-res I made on my Ubuntu laptop. I'm using the latest nightly from JellyBro. If I can't get it to work from Ubuntu, could you post your JellyBro file for me to use? I've tried flashing and ADB pushing, both end the same way.
 
#19 · (Edited by Moderator)
Thanks!

Also in the OP it says to resign the APK I thought you were not supposed to sign system apps with custom/test keys? It says so right in APK multitool. I have made changes to framework-res.apk and systemui.apk using apk multitool before and never signed them, also never had issues...just curious to get others feedback. I thought signing was for data apps to be installable.

I think what it does is copies back over the original signature from the system apk. See the highlights from my SS below.



Edit:
Forgive my ingorance if any of this does not make sense to you experienced themers out there, just trying to understand everything porperly...
I just found that there was an update to APK Multitool to version 1.0.7 check out what he says about system apks and signing below.

Version 1.0.7
Updated to next minor build number
Updated Setup.bat Fixing Installing Framework-Res
Fixed Issue With 'apktool' is not recognized as an internal or external command,operable program or batch file."
Fixed Issue with Installing Framework-Res pointing to a incorrect folder that no longer exist
Fixed Issue when Running Installing Framework-Res scripts that the scripts will close after installing instead of going back to the menu.
Updated APKTOOL.JAR to 1.4.9
Added Custom AAPT that was built to work with JELLY BEAN
Fixed issues with setup
Made a few changes to the setup bat to fix alignment size and other misc issues
Fixed Spelling
Did some changes to see if I can fix the issue with The keep option to work with none system applications.
Trying to get batch optionmize to work
Replacing odt with a actual manual in html
Fixed Bug with KEEP Folder not exstracting for None System Applicaitons
Tweaked how the Signed and Unsigned files are compiled adding a small underscore between the recompiled file and the added prefix added by the scripts
Tweaked the option 11 for non system apks
I added the option to allow you to transfer the old key file over to the apk in case you did minor changes so be careful to test the APK files as some will need you to pick the unsigned option depending on how drastic the changes you made and forcing you to have to resign them
Renamed recompiled system files
Renamed the unsigned_ to signed_System_ since the system file changes the signature files are transfered since they are actually signed already instead of the misconception that has been going on for a while
 

Attachments

#21 · (Edited by Moderator)
#39 · (Edited by Moderator)
Credit to Bouchigo for teaching me this.....

Code:
<br />
</com.android.internal.widget.DigitalClock><br />
		<LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
			<TextView android:textAppearance="?textAppearanceMedium" android:textSize="20.0dip" android:ellipsize="marquee" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" /><br />
  </LinearLayout><br />
  <LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
			<TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:ellipsize="marquee" android:id="@id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:drawablePadding="4.0dip" /><br />
		</LinearLayout><br />
The id/date "20dpi" is to make the date font slightly larger than the alarm status and name

Basically, you just need to add this line in between the two lines

Code:
<br />
</LinearLayout><br />
  <LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
 
#40 ·
Credit to Bouchigo for teaching me this.....

Code:
<br />
<br />
</com.android.internal.widget.DigitalClock><br />
		<LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
			<TextView android:textAppearance="?textAppearanceMedium" android:textSize="20.0dip" android:ellipsize="marquee" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" /><br />
</LinearLayout><br />
<LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
			<TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:ellipsize="marquee" android:id="@id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:drawablePadding="4.0dip" /><br />
		</LinearLayout><br />
The id/date "20dpi" is to make the date font slightly larger than the alarm status and name
Oh thanks..because I got "keyguard_screen_tab_unlock.xml:10: error: Error parsing XML: mismatched tag" on mine.....Thanks I'll make sure to give you both credit!
 
#43 · (Edited by Moderator)
Yay, I got it working!

Image


I'll update the op with a second area for advanced setup. Thank you for the help!

Edit: I have some things I have to do so it will probably be updated later tonight...I'll attach my xml for now. Brb

DarkJelly Gnex on JellyBro sent this from the app.
 
#44 · (Edited by Moderator)
This also works, and the code looks a little bit nicer I think, but either way is fine:

Code:
<LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
    <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"><br />
	    <TextView android:textAppearance="?textAppearanceMedium" android:textSize="20.0dip" android:textColor="#ff33b5e5" android:ellipsize="marquee" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" /><br />
	    <TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:textColor="#ff33b5e5" android:ellipsize="marquee" android:id="@id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:drawablePadding="4.0dip" android:layout_below="@id/date" /><br />
    </RelativeLayout><br />
</LinearLayout>
Damn spacing, oh well...lol
 
#45 ·
This also works, and the code looks a little bit nicer I think, but either way is fine:

Code:
<LinearLayout android:layout_gravity="center" android:orientation="horizontal"><br />
	<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"><br />
		<TextView android:textAppearance="?textAppearanceMedium" android:textSize="20.0dip" android:textColor="#ff33b5e5" android:ellipsize="marquee" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" /><br />
		<TextView android:textAppearance="?textAppearanceMedium" android:textSize="@dimen/keyguard_lockscreen_status_line_font_size" android:textColor="#ff33b5e5" android:ellipsize="marquee" android:id="@id/alarm_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:drawablePadding="4.0dip" android:layout_below="@id/date" /><br />
	</RelativeLayout><br />
</LinearLayout>
Damn spacing, oh well...lol
LOL thanks for the help. I'll use the one I have working for now. Trying to keep it with the stock values and colors. That's why I didn't make my date larger either. I'll totally give you two credit for helping me out!!!

My keyguard_screen_tab_unlock.xml is attached if anyone wants to try this before I update the OP!
 

Attachments