FORUMS

Index Project For XDA Device Subforums

Another ambitious project from the collaborative efforts of Recognized Contributors and Forum … more

The Atlas of XDA

A few weeks ago, we asked you “How Does Your Location Affect Your Life As A Power User?”. In the days that … more

New Snapdragons: Some Context & Contrast

It hasn’t been a good year for Qualcomm so far. Every device featuring the Snapdragon 810 … more

Google To Launch Next Gen Android One On July 14

The first gen of Android One devices to be launched in India in September 2014 were … more

[TUT]Developing SoftKeys Themes

1,703 posts
Thanks Meter: 5,072
 
By P_Toti, Senior Member on 21st August 2014, 01:23 AM
Post Reply Subscribe to Thread Email Thread
I'm writing this TUT on @matthew0776 request. LG G3(as well as the G2 and many other LG phones) comes with a Softkey theme engine that has the following limitations:

1)You can't use themes with transparency on launcher
2)You can't use themes on some lg apps like gallery,video player,etc
3)You can't have themes working with immersive mode
4)You can't customize the custom glow background

You can avoid them installing G3 TweaksBox.

Attached you can find a theme example which is basically the black gradation theme that comes with the rom: the only difference is the Glow Background which is RED.(I also attached the eclipse template)

Follow these steps to create a theme:

1)Modify the package name:

Open the MANIFEST(AndroidManifest.xml) and change the package name. Don't touch anything else in the MANIFEST file.

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.g3_softkey_theme_example"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="19" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
        <activity 
            android:excludeFromRecents="true" 
            android:launchMode="singleInstance"
            android:name="com.example.g3_softkey_theme_example.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <action android:name="com.lge.systemui.navigation.THEME"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
    </application>

</manifest>
2)Change theme and app Name:

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

Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">SoftKey Theme Example</string>
    <string name="theme_name_blackgradation">Theme Example</string>
</resources>

3)REPLACING RESOURCES:

Just replace your themed pngs in the xxx-hdpi folder(if you want to make the theme available also for other LG phones you should replace also the images in the xx-hdpi folder)

4)TIPS:

As you can see in the theme for each key there are 3 drawables

Code:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/ic_sysbar_home_normal" />
    <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/ic_sysbar_home_pressed" />
    <item android:drawable="@drawable/ic_sysbar_home_disabled" />
</selector>
If you want to use the same drawable for all the three states just change selectors in the drawabl folder :

Code:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/ic_sysbar_home_normal" />
    <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/ic_sysbar_home_normal" />
    <item android:drawable="@drawable/ic_sysbar_home_normal" />
</selector>
In this way copying only a drawable for each key(2 if you consider land) is enough
Last edited by P_Toti; 21st August 2014 at 01:40 AM.
The Following 2 Users Say Thank You to P_Toti For This Useful Post: [ View ]
 
 
21st August 2014, 01:29 AM |#2  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,771
 
Donate to Me
More
thanks bro..!!! much appreciated..!

Sent from my LGLS990 using Tapatalk

---------- Post added at 01:29 AM ---------- Previous post was at 01:25 AM ----------

question...if applied via TWEAKBOX would the exceptions still apply...? seems like there are a lot of expectations when applied this way....any way to do it and have them have stock characteristics...? and not the exceptions

Sent from my LGLS990 using Tapatalk
21st August 2014, 01:31 AM |#3  
OP Senior Member
Thanks Meter: 5,072
 
Donate to Me
More
Quote:
Originally Posted by matthew0776

thanks bro..!!! much appreciated..!

Sent from my LGLS990 using Tapatalk

---------- Post added at 01:29 AM ---------- Previous post was at 01:25 AM ----------

question...if applied via TWEAKBOX would the exceptions still apply...? seems like there are a lot of expectations when applied this way....any way to do it and have them have stock characteristics...? and not the exceptions

Sent from my LGLS990 using Tapatalk

I'm happy to help . I updated the project(i removed unused support lib). Simply installing G3 TweaksBox and enabling the navigation bar MOD will solve all the exceptions.
The Following User Says Thank You to P_Toti For This Useful Post: [ View ]
21st August 2014, 01:34 AM |#4  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,771
 
Donate to Me
More
NICE...! Great job on this project man..! thanks again

Sent from my LGLS990 using Tapatalk
The Following User Says Thank You to matthew0776 For This Useful Post: [ View ]
21st August 2014, 02:36 AM |#5  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,771
 
Donate to Me
More
where is this file to edit..?



edit...ok so I think...it's for each drawable xml..? So I edit the e.i. for pressed if I wanna use just the normal png...I would just replace ic_sysbar_back_disabled to ic_sysbar_back_normal ...in the ic_sysbar_back_button.xml


Sent from my LGLS990 using Tapatalk
Last edited by matthew0776; 21st August 2014 at 02:51 AM.
21st August 2014, 05:08 AM |#6  
matthew0776's Avatar
Recognized Contributor
Flag Chicago
Thanks Meter: 8,771
 
Donate to Me
More
I posted to wrong thread...
SO I did get to working...thanks again for the template







Sent from my LGLS990 using Tapatalk
The Following 2 Users Say Thank You to matthew0776 For This Useful Post: [ View ]
21st August 2014, 11:11 AM |#7  
OP Senior Member
Thanks Meter: 5,072
 
Donate to Me
More
Quote:
Originally Posted by matthew0776

where is this file to edit..?

edit...ok so I think...it's for each drawable xml..? So I edit the e.i. for pressed if I wanna use just the normal png...I would just replace ic_sysbar_back_disabled to ic_sysbar_back_normal ...in the ic_sysbar_back_button.xml

Sent from my LGLS990 using Tapatalk

Correct. You could also delete pressed and disabled pngs if you use the same drawable for all states.

Quote:
Originally Posted by matthew0776

I posted to wrong thread...
SO I did get to working...thanks again for the template

Sent from my LGLS990 using Tapatalk

. Great work!
The Following User Says Thank You to P_Toti For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes