Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,576 Members 44,076 Now Online
XDA Developers Android and Mobile Development Forum

[TUT]Developing SoftKeys Themes

Tip us?
 
P_Toti
Old
(Last edited by P_Toti; 21st August 2014 at 01:40 AM.)
#1  
Senior Member - OP
Thanks Meter 3,624
Posts: 1,482
Join Date: Jun 2012

 
DONATE TO ME
Default [TUT]Developing SoftKeys Themes

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
The Following 2 Users Say Thank You to P_Toti For This Useful Post: [ Click to Expand ]
 
matthew0776
Old
#2  
matthew0776's Avatar
Recognized Contributor
Thanks Meter 7,850
Posts: 5,616
Join Date: Dec 2012
Location: Chicago

 
DONATE TO ME
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
 
P_Toti
Old
#3  
Senior Member - OP
Thanks Meter 3,624
Posts: 1,482
Join Date: Jun 2012

 
DONATE TO ME
Quote:
Originally Posted by matthew0776 View Post
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: [ Click to Expand ]
 
matthew0776
Old
#4  
matthew0776's Avatar
Recognized Contributor
Thanks Meter 7,850
Posts: 5,616
Join Date: Dec 2012
Location: Chicago

 
DONATE TO ME
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: [ Click to Expand ]
 
matthew0776
Old
(Last edited by matthew0776; 21st August 2014 at 02:51 AM.)
#5  
matthew0776's Avatar
Recognized Contributor
Thanks Meter 7,850
Posts: 5,616
Join Date: Dec 2012
Location: Chicago

 
DONATE TO ME
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
 
matthew0776
Old
#6  
matthew0776's Avatar
Recognized Contributor
Thanks Meter 7,850
Posts: 5,616
Join Date: Dec 2012
Location: Chicago

 
DONATE TO ME
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: [ Click to Expand ]
 
P_Toti
Old
#7  
Senior Member - OP
Thanks Meter 3,624
Posts: 1,482
Join Date: Jun 2012

 
DONATE TO ME
Quote:
Originally Posted by matthew0776 View Post
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 View Post
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: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes