FORUMS

Analysis & Opinion

Top Forum Discussions

[TUT]Developing G3 TweaksBox Themes

1,720 posts
Thanks Meter: 5,186
 
By P_Toti, Senior Member on 20th August 2014, 03:10 PM
Post Reply Subscribe to Thread Email Thread
As many of you know, in the new release of G3 TweaksBox i implemented a theme engine that allows users to develop their own themes.Creating themes is really simple:at the end of this post you can find a theme example i created with resources provided by @Kickoff and an empty theme template you can use to develop your own themes.

What can you theme ?
SystemUI(see LGSystemUI.apk)
LockScreen(see LGKeyguard.apk)
Phonebook,InCallUI,TeleService(see LGContacts.apk,InCallUI.apk,LGTeleservice.apk)
Message App(see LGMessage.apk)
Settings(see LGSettings.apk and LGEasySettings.apk)
More to come....

1)Modify the package name:

Open the MANIFEST(AndroidManifest.xml) and change the package name.

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="it.ptoti.systemui_theme.htc"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="19"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="it.ptoti.systemui_theme.htc.MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <action android:name="it.ptoti.g3_tweaksbox.systemui.THEME"/>
                <!-- <action android:name="it.ptoti.g3_tweaksbox.settings.THEME"/> -->
                <!-- <action android:name="it.ptoti.g3_tweaksbox.lockscreen.THEME"/> -->
                <!-- <action android:name="it.ptoti.g3_tweaksbox.incallui.THEME"/> -->
                <!-- <action android:name="it.ptoti.g3_tweaksbox.phonebookapp.THEME"/> -->
                <!-- <action android:name="it.ptoti.g3_tweaksbox.messageapp.THEME"/> -->
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
2)Change Theme Name:

Open the strings.xml file(res/values/) and change the theme name

Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">HTC Panel THEME</string>
</resources>
2-1)Add Intents in the Manifest File:

Code:
<action android:name="it.ptoti.g3_tweaksbox.systemui.THEME"/> for the LGSystemUI
<action android:name="it.ptoti.g3_tweaksbox.settings.THEME"/>  for the LGSettings
<action android:name="it.ptoti.g3_tweaksbox.easysettings.THEME"/>  for the LGEasySettings
<action android:name="it.ptoti.g3_tweaksbox.lockscreen.THEME"/> for LGKeyGuard
<action android:name="it.ptoti.g3_tweaksbox.incallui.THEME"/>  for InCallUi
<action android:name="it.ptoti.g3_tweaksbox.teleservice.THEME"/>  for TeleService
<action android:name="it.ptoti.g3_tweaksbox.phonebookapp.THEME"/>  for LGContacts
<action android:name="it.ptoti.g3_tweaksbox.messageapp.THEME"/>  for LGMessage
Manifest example : Here you can see a manifest example of theme for SystemUI and Settings only

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="it.ptoti.systemui_theme.template"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="19"
        android:targetSdkVersion="19" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="it.ptoti.systemui_theme.htc.MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <action android:name="it.ptoti.g3_tweaksbox.systemui.THEME"/>
                <action android:name="it.ptoti.g3_tweaksbox.settings.THEME"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
3)REPLACING RESOURCES:

REPLACING QUICKSETTINGS' ICONS AND ANIMATIONS:

You just have to put your modified resources in the relative folders. Drawables MUST have the same name they have in the SystemUI package: if G3 TWB finds them it replaces the original resources with the themes' ones.

Also,you have to add these lines to the theme.xml you can find in the xml folder

<Drawable name="indi_noti_rearrange_normal" />
<Drawable name="indi_noti_rearrange_pressed" />
<Drawable name="quicksetting_button_edit_bg" />


REPLACE OTHER RESOURCES:

Other resources MUST be ALSO defined in the relative xml file you can find in the xml folder:

theme.xml -----------------> For the SystemUI
theme_contacts.xml -------------> For LGContacts.apk
theme_incallui.xml ---------------> For InCallUI.apk
theme_lockscreen.xml -----------> For LGKeyGuard.apk
theme_messageapp --------------> For LGMessage.apk
theme_settings.xml ---------------> For LGSettings.apk
theme_teleservice.xml------------------> For LGTeleService.apk
theme_easysettings.xml---------------> For LGEasySettings.apk


Let's take a look to an example.

Code:
<?xml version="1.0" encoding="utf-8"?>
<G3_TweaksBox_SystemUI_Theme version="1">
    <Drawable name="ic_brightness_auto_check"/>
    <Drawable name="ic_launcher_settings" />
    <Drawable name="scrubber_primary_holo" />
    <Drawable name="ic_notify_settings_set" />
    <Drawable name="indi_noti_btn_vol_set" />
    <Drawable name="ic_notify_quicksetting_brightness_panel" />
    <Drawable name="ic_notify_quicksetting_ringtone" />
    <Drawable name="indi_noti_btn_clear" />
    <Color name="np_clock" replacement="#FF00FF00"/>
    <Color name="bg_expanded" replacement="#FF000000" />
</G3_TweaksBox_SystemUI_Theme>
To replace a drawable the syntax is:

Code:
<Drawable name="name_of_original_drawable" replacement="name_of_the_drawable_in_your_theme" / >
The replacement attribute is optional: if you name the drawable as the original one in the SystemUI you can omit it.

You can also replace a Drawable with a color with the following syntax:

Code:
<Drawable name="name_of_original_drawable" replacement="colorDrawable:#AARRGGBB" / >
Where AARRGGBB is the color code in the ARGB format(but you can use also RGB format)

To replace a color the syntax is the following:

Code:
<Color name="name_of_original_color" replacement="#AARRGGBB" />
If you want to replace a drawable(or a color) which is actually in the framework-res you can use the same syntax but you have to add the packageRes attribute, example :

Code:
<Drawable respackage="com.lge" name="switch_thumb_activated_holo_light"/>
To replace a dimension the syntax is the following:

Code:
<Dimen name="name_of_original_dimension" replacement="20.0" />
The replacement must be a dip value not a px one.

To replace an integer the syntax is the following:

Code:
<Integer name="name_of_original_integer" replacement="20" />
To assign a backgound(Drawable or Color) to any layout the syntax is the following :

Code:
<LayoutBackground name="layout_name" background="name_of_the_drawable" />
To assign a background(Drawable or Color) to any child layout the syntax is the following :

Code:
<LayoutBackground name="master_layout_name" child="child_layout_name" background="name_of_the_drawable" />
That's all,remember to sign the theme before trying to install it. The TUT will be updated when new features are added to the theme engine.
Last edited by P_Toti; 16th September 2014 at 07:28 PM. Reason: Updated TUT for new theme engine
The Following 26 Users Say Thank You to P_Toti For This Useful Post: [ View ]
 
 
20th August 2014, 05:26 PM |#2  
yoavst's Avatar
Senior Member
Flag Ramat Gan
Thanks Meter: 416
 
Donate to Me
More
Very good work!
20th August 2014, 05:42 PM |#3  
blackbearblanc's Avatar
Recognized Themer
Thanks Meter: 6,694
 
Donate to Me
More
Just what I needed. Thanks
The Following 3 Users Say Thank You to blackbearblanc For This Useful Post: [ View ]
20th August 2014, 05:49 PM |#4  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,773
 
Donate to Me
More
Quote:
Originally Posted by blackbearblanc

Just what I needed. Thanks

what's up black..! u picked up a g3..? NICE..!

Sent from my LGLS990 using Tapatalk
20th August 2014, 06:09 PM |#5  
blackbearblanc's Avatar
Recognized Themer
Thanks Meter: 6,694
 
Donate to Me
More
Quote:
Originally Posted by matthew0776

what's up black..! u picked up a g3..? NICE..!

Sent from my LGLS990 using Tapatalk

Sis yes sir! Got a free one from LG to review!
The Following User Says Thank You to blackbearblanc For This Useful Post: [ View ]
20th August 2014, 06:25 PM |#6  
Upstreammiami's Avatar
Senior Member
Flag Davie
Thanks Meter: 1,013
 
Donate to Me
More
Quote:
Originally Posted by blackbearblanc

Just what I needed. Thanks

I was about to share this with you lol.
20th August 2014, 06:25 PM |#7  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,773
 
Donate to Me
More
Quote:
Originally Posted by blackbearblanc

Sis yes sir! Got a free one from LG to review!

NICE... so...u got plans with the template..? lol I'm gonna try and get the Candy shop Softkeys going if possible... are u using apktool

Sent from my LGLS990 using Tapatalk
20th August 2014, 06:45 PM |#8  
blackbearblanc's Avatar
Recognized Themer
Thanks Meter: 6,694
 
Donate to Me
More
Dammit - howcome i cant import any of them into eclipse??

Nothing happens. And if dragging folder into workspace - it says "Destination folder must be accessible"

---------- Post added at 07:45 PM ---------- Previous post was at 07:34 PM ----------

silly me - yes apktools, not just 7zip
20th August 2014, 06:46 PM |#9  
OP Senior Member
Thanks Meter: 5,186
 
Donate to Me
More
Quote:
Originally Posted by matthew0776

NICE... so...u got plans with the template..? lol I'm gonna try and get the Candy shop Softkeys going if possible... are u using apktool

Sent from my LGLS990 using Tapatalk

You can't theme SoftKeys in this way. SoftKeys res are actually out of the SystemUI package. The ROM already comes with a SoftKey theme engine which is fully working if you are using G2/G3 TWB. I explained a long time ago how to develop softkeys themes infact you can find a lot of themes already on the scene

http://forum.xda-developers.com/show...php?p=52818274
http://forum.xda-developers.com/show...php?p=52818274
http://forum.xda-developers.com/show...php?p=52818274

Quote:
Originally Posted by blackbearblanc

Dammit - howcome i cant import any of them into eclipse??

Nothing happens. And if dragging folder into workspace - it says "Destination folder must be accessible"

They are compiled apk, most themers don't use eclipse just decompile/recompile the package. Anyway i'm more than pleased you use eclipse. Attached you can find the template
Attached Files
File Type: zip Eclipse_Template.zip - [Click for QR Code] (655.5 KB, 161 views)
Last edited by P_Toti; 20th August 2014 at 06:49 PM.
The Following User Says Thank You to P_Toti For This Useful Post: [ View ]
20th August 2014, 07:10 PM |#10  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,773
 
Donate to Me
More
Quote:
Originally Posted by P_Toti

You can't theme SoftKeys in this way. SoftKeys res are actually out of the SystemUI package. The ROM already comes with a SoftKey theme engine which is fully working if you are using G2/G3 TWB. I explained a long time ago how to develop softkeys themes infact you can find a lot of themes already on the scene

http://forum.xda-developers.com/show...php?p=52818274
http://forum.xda-developers.com/show...php?p=52818274
http://forum.xda-developers.com/show...php?p=52818274



They are compiled apk, most themers don't use eclipse just decompile/recompile the package. Anyway i'm more than pleased you use eclipse. Attached you can find the template

so what's themeable ? SystemUI ?

Sent from my LGLS990 using Tapatalk

---------- Post added at 07:10 PM ---------- Previous post was at 07:09 PM ----------

Quote:
Originally Posted by matthew0776

so what's themeable ? SystemUI ?

oh snap...u have some of the CS keys already...sweet..!

Sent from my LGLS990 using Tapatalk



Sent from my LGLS990 using Tapatalk
20th August 2014, 07:13 PM |#11  
OP Senior Member
Thanks Meter: 5,186
 
Donate to Me
More
Quote:
Originally Posted by matthew0776

so what's themeable ? SystemUI ?

Sent from my LGLS990 using Tapatalk

Also softkeys are themeable, simply you can't theme them using this TUT. If you want i can write another tut explaining how to develop softkeys themes. Anyway yes at the moment you can theme only the SystemUI but, as i explained in the first post the theme engine is in a early stage. It will be much more powerful in the 1.3 and you will able to theme other apps too.
The Following 2 Users Say Thank You to P_Toti For This Useful Post: [ View ]

Read More
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes