[Guide Dev][Smali DIY] How to Switch, Checkbox, Seekbar,ListPreferences Preferences - Sony Cross-Device Development Themes and Apps

Today i would like to explain the tut on how these Switch,CheckBox,ListPreferences work
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Firstly i am not good in explanation
Hope you will surely understand it
Before Going to the main part you should know what switch checkbox and list preferences work
Look at this code
Code:
private boolean mBrightnessSliderEnabled;
private int isBrightnessSliderEnabled()
{
int i = Settings.System.getInt(this.mContext.getContentResolver(), "[COLOR="red"]brightness_slider_enabled[/COLOR]", 1); #key
int j = 0;
if (i != 0) {
j = 1;
}
this.mBrightnessSliderEnabled = j;
return j;
}
private boolean showBrightnessSlider()
{
int i = isBrightnessSliderEnabled();
ToggleSlider localToggleSlider = (ToggleSlider)findViewById(id.brightness_slider);
if ((i != 0) && (this.mBrightnessSliderEnabled))
{
this.mBrightnessView.setVisibility(0);
localToggleSlider.setVisibility(0);
}
for (;;)
{
updateResources();
return this.mBrightnessSliderEnabled;
this.mBrightnessView.setVisibility(8);
localToggleSlider.setVisibility(8);
}
}
public void setListening(boolean paramBoolean)
{
if (this.mListening == paramBoolean) {
return;
}
this.mListening = paramBoolean;
Iterator localIterator = this.mRecords.iterator();
while (localIterator.hasNext())
{
TileRecord localTileRecord = (TileRecord)localIterator.next();
try
{
localTileRecord.tile.setListening(this.mListening);
}
catch (IllegalArgumentException localIllegalArgumentException) {}
}
this.mFooter.setListening(this.mListening);
if (this.mListening) {
refreshAllTiles();
}
if ((paramBoolean) && (showBrightnessSlider()))
{
this.mBrightnessController.registerCallbacks();
return;
}
this.mBrightnessController.unregisterCallbacks();
}
In Smali Look here http://forum.xda-developers.com/cro...es-apps/guide-hide-brightness-slider-t3284141
See here in the above code
In code you will find 0 and 1 ( nothing but true or false / on/off)
and you can see a key in red line ( which receives the 1 or 0 from settings)
So The CheckBox and Switch preference created a boolean 1 or 0 ( nothing but on / off)
Hope you got what i meant
List preference in android persists string. That means that it writes object of string type into the shared preferences.
You need to create 2 string arrays for each list preference.
One for Entries - what is displayed in the dialog as single choice items for user.
and One is for entryValues (what is being written into the preferences). You can from your mod read them as integers or strings using content resolver.
f.e., if your values are 200, 300, 400, android will persist them as strings. But when you restrieve them from database in your systemui smali mod, f.e.,
you can call either getInt (to get them as integers) or getString to get them as strings. Of course strings array like bread, milk, cookies cannot be retrieved as integer.
But a string 200 can be either.
Now time to main part of explanation
So you know that switch and checkbox give same out of valued 1 or 0
How to make it ?
Here i will start with 2 types of codes

Post 2
Look at these 2 xml code which give same result with variation of view
Code:
<SwitchPreference android:title="Brightness Slider" android:key="[COLOR="red"]key_brightness_slider_show[/COLOR]" android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden" />
or
Code:
<CheckBoxPreference android:title="Brightness Slider" android:key="[COLOR="red"]key_brightness_slider_show[/COLOR]" android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden" />
You MUST provide defaultValue for ANY switch preference you create
It writes boolean (true or false) into the shared preferences
We copy it as integer (1 or 0) into the Settings.System database
It mush have a unique key, none of existent in databse.
It must be the same key as you use in your mod for that function. key_brightness_slider_show.
So thea Slider can be either visible or invisible.
Also will checkbox preference. In your mod when you retrieve and integer using ContentResolver you specify the default value (if the key is not found).
You have to specify the same default value here. If in smali it was 0x1,. then in the app it must be android:defaultValue = "true".
android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden"
These will show the below summary when value is 1 you will get summaryOn else off
This is not much mandatory.. its your wish or you can leave it or you can just only define summary
You can also make Dependence of the switch example
Network mod- this contain turn on/off, color, auto hide and more
When you add the dependency code so that when you only get bool 1 you can control other next string
Look below code of strings
Code:
<ListPreference android:persistent="false" android:entries="@array/show_network_traffic_state_entries" android:title="@string/show_network_traffic_state" android:key="[COLOR="red"]network_traffic_state[/COLOR]" android:entryValues="@array/show_network_traffic_state_values" />
<net.margaritov.preference.colorpicker.ColorPickerPreference android:title="@string/network_traffic_color_style" android:key="network_traffic_color" [COLOR="Orange"]android:dependency="[COLOR="Red"]network_traffic_state[/COLOR]" [/COLOR]android:defaultValue="0xffffffff" />
in the above code you can see the dependency
mean, when you turn on the first string
only then next string works
Now its time to go for smali
First create your own xml code
Example look this empty code
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="New"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
</PreferenceScreen>
save this in any name of your xml (settings.apk/res/xml)
now i like to control Brightness slider
so i will add this to the xml and will look like
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="New"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<SwitchPreference android:title="Brightness Slider" android:key="key_brightness_slider_show" android:defaultValue="0" android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden"
</PreferenceScreen>
Look here the main part is Key android:key="key_brightness_slider_show" (where i had defined brightness_slider_show in above code )
I think you are clear till now
So time to create a boolean
Lets start with new empty code
This is an Empty code Which or where you can create new Switch or Checkbox preference
The path of the file is Settings.apk/smali/com/android/settings/rz/
and File name was Statusmod.smali
Code:
.class public Lcom/android/settings/rz/Statusmod;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "Statusmod.java"
# instance fields
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 28
invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 5
.param p1, "savedInstanceState" # Landroid/os/Bundle;
.prologue
const/4 v3, 0x0
const/4 v2, 0x1
.line 42
invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V
.line 43
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v1
invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
.line 44
.local v0, "resolver":Landroid/content/ContentResolver;
const v1, 0x7f060092 #Xml preference
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->addPreferencesFromResource(I)V
.end method
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
.locals 5
.param p1, "preferenceScreen" # Landroid/preference/PreferenceScreen;
.param p2, "preference" # Landroid/preference/Preference;
.prologue
const/4 v1, 0x0
const/4 v2, 0x1
.end method
Here i had added a part of Switch settings
Code:
.class public Lcom/android/settings/rz/Statusmod;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "Statusmod.java"
# instance fields
.field private mENABLE_SLIDER:Landroid/preference/[COLOR="SeaGreen"]SwitchPreference[/COLOR];
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 28
invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 5
.param p1, "savedInstanceState" # Landroid/os/Bundle;
.prologue
const/4 v3, 0x0
const/4 v2, 0x1
.line 42
invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V
.line 43
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v1
invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
.line 44
.local v0, "resolver":Landroid/content/ContentResolver;
const v1, 0x7f060092 # xml public key
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->addPreferencesFromResource(I)V
.line 46
const-string v1, "key_brightness_slider_show"
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];
iput-object v1, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];
.line 47
iget-object v4, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];
const-string v1, "brightness_slider_show"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-ne v1, v2, :cond_0
move v1, v2
:goto_0
invoke-virtual {v4, v1}, Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];->setChecked(Z)V
.line 57
return-void
:cond_0
move v1, v3
.line 47
goto :goto_0
.end method
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
.locals 5
.param p1, "preferenceScreen" # Landroid/preference/PreferenceScreen;
.param p2, "preference" # Landroid/preference/Preference;
.prologue
const/4 v1, 0x0
const/4 v2, 0x1
.line 61
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];
if-ne p2, v3, :cond_1
.line 62
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];
invoke-virtual {v3}, Landroid/preference/[COLOR="seagreen"]SwitchPreference[/COLOR];->isChecked()Z
move-result v0
.line 63
.local v0, "value":Z
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v3
invoke-virtual {v3}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "brightness_slider_show"
if-eqz v0, :cond_0
move v1, v2
:cond_0
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 78
.end local v0 # "value":Z
:goto_0
return v2
.line 65
:cond_1
invoke-super {p0, p1, p2}, Lcom/android/settings/SettingsPreferenceFragment;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
move-result v2
goto :goto_0
.end method
Now you had done with the code
in this you should look for public id
Where you need to match with xml you created above
This is Switch box preference
If you like to change it to Check Box preference then change all Switch to Checkbox ( also in Xml)
As like below Code ( Look for green part of changes)
Code:
.class public Lcom/android/settings/rz/Statusmod;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "Statusmod.java"
# instance fields
.field private mENABLE_SLIDER:Landroid/preference/CheckBoxPreference;
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 28
invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 5
.param p1, "savedInstanceState" # Landroid/os/Bundle;
.prologue
const/4 v3, 0x0
const/4 v2, 0x1
.line 42
invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V
.line 43
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v1
invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
.line 44
.local v0, "resolver":Landroid/content/ContentResolver;
const v1, 0x7f060092
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->addPreferencesFromResource(I)V
.line 46
const-string v1, "key_brightness_slider_show"
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/CheckBoxPreference;
iput-object v1, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/CheckBoxPreference;
.line 47
iget-object v4, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/CheckBoxPreference;
const-string v1, "brightness_slider_show"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-ne v1, v2, :cond_0
move v1, v2
:goto_0
invoke-virtual {v4, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 57
return-void
:cond_0
move v1, v3
.line 47
goto :goto_0
.end method
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
.locals 5
.param p1, "preferenceScreen" # Landroid/preference/PreferenceScreen;
.param p2, "preference" # Landroid/preference/Preference;
.prologue
const/4 v1, 0x0
const/4 v2, 0x1
.line 61
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/CheckBoxPreference;
if-ne p2, v3, :cond_1
.line 62
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/CheckBoxPreference;
invoke-virtual {v3}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v0
.line 63
.local v0, "value":Z
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v3
invoke-virtual {v3}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "brightness_slider_show"
if-eqz v0, :cond_0
move v1, v2
:cond_0
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 78
.end local v0 # "value":Z
:goto_0
return v2
.line 65
:cond_1
invoke-super {p0, p1, p2}, Lcom/android/settings/SettingsPreferenceFragment;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
move-result v2
goto :goto_0
.end method
If you like to add more in this
Example if you had added new Switch or checkbox
Code:
<PreferenceScreen android:title="New"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<SwitchPreference android:title="Brightness Slider" android:key="brightness_slider_show" android:defaultValue="0" android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden"
<CheckBoxPreference android:title="Nothing Bomb" android:key="key_bomb_show" />
</PreferenceScreen>
first define in xml then i code
i will explain in simple
Look for the above code
Look at this boolean ( from above code)
Code:
.field private mENABLE_SLIDER:Landroid/preference/SwitchPreference;
above/Below Add this line
Code:
.field private mENABLE_BOMB:Landroid/preference/CheckBoxPreference; #define boolean
In this method
.method public onCreate(Landroid/os/BundleV
After :goto_0
You need to add this code
Code:
invoke-virtual {v4, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
const-string v1, "key_bomb_show"
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/CheckBoxPreference;
iput-object v1, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/CheckBoxPreference;
.line 50
iget-object v4, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/CheckBoxPreference;
const-string v1, "bomb_show"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-ne v1, v2, :cond_1
move v1, v2
:goto_1
After goto :goto_0
Add this Code
Code:
:cond_1
move v1, v3
.line 50
goto :goto_1
In this code when you add more first look cond_? and goto_?
Now look for this method
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/PreferenceZ
in that after
.line 65
:cond_1
Add this code
Code:
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/SwitchPreference;
if-ne p2, v3, :cond_2
.line 62
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/SwitchPreference;
invoke-virtual {v3}, Landroid/preference/SwitchPreference;->isChecked()Z
move-result v0
.line 63
.local v0, "value":Z
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v3
invoke-virtual {v3}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "bomb_show"
if-eqz v0, :cond_1
move v1, v2
:cond_1
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 78
.end local v0 # "value":Z
:goto_1
return v2
.line 65
:cond_2
and save finally it looks like this
Code:
.class public Lcom/android/settings/rz/Statusmod;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "Statusmod.java"
# instance fields
.field private mENABLE_SLIDER:Landroid/preference/SwitchPreference;
.field private mENABLE_BOMB:Landroid/preference/CheckBoxPreference;
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 28
invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 5
.param p1, "savedInstanceState" # Landroid/os/Bundle;
.prologue
const/4 v3, 0x0
const/4 v2, 0x1
.line 42
invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V
.line 43
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v1
invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
.line 44
.local v0, "resolver":Landroid/content/ContentResolver;
const v1, 0x7f060092
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->addPreferencesFromResource(I)V
.line 46
const-string v1, "key_brightness_slider_show"
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/SwitchPreference;
iput-object v1, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/SwitchPreference;
.line 47
iget-object v4, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/SwitchPreference;
const-string v1, "brightness_slider_show"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-ne v1, v2, :cond_0
move v1, v2
:goto_0
invoke-virtual {v4, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
const-string v1, "key_bomb_show"
invoke-virtual {p0, v1}, Lcom/android/settings/rz/Statusmod;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/CheckBoxPreference;
iput-object v1, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/CheckBoxPreference;
.line 50
iget-object v4, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/CheckBoxPreference;
const-string v1, "bomb_show"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-ne v1, v2, :cond_1
move v1, v2
:goto_1
invoke-virtual {v4, v1}, Landroid/preference/SwitchPreference;->setChecked(Z)V
.line 57
return-void
:cond_0
move v1, v3
.line 47
goto :goto_0
:cond_1
move v1, v3
.line 50
goto :goto_1
.end method
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
.locals 5
.param p1, "preferenceScreen" # Landroid/preference/PreferenceScreen;
.param p2, "preference" # Landroid/preference/Preference;
.prologue
const/4 v1, 0x0
const/4 v2, 0x1
.line 61
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/SwitchPreference;
if-ne p2, v3, :cond_1
.line 62
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_SLIDER:Landroid/preference/SwitchPreference;
invoke-virtual {v3}, Landroid/preference/SwitchPreference;->isChecked()Z
move-result v0
.line 63
.local v0, "value":Z
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v3
invoke-virtual {v3}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "brightness_slider_show"
if-eqz v0, :cond_0
move v1, v2
:cond_0
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 78
.end local v0 # "value":Z
:goto_0
return v2
.line 65
:cond_1
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/SwitchPreference;
if-ne p2, v3, :cond_2
.line 62
iget-object v3, p0, Lcom/android/settings/rz/Statusmod;->mENABLE_BOMB:Landroid/preference/SwitchPreference;
invoke-virtual {v3}, Landroid/preference/SwitchPreference;->isChecked()Z
move-result v0
.line 63
.local v0, "value":Z
invoke-virtual {p0}, Lcom/android/settings/rz/Statusmod;->getActivity()Landroid/app/Activity;
move-result-object v3
invoke-virtual {v3}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "bomb_show"
if-eqz v0, :cond_1
move v1, v2
:cond_1
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 78
.end local v0 # "value":Z
:goto_1
return v2
.line 65
:cond_2
invoke-super {p0, p1, p2}, Lcom/android/settings/SettingsPreferenceFragment;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
move-result v2
goto :goto_0
.end method
and save it compile and done with your settings preferences
This is how to add preferences
If you add more with different smlai name then change the code path and definition
If you got confused look for my guides that will surely help you

post 3
Method 2
which is very simple
no need to work like in 2nd post (this works but not accurate as above )
Download this View attachment Cm_Settings.zip and merge to your settings
while you create a preference in xml define it as this way
Code:
<PreferenceScreen android:title="New"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<com.android.settings.cyanogenmod.SystemSettingSwitchPreference android:title="Brightness Slider" android:key="brightness_slider_show" android:defaultValue="0" android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden"
<com.android.settings.cyanogenmod.SystemCheckBoxPreference android:title="Nothing Bomb" android:key="bomb_show" />
</PreferenceScreen>
Remember the key code is directly defined ( if you had doubt just start compare)
and done
This is expalantion of these things

It's seems I'm very noob in smali
Lol yeah best guide from @venkat kamesh

Thanks bro works well

learnt to decompile
will learn more bro
sorry bad english
translated

Thanks for your awesome work, bro! This makes it easy to give my ROM a custom feel. There is one bug, the switches always revert back to default every time the page/fragment/etc. is displayed. I have found a way around this and also figured out why it isn't working correctly...but I am not knowledgeable enough in smali to fix it. The issue is that the CM switches don't create a boolean one first instance. They will however control the boolean correctly if it exists.
How I solved:
I put my switches in settings because i'm running 4.4 and don't have rom control. So the path here will be different depending on where you put your switches. If they are in settings like mine you will navigate to /data/data/com.android.settings/shared_prefs/ and open the file com.android.settings_preferences.xml with a root file explorer. You will also need a text editor unless your file explorer has one built in.
Now you have to remember your keys that you used for your switches in your mod
mine are "aokpram_recent," "show_clock," and "stock_battery."
***Note that you have to type them in, I've tried copying and pasting and it will not work.***
Example:
boolean name="show_clock" value="true"
Do this for all of your mod keys and your switches will start working correctly. If I ever figure out a way to make the cmsettings switches generate their own boolean I will post it.

Related

[MOD] [UPDATED]Top battery line indicator with pngs

Hi there, I want to share this tutorial for implementing Top line battery indicator mod.
I have re-made and tweaked (for XWLA4) one of my favourite theme (Dark Theme by Mr. Megi), just to show you how it looks like!
You will find this mod with this theme on the attached zip cwm file - only for deodexed xwla4.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Watch it on youtube fullscreen mode
I started by studying the java source code for handling battery info!
source code -> here
Then i looked into a couple of classes inside SystemUI.apk just to see where i could put my hands..
To better understand the smali code of the classes i modified, i used the java source code here, it is a bit different by the Galaxy S2 implementation but a good start point!
Requirement:
1. Decompiled SystemUI.apk with Apk Manager.
2. Some advanced understanding about editing xml file and smali code.
3. Backup SystemUI.apk first!
Before to start, i'd like to point out that i used XWLA4 firmware as base, but it should work for any firmware with some changes.
Files to be edited in SystemUI.apk:
1. res/layout/status_bar.xml
2. res/values/ids.xml
3. smali/com/android/systemui/statusbar/StatusBarService.smali
4. smali/com/android/systemui/statusbar/StatusBarView.smali
1. Editing SystemUI.apk
1.1 Editing res/layout/status_bar.xml
We need to insert a ViewImage item on the xml for displaying our battery line indicator, normal/charging
Add the following line just above <LinearLayout androidrientation="horizontal" android:id="@id/icons" android:layout_width="fill_parent" android:layout_height="fill_parent">
Code:
<ImageView android:id="@id/battery_indicator_charging" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/battery_indicator_charging" />
2 Edit res/values/ids.xml
We need to add IDs for the item we have added on the status_bar.xml
Add this line at the TOP of the file, this should be the first line!
Code:
<item type="id" name="battery_indicator_charging">false</item>
2.1 Add images to res/drawable-hdpi
We need to add the following 3 images, you will find them attached on my source code!
z_battery_indicator_charging.png
z_battery_indicator.9.png
z_battery_indicator_low.9.png
2.2 Recompile SystemUI.apk
We need to recompile the apk because we need to take care about the ID ref assigned to battery_indicator_charging, and the drawable IDs for images we have added on the previus step.
Now decompile again SystemUI.apk and open res/values/public.xml:
You should see these new entries:
Code:
<public type="drawable" name="z_battery_indicator" id="0x7f0200b8" />
<public type="drawable" name="z_battery_indicator_charging" id="0x7f0200b9" />
<public type="drawable" name="z_battery_indicator_low" id="0x7f0200ba" />
...
<public type="id" name="battery_indicator_charging" id="0x7f0a0034" />
Take note of these 3 IDS: 0x7f0200b8, 0x7f0200ba, 0x7f0a0034
Please note that in your system they can have different values.
3 Editing StatusBarService.smali
We need to intercept addIcon function and when the battery icon is passed as parameter we need to call our function updateBatteryIndicator.
Find this method:
Code:
.method public addIcon(Ljava/lang/String;IILcom/android/internal/statusbar/StatusBarIcon;)V
Add replace it with the code below
Code:
.method public addIcon(Ljava/lang/String;IILcom/android/internal/statusbar/StatusBarIcon;)V
.locals 6
.parameter "slot"
.parameter "index"
.parameter "viewIndex"
.parameter "icon"
.prologue
const-string v5, "battery"
.line 466
new-instance v0, Lcom/android/systemui/statusbar/StatusBarIconView;
invoke-direct {v0, p0, p1}, Lcom/android/systemui/statusbar/StatusBarIconView;-><init>(Landroid/content/Context;Ljava/lang/String;)V
.line 467
.local v0, view:Lcom/android/systemui/statusbar/StatusBarIconView;
invoke-virtual {v0, p4}, Lcom/android/systemui/statusbar/StatusBarIconView;->set(Lcom/android/internal/statusbar/StatusBarIcon;)Z
.line 468
iget-object v1, p0, Lcom/android/systemui/statusbar/StatusBarService;->mStatusIcons:Landroid/widget/LinearLayout;
new-instance v2, Landroid/widget/LinearLayout$LayoutParams;
iget v3, p0, Lcom/android/systemui/statusbar/StatusBarService;->mIconSize:I
iget v4, p0, Lcom/android/systemui/statusbar/StatusBarService;->mIconSize:I
invoke-direct {v2, v3, v4}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V
invoke-virtual {v1, v0, p3, v2}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;ILandroid/view/ViewGroup$LayoutParams;)V
invoke-virtual {v5, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
.line 410
invoke-direct {p0, p4}, Lcom/android/systemui/statusbar/StatusBarService;->updateBatteryIndicator(Lcom/android/internal/statusbar/StatusBarIcon;)V
.line 469
:cond_0
return-void
.end method
Now we need to do the same for "updateIcon" method. Find this method:
Code:
.method public updateIcon(Ljava/lang/String;IILcom/android/internal/statusbar/StatusBarIcon;Lcom/android/internal/statusbar/StatusBarIcon;)V
Replace it with the code below:
Code:
.method public updateIcon(Ljava/lang/String;IILcom/android/internal/statusbar/StatusBarIcon;Lcom/android/internal/statusbar/StatusBarIcon;)V
.locals 2
.parameter "slot"
.parameter "index"
.parameter "viewIndex"
.parameter "old"
.parameter "icon"
.prologue
.line 477
iget-object v1, p0, Lcom/android/systemui/statusbar/StatusBarService;->mStatusIcons:Landroid/widget/LinearLayout;
invoke-virtual {v1, p3}, Landroid/widget/LinearLayout;->getChildAt(I)Landroid/view/View;
move-result-object v0
check-cast v0, Lcom/android/systemui/statusbar/StatusBarIconView;
.line 478
.local v0, view:Lcom/android/systemui/statusbar/StatusBarIconView;
invoke-virtual {v0, p5}, Lcom/android/systemui/statusbar/StatusBarIconView;->set(Lcom/android/internal/statusbar/StatusBarIcon;)Z
const-string v1, "battery"
invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
.line 424
invoke-direct {p0, p5}, Lcom/android/systemui/statusbar/StatusBarService;->updateBatteryIndicator(Lcom/android/internal/statusbar/StatusBarIcon;)V
.line 479
:cond_0
return-void
.end method
It's time to add our method to handle the Update our Battery Indicator!
Code:
.method private updateBatteryIndicator(Lcom/android/internal/statusbar/StatusBarIcon;)V
.locals 2
.parameter "icon"
.prologue
.line 462
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarService;->mStatusBarView:Lcom/android/systemui/statusbar/StatusBarView;
iget-object v0, v0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
iget v1, p1, Lcom/android/internal/statusbar/StatusBarIcon;->iconLevel:I
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setTag(Ljava/lang/Object;)V
.line 463
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarService;->mStatusBarView:Lcom/android/systemui/statusbar/StatusBarView;
iget-object v0, v0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
iget v1, p1, Lcom/android/internal/statusbar/StatusBarIcon;->iconId:I
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setTag(Ljava/lang/Object;)V
.line 464
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarService;->mStatusBarView:Lcom/android/systemui/statusbar/StatusBarView;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/StatusBarView;->requestLayout()V
.line 465
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarService;->mStatusBarView:Lcom/android/systemui/statusbar/StatusBarView;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/StatusBarView;->invalidate()V
.line 466
return-void
.end method
Add this code where you prefer!
Note:
We use setTag function to store an useful info: "batteryLevel" inside the two views we created.
4 Editing StatusBarView.smali
Well on this class we need to change a lot of stuff, i advice to see my attached source code and diff it.
To sum up, this is the class responsible to display the status bar view.
We need to instantiate a "BroadcastReceiver" to intercept this intent: "android.intent.action.SCREEN_ON" That's because we don't want to play the charging animation while the screen is off.
I will report, just to let you understand it better, the java pseudo code where the view is created, here we need to do some calculation to get the correct values (width) for our Barline indicator images. In addition we are creating the animation for battery charging state.
Pseudo Java source code:
Code:
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
if ((!this.mShowBatteryIndicator))
{
this.mBatteryIndicator.setVisibility(8);
this.mBatteryIndicatorCharging.setVisibility(8);
this.mBatteryIndicatorCharging.clearAnimation();
}
else
{
this.mBatteryIndicator.setVisibility(0);
this.mBatteryIndicatorCharging.setVisibility(0);
int j = ((Integer)this.mBatteryIndicator.getTag()).intValue();
this.mBatteryIndicatorWidth = (j * (paramInt3 - paramInt1) / 100);
this.mBatteryIndicatorCharging.layout(paramInt3, paramInt2, paramInt3 + this.mBatteryIndicatorCharging.getMeasuredWidth(), paramInt2 + this.mBatteryIndicatorCharging.getMeasuredHeight());
int i = BATTERY_INDICATOR_ID;
if ((!this.mScreenIsOn) || (chargeIconID != ((Integer)this.mBatteryIndicatorCharging.getTag()).intValue()))
{
this.mBatteryIndicatorCharging.clearAnimation();
if (j < this.mBatteryLowLevel)
i = LOW_BATTERY_INDICATOR_ID;
}
else
{
TranslateAnimation localTranslateAnimation = new TranslateAnimation(0.0F, this.mBatteryIndicatorWidth - (paramInt3 - paramInt1), 0.0F, 0.0F);
localTranslateAnimation.setDuration(1500L);
localTranslateAnimation.setStartOffset(3500L);
localTranslateAnimation.setRepeatCount(-1);
localTranslateAnimation.setRepeatMode(1);
this.mBatteryIndicatorCharging.startAnimation(localTranslateAnimation);
}
this.mBatteryIndicator.setImageResource(i);
this.mBatteryIndicator.layout(paramInt1, paramInt2, paramInt3, paramInt2 + this.mBatteryIndicator.getDrawable().getIntrinsicHeight());
}
}
Smali code
We need to add new field member to this class: StatusBarView. You can add these lines just below: "# instance fields" at the very top!
Code:
.field mBatteryIndicator:Landroid/widget/ImageView;
.field mBatteryIndicatorCharging:Landroid/widget/ImageView;
.field private mBatteryIndicatorWidth:I
.field private mBatteryLowLevel:I
.field private mShowBatteryIndicator:Z
.field mScreenIsOn:Z
.field mIntentReceiver:Landroid/content/BroadcastReceiver;
Now we need to change the constructor of this class to set values for our field members:
Find this method:
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
and replace with the one below.
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals 1
.parameter "context"
.parameter "attrs"
.prologue
.line 56
invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.line 54
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mScreenIsOn:Z
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mShowBatteryIndicator:Z
.line 55
new-instance v0, Lcom/android/systemui/statusbar/StatusBarView$1;
invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/StatusBarView$1;-><init>(Lcom/android/systemui/statusbar/StatusBarView;)V
iput-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mIntentReceiver:Landroid/content/BroadcastReceiver;
const v0, 0x1e
iput v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryLowLevel:I
.line 49
const/4 v0, 0x1
iput v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mStatusBarMarqueeDirection:I
.line 50
const/4 v0, 0x0
iput v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mStatusBarMarqueeRange:I
.line 57
return-void
.end method
Please note on the code above this line: const v0, 0x1e, 0x1e = 30, i set the lowbattery threshold to 30% which means that from this point, the battery charging indicator png will be used! Change it as you like!
Now we need to register our receiver for "Screen On" and "Screen Off" intents.
Find the following method
Code:
.method protected onAttachedToWindow()V
Replace with the following:
Code:
.method protected onAttachedToWindow()V
.locals 5
.prologue
.line 76
invoke-super {p0}, Landroid/widget/FrameLayout;->onAttachedToWindow()V
.line 77
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mService:Lcom/android/systemui/statusbar/StatusBarService;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/StatusBarService;->onBarViewAttached()V
.line 110
new-instance v0, Landroid/content/IntentFilter;
invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V
.line 111
.local v0, filter:Landroid/content/IntentFilter;
const-string v1, "android.intent.action.SCREEN_OFF"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 112
const-string v1, "android.intent.action.SCREEN_ON"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 113
iget-object v1, p0, Lcom/android/systemui/statusbar/StatusBarView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/systemui/statusbar/StatusBarView;->mIntentReceiver:Landroid/content/BroadcastReceiver;
const/4 v3, 0x0
new-instance v4, Landroid/os/Handler;
invoke-direct {v4}, Landroid/os/Handler;-><init>()V
invoke-virtual {v1, v2, v0, v3, v4}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;
return-void
.end method
At this point we need to add a method that take care of unregister our broadcast receiver. Add the following method where you prefer.
Code:
.method protected onDetachedFromWindow()V
.locals 2
.prologue
.line 127
invoke-super {p0}, Landroid/widget/FrameLayout;->onDetachedFromWindow()V
.line 128
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mContext:Landroid/content/Context;
iget-object v1, p0, Lcom/android/systemui/statusbar/StatusBarView;->mIntentReceiver:Landroid/content/BroadcastReceiver;
invoke-virtual {v0, v1}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
.line 130
return-void
.end method
Let's add a new method responsible for clipping our battery indicator png image based on the current value of mBatteryIndicatorWidth field (i.e the current level)
Code:
.method public onDraw(Landroid/graphics/Canvas;)V
.locals 4
.parameter "canvas"
.prologue
.line 224
iget-boolean v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mShowBatteryIndicator:Z
if-eqz v0, :cond_0
.line 225
invoke-virtual {p1}, Landroid/graphics/Canvas;->save()I
.line 226
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v0}, Landroid/widget/ImageView;->getLeft()I
move-result v0
iget-object v1, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getTop()I
move-result v1
iget v2, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorWidth:I
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v3}, Landroid/widget/ImageView;->getBottom()I
move-result v3
invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->clipRect(IIII)Z
.line 231
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v0, p1}, Landroid/widget/ImageView;->draw(Landroid/graphics/Canvas;)V
.line 232
invoke-virtual {p1}, Landroid/graphics/Canvas;->restore()V
.line 234
:cond_0
invoke-super {p0, p1}, Landroid/widget/FrameLayout;->onDraw(Landroid/graphics/Canvas;)V
.line 235
return-void
.end method
4.1 Create a new smali file: StatusBarView$1.smali
Copy the following code in your file, and save it in smali/com/android/systemui/statusbar/
Code:
.method constructor <init>(Lcom/android/systemui/statusbar/StatusBarView;)V
.locals 0
.parameter
.prologue
.line 60
iput-object p1, p0, Lcom/android/systemui/statusbar/StatusBarView$1;->this$0:Lcom/android/systemui/statusbar/StatusBarView;
invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V
return-void
.end method
# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
.locals 3
.parameter "context"
.parameter "intent"
.prologue
.line 63
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView$1;->this$0:Lcom/android/systemui/statusbar/StatusBarView;
const-string v1, "android.intent.action.SCREEN_ON"
invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
iput-boolean v1, v0, Lcom/android/systemui/statusbar/StatusBarView;->mScreenIsOn:Z
.line 64
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView$1;->this$0:Lcom/android/systemui/statusbar/StatusBarView;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/StatusBarView;->requestLayout()V
.line 65
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView$1;->this$0:Lcom/android/systemui/statusbar/StatusBarView;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/StatusBarView;->invalidate()V
.line 66
return-void
.end method
Now replace the methods: "onAttachedToWindow" with the code below:
Code:
.method protected onAttachedToWindow()V
.locals 5
.prologue
.line 76
invoke-super {p0}, Landroid/widget/FrameLayout;->onAttachedToWindow()V
.line 77
iget-object v0, p0, Lcom/android/systemui/statusbar/StatusBarView;->mService:Lcom/android/systemui/statusbar/StatusBarService;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/StatusBarService;->onBarViewAttached()V
.line 110
new-instance v0, Landroid/content/IntentFilter;
invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V
.line 111
.local v0, filter:Landroid/content/IntentFilter;
const-string v1, "android.intent.action.SCREEN_OFF"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 112
const-string v1, "android.intent.action.SCREEN_ON"
invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V
.line 113
iget-object v1, p0, Lcom/android/systemui/statusbar/StatusBarView;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/systemui/statusbar/StatusBarView;->mIntentReceiver:Landroid/content/BroadcastReceiver;
const/4 v3, 0x0
new-instance v4, Landroid/os/Handler;
invoke-direct {v4}, Landroid/os/Handler;-><init>()V
invoke-virtual {v1, v2, v0, v3, v4}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;
return-void
.end method
Almost finished , now we need to modify the method "onLayout":
search for this line: return-void and replace with goto :goto_3 then add the following code just belowe this line: goto :goto_0
Code:
:goto_3
const/4 v4, 0x0
iget-boolean v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mShowBatteryIndicator:Z
if-eqz v3, :cond_3
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v3, v4}, Landroid/widget/ImageView;->setVisibility(I)V
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v3, v4}, Landroid/widget/ImageView;->setVisibility(I)V
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v3}, Landroid/widget/ImageView;->getTag()Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/Integer;
invoke-virtual {v3}, Ljava/lang/Integer;->intValue()I
move-result v2
.local v2, batteryLevel:I
sub-int v3, p4, p2
mul-int/2addr v3, v2
div-int/lit8 v3, v3, 0x64
iput v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorWidth:I
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
iget-object v4, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v4}, Landroid/widget/ImageView;->getMeasuredWidth()I
move-result v4
add-int/2addr v4, p4
iget-object v5, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v5}, Landroid/widget/ImageView;->getMeasuredHeight()I
move-result v5
add-int/2addr v5, p3
invoke-virtual {v3, p4, p3, v4, v5}, Landroid/widget/ImageView;->layout(IIII)V
const v1, 0x7f0200b8
.local v1, batteryIndicatorDrawableId:I
iget-boolean v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mScreenIsOn:Z
if-eqz v3, :cond_4
const v4, 0x10802c3
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v3}, Landroid/widget/ImageView;->getTag()Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/Integer;
invoke-virtual {v3}, Ljava/lang/Integer;->intValue()I
move-result v3
if-eq v4, v3, :cond_4
new-instance v0, Landroid/view/animation/TranslateAnimation;
iget v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorWidth:I
sub-int v4, p4, p2
sub-int/2addr v3, v4
int-to-float v3, v3
invoke-direct {v0, v6, v3, v6, v6}, Landroid/view/animation/TranslateAnimation;-><init>(FFFF)V
.local v0, animation:Landroid/view/animation/TranslateAnimation;
const-wide/16 v3, 0x5dc
invoke-virtual {v0, v3, v4}, Landroid/view/animation/TranslateAnimation;->setDuration(J)V
const-wide/16 v3, 0xdac
invoke-virtual {v0, v3, v4}, Landroid/view/animation/TranslateAnimation;->setStartOffset(J)V
const/4 v3, -0x1
invoke-virtual {v0, v3}, Landroid/view/animation/TranslateAnimation;->setRepeatCount(I)V
const/4 v3, 0x1
invoke-virtual {v0, v3}, Landroid/view/animation/TranslateAnimation;->setRepeatMode(I)V
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v3, v0}, Landroid/widget/ImageView;->startAnimation(Landroid/view/animation/Animation;)V
.end local v0 #animation:Landroid/view/animation/TranslateAnimation;
:cond_5
:goto_2
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v3, v1}, Landroid/widget/ImageView;->setImageResource(I)V
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
iget-object v4, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v4}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;
move-result-object v4
invoke-virtual {v4}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I
move-result v4
add-int/2addr v4, p3
invoke-virtual {v3, p2, p3, p4, v4}, Landroid/widget/ImageView;->layout(IIII)V
.end local v1 #batteryIndicatorDrawableId:I
.end local v2 #batteryLevel:I
:goto_1
return-void
.restart local v1 #batteryIndicatorDrawableId:I
.restart local v2 #batteryLevel:I
:cond_4
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v3}, Landroid/widget/ImageView;->clearAnimation()V
iget v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryLowLevel:I
if-ge v2, v3, :cond_5
const v1, 0x7f0200ba
goto :goto_2
.end local v1 #batteryIndicatorDrawableId:I
.end local v2 #batteryLevel:I
:cond_3
const/16 v5, 0x8
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicator:Landroid/widget/ImageView;
invoke-virtual {v3, v5}, Landroid/widget/ImageView;->setVisibility(I)V
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v3, v5}, Landroid/widget/ImageView;->setVisibility(I)V
iget-object v3, p0, Lcom/android/systemui/statusbar/StatusBarView;->mBatteryIndicatorCharging:Landroid/widget/ImageView;
invoke-virtual {v3}, Landroid/widget/ImageView;->clearAnimation()V
goto :goto_1
.end method
Finally, we need to adjust values to match our Ref ID (drawable images and battery_indicator ID)
chargeIconID in my pseudo code is used to verify if the phone is charging, in my attached source code you will see the line below
The following value (inside onLayout method) is used to verify if the phone is charging.
const v6, 0x10802c3
Decompile framework-res.apk and open /res/values/public.xml, search for this string: name="stat_sys_battery_charge"
Code:
<public type="drawable" name="stat_sys_battery_charge" id="0x10802c3" />
Make sure that the id you are using match with that value!
Now we need to take care about one ID used by onFinishInflate method:
const v1, 0x7f0a0034
need to match with our ID in res/values/public.xml
<public type="id" name="battery_indicator_charging" id="0x7f0a0034" />
The same for the method onLayout but this time we need to take care about 2 IDs:
const v1, 0x7f0200b8
<public type="drawable" name="z_battery_indicator" id="0x7f0200b8" />
const v1, 0x7f0200ba
<public type="drawable" name="z_battery_indicator_low" id="0x7f0200ba" />
Hope this helps you guys!
nice! thank you
Good work Leo.
I will try to port it to ICS .
nice work, but who is SanX and what has he cracked? lol
Congratulations for this very detailed howto! Just a thought: MIUI has this by default, you'll most probably take less time flashing MIUI than applying these mods!
thunderteaser said:
Congratulations for this very detailed howto! Just a thought: MIUI has this by default, you'll most probably take less time flashing MIUI than applying these mods!
Click to expand...
Click to collapse
It's for the devs, not regular users
I've been using the application onibar which does this really well as its an overlay.
Sent from my GT-I9100 using xda premium
Are there any advantages compared to this?
xethor said:
Are there any advantages compared to this?
Click to expand...
Click to collapse
Well if you go with the OP approach then you don't need the app. From an end user the app you linked to is fine. For devs however this can be integrated and forgo the need for the app altogether.
Tomorrow i will update this tutorial as i have made another mod that uses png for battery line indicator, it's much better since themer can change color, trasparency,..
xethor said:
Are there any advantages compared to this?
Click to expand...
Click to collapse
Yes, that applications start a background service that poll battery info, it will drain your battery..
Also this application doesn't animate the battery indicator while charging.
The mod i post instead is built in on the systemUI statusbar service!
In addition, with this mod (it will be updated tomorrow) it is also possible to change png for battery line indicator, not just the color as the app you mentioned!
Hey Leo, will this be implemented in CheckROM RevoHDâ„¢ V4 and future versions?Or at least given as a MOD in the kitchen?
Hollow.Droid said:
It's for the devs, not regular users
Click to expand...
Click to collapse
But it's so well written and clear! I guess a user could do this, that's why I'm talking just about time.
Hi Leo !
Will you make it as a script and we just need to flash it ?
Pleaseeeee...
joezy07 said:
Hi Leo !
Will you make it as a script and we just need to flash it ?
Pleaseeeee...
Click to expand...
Click to collapse
Yes please in ICS blue too!!!!!!!!!!!!!!!!!!!!!!
sorry. i just flashd Intratech's Frankenstein LA4. it has the top battery line indicator. did he already implement this.?
what is the diff from this ?
what is different from this Leo? thanks
mariosraptor said:
what is different from this Leo? thanks
Click to expand...
Click to collapse
see the post a few ones back... it drains the battery more... and also the charging is not animated in the market app
Yes, that applications start a background service that poll battery info, it will drain your battery..
Also this application doesn't animate the battery indicator while charging.
The mod i post instead is built in on the systemUI statusbar service!
In addition, with this mod (it will be updated tomorrow) it is also possible to change png for battery line indicator, not just the color as the app you mentioned!
Click to expand...
Click to collapse
seriously awesome....
I have updated the OP, now this mod uses png images, it's much better since themers can change the aspect of these bars without any effort.

[MOD / How To][5/11/13] - Extended Reboot Menu - De-Odex - MDL

Reboot options as show :good:
Pre-requisites
De-Odex'ed devices only! Will not work on stock ROM!
Must have the the MDL De-Odex mod by Nottach to use this mod!
Installation
I used similar install method as Nottach to apply this mod.
Download the attachment. Unzip it to your desktop.
Simply copy the "Mods" folder to your internal storage
Run the "Mod Me.bat" file after copying
It will copy the mod to the correct location, clear cache, then reboot phone.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Feel free to use this in any mod or ROM you make.
Hit Thanks!​
To make this mod your self or further modify it do the following;
First decompile classes.dex in android.policy.jar. I wont get into that part as this mini tutorial assumes you know how to modify smali code.
Add the following BOLD ITALIC code to \com\android\internal\policy\impl\GlobalActions$SinglePressAction.smali
Modded Code:
Code:
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation
[B][I]# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
[/I][/B]
# instance fields
.field private final mIcon:Landroid/graphics/drawable/Drawable;
.field private final mIconResId:I
.field private final mMessage:Ljava/lang/CharSequence;
.field private final mMessageResId:I
# direct methods
[B][I].method static constructor <clinit>()V
.registers 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Restart Shell"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Download"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method[/I][/B]
.method protected constructor <init>(II)V[I][/I]
FYI: You can change the string names to what you like best. For example most people word the second string as "Hot reboot" but I think that sounds lame so I call it what it is and that is a shell restart. Another example would be to change "Download" to "Download Mode"
Then change \com\android\internal\policy\impl\GlobalActions.smali
right below .line 566
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;
to
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
Then create three smali files as shown below and add them to: \com\android\internal\policy\impl\
GlobalActions$99.smali
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$99;
.super Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.source "GlobalActions.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions;->createDialog()Landroid/app/AlertDialog;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/GlobalActions;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
.registers 4
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
invoke-direct {p0, p2, p3}, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;-><init>(II)V
return-void
.end method
# virtual methods
.method public onPress()V
.registers 7
const/4 v5, 0x4
new-instance v1, Landroid/app/AlertDialog$Builder;
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v2}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v2
invoke-direct {v1, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
const-string v2, "Reboot Menu"
invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v1
sget-object v2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
const/4 v3, 0x0
new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$99$2;
invoke-direct {v4, p0}, Lcom/android/internal/policy/impl/GlobalActions$99$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V
invoke-virtual {v1, v2, v3, v4}, Landroid/app/AlertDialog$Builder;->setSingleChoiceItems([Ljava/lang/CharSequence;ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
move-result-object v1
const v2, 0x104000a
new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$99$1;
invoke-direct {v3, p0}, Lcom/android/internal/policy/impl/GlobalActions$99$1;-><init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V
invoke-virtual {v1, v2, v3}, Landroid/app/AlertDialog$Builder;->setPositiveButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
move-result-object v1
const/high16 v2, 0x104
const/4 v3, 0x0
invoke-virtual {v1, v2, v3}, Landroid/app/AlertDialog$Builder;->setNegativeButton(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
move-result-object v1
invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;
move-result-object v0
invoke-virtual {v0}, Landroid/app/AlertDialog;->getWindow()Landroid/view/Window;
move-result-object v1
const/16 v2, 0x7d9
invoke-virtual {v1, v2}, Landroid/view/Window;->setType(I)V
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v1}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v1
const v2, 0x111000f
invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getBoolean(I)Z
move-result v1
if-nez v1, :cond_58
invoke-virtual {v0}, Landroid/app/AlertDialog;->getWindow()Landroid/view/Window;
move-result-object v1
invoke-virtual {v1, v5, v5}, Landroid/view/Window;->setFlags(II)V
:cond_58
invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V
return-void
.end method
.method public showBeforeProvisioning()Z
.registers 2
.prologue
.line 307
const/4 v0, 0x1
return v0
.end method
.method public showConditional()Z
.registers 2
.prologue
.line 311
const/4 v0, 0x1
return v0
.end method
.method public showDuringKeyguard()Z
.registers 2
.prologue
.line 304
const/4 v0, 0x1
return v0
.end method
GlobalActions$99$1.smali
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$99$1;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions$99;->onPress()V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$1:Lcom/android/internal/policy/impl/GlobalActions$99;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V
.registers 2
.parameter
.prologue
.line 281
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$99$1;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
.registers 7
.parameter "dialog"
.parameter "whichButton"
.prologue
const/4 v2, 0x1
const/4 v3, 0x0
.line 282
sget v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I
const/4 v1, -0x1
if-le v0, v1, :cond_20
.line 291
sget v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I
const/4 v1, 0x4
if-eq v0, v1, :cond_4d
.line 283
sget v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I
if-eq v0, v2, :cond_2c
.line 284
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$99$1;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;
iget-object v0, v0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v0
sget v1, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I
if-nez v1, :cond_21
const/4 v1, 0x0
:goto_1d
invoke-static {v0, v1, v3}, Lcom/android/server/power/ShutdownThread;->reboot(Landroid/content/Context;Ljava/lang/String;Z)V
.line 291
:cond_20
:goto_20
return-void
.line 284
:cond_21
sget-object v1, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
sget v2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I
aget-object v1, v1, v2
invoke-virtual {v1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;
move-result-object v1
goto :goto_1d
.line 288
:cond_2c
:try_start_2c
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v0
const/4 v1, 0x4
new-array v1, v1, [Ljava/lang/String;
const/4 v2, 0x0
const-string v3, "pkill"
aput-object v3, v1, v2
const/4 v2, 0x1
const-string v3, "-TERM"
aput-object v3, v1, v2
const/4 v2, 0x2
const-string v3, "-f"
aput-object v3, v1, v2
const/4 v2, 0x3
const-string v3, "system_server"
aput-object v3, v1, v2
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;
:try_end_4a
.catch Ljava/lang/Exception; {:try_start_2c .. :try_end_4a} :catch_4b
goto :goto_20
.line 290
:catch_4b
move-exception v0
goto :goto_20
:cond_4d
iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions$99$1;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;
iget-object v0, v0, Lcom/android/internal/policy/impl/GlobalActions$99;->this$0:Lcom/android/internal/policy/impl/GlobalActions;
#getter for: Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
invoke-static {v0}, Lcom/android/internal/policy/impl/GlobalActions;->access$000(Lcom/android/internal/policy/impl/GlobalActions;)Landroid/content/Context;
move-result-object v0
const/4 v1, 0x0
invoke-static {v0, v1}, Lcom/android/server/power/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
goto :goto_20
.end method
GlobalActions$99$2.smali
Code:
.class Lcom/android/internal/policy/impl/GlobalActions$99$2;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Lcom/android/internal/policy/impl/GlobalActions$99;->onPress()V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$1:Lcom/android/internal/policy/impl/GlobalActions$99;
# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/GlobalActions$99;)V
.registers 2
iput-object p1, p0, Lcom/android/internal/policy/impl/GlobalActions$99$2;->this$1:Lcom/android/internal/policy/impl/GlobalActions$99;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
.registers 3
sput p2, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootMode:I
return-void
.end method
Recompile and done!
You can also change the names of the reboot method to your liking!
Slowly but surely here comes the goodies. Cant wait for flashy time for AT&T.
ATT S4 Rooted. Beastin.
4.2.2
Scrosler you are the man! Hell ya dude thanks!! I envy your talent
"Tettering" ay, right. Slow down a little, I can't keep up. Very usefull reboot menu. Works for me.
sent from my SGH-i317
Dean1650 said:
"Tettering" ay, right. Slow down a little, I can't keep up. Very usefull reboot menu. Works for me.
sent from my SGH-i317
Click to expand...
Click to collapse
Hehehehe.... It was a tough choice my friend. Hardest phone choice I had to make but then after owning both I decided this was going to be a power house!
Me slow down? Never! :angel:
Did you see my launcher mod in themes and apps?
scrosler said:
Hehehehe.... It was a tough choice my friend. Hardest phone choice I had to make but then after owning both I decided this was going to be a power house!
Me slow down? Never! :angel:
Did you see my launcher mod in themes and apps?
Click to expand...
Click to collapse
No, but I'm headed over there now.
sent from my SGH-i317
scrosler said:
Hehehehe.... It was a tough choice my friend. Hardest phone choice I had to make but then after owning both I decided this was going to be a power house!
Me slow down? Never! :angel:
Did you see my launcher mod in themes and apps?
Click to expand...
Click to collapse
Thought you were going back to Verizon?
Sent from my HTC One using Tapatalk 2
powerwagon said:
Thought you were going back to Verizon?
Sent from my HTC One using Tapatalk 2
Click to expand...
Click to collapse
I did. The people on Verizon bought me a Note II (when it came out). But I wanted the SGS4 so I broke into my donation fund and bought (part of it anyways).
I now develop for 4 phones, SGS4, Note II (All carriers), SGS3, and HTC One X... and the Nexus 10 Tablet.
scrosler said:
I did. The people on Verizon bought me a Note II (when it came out). But I wanted the SGS4 so I broke into my donation fund and bought (part of it anyways).
I now develop for 4 phones, SGS4, Note II (All carriers), SGS3, and HTC One X... and the Nexus 10 Tablet.
Click to expand...
Click to collapse
Cant wait to be running cleanrom on this! Def one of the best devs in the game, glad you kept it
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
Can't wait for mine to come in the mail... Thanks to you guys who able to do this awesome work. Hope I can help out or at least test some stuff out for you guys.
Sent from my SGS3 using xda premium
Deodexed System Installer ran from Noattach but i am still not able to get this mod to work i am updated to the lastest AMDL and deodexed verifiyed by checking build info Nottach.JDQ39.I337UCUAMDL anyone have any ideas ? as to what the problem is .
tokoam said:
Deodexed System Installer ran from Noattach but i am still not able to get this mod to work i am updated to the lastest AMDL and deodexed verifiyed by checking build info Nottach.JDQ39.I337UCUAMDL anyone have any ideas ? as to what the problem is .
Click to expand...
Click to collapse
And you used the installer with this mod?
Yes I did
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
tokoam said:
Yes I did
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
Click to expand...
Click to collapse
Did you get an error messages?
scrosler said:
Did you get an error messages?
Click to expand...
Click to collapse
No error message in cmd batch file
Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
i try right
It does not work for me either
Just says waiting for s4. The other installer works fine I even tried just pushing me jar file but that did not work either
Sent from my SAMSUNG-SGH-I337 using xda premium
And you have ADB installed and in the Windows path?
I have updated the instructions to be more specific and included an alternate installer with the ADB executables.

[MOD][HOW-TO] Quick Unlock on Pin/Password with toggle

This will allow the PIN and Password unlock screens to be unlock as soon as the correct pin/password is input without having to press the enter key to submit.
**UPDATE** Updated for Lollipop
Thanks to @tdunham for updating this guide for 4.4.2. See here: http://forum.xda-developers.com/showpost.php?p=54905593&postcount=54
We're going to be working with the following two files:
SecSettings.apk
android.policy.jar
KEY
REMOVE what's in BLUE
ADD what's in RED
SecSettings.apk
Navigate to /res/values/strings.xml
Add the following to the end of the file
Code:
<string name="quick_unlock_title">Quick Unlock</string>
<string name="quick_unlock_summary">Unlock as soon as correct pin is entered</string>
Navigate to /xml/security_settings_password.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen android:persistent="false" android:title="@string/unlock_set_unlock_launch_picker_title" android:key="unlock_set_or_change" android:summary="@string/unlock_set_unlock_mode_password" />
<SwitchPreferenceScreen android:title="@string/dualclock_settings_title" android:key="dualclock_settings" android:summary="@string/dualclock_settings_summary" android:fragment="com.android.settings.dualclock.DualClockSetting" />
<CheckBoxPreference android:title="@string/with_cicle_title" android:key="with_circle" android:summary="@string/with_cicle_summary" android:defaultValue="false" />
<PreferenceScreen android:title="@string/lock_screen_options" android:key="lock_screen_options" android:summary="@string/lock_screen_options_summary" android:fragment="com.android.settings.LockScreenSettings" />
<CheckBoxPreference android:title="@string/quick_note_title" android:key="quick_note" android:summary="@string/quick_note_summary" android:defaultValue="false" />
<ListPreference android:persistent="false" android:entries="@array/lock_after_timeout_entries" android:title="@string/lock_after_timeout" android:key="lock_after_timeout" android:summary="@string/lock_after_timeout_summary" android:entryValues="@array/lock_after_timeout_values" />
<CheckBoxPreference android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" android:key="power_button_instantly_locks" />
[COLOR="Red"]<CheckBoxPreference android:title="@string/quick_unlock_title" android:key="quick_unlock" android:summary="@string/quick_unlock_summary" />[/COLOR]
<PreferenceScreen android:title="@string/owner_info_settings_title" android:key="owner_info_settings" android:summary="@string/owner_info_settings_summary" android:fragment="com.android.settings.OwnerInfoSettings" />
</PreferenceScreen>
Navigate to /xml/security_settings_pin.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen android:persistent="false" android:title="@string/unlock_set_unlock_launch_picker_title" android:key="unlock_set_or_change" android:summary="@string/unlock_set_unlock_mode_pin" />
<SwitchPreferenceScreen android:title="@string/dualclock_settings_title" android:key="dualclock_settings" android:summary="@string/dualclock_settings_summary" android:fragment="com.android.settings.dualclock.DualClockSetting" />
<CheckBoxPreference android:title="@string/with_cicle_title" android:key="with_circle" android:summary="@string/with_cicle_summary" android:defaultValue="false" />
<PreferenceScreen android:title="@string/lock_screen_options" android:key="lock_screen_options" android:summary="@string/lock_screen_options_summary" android:fragment="com.android.settings.LockScreenSettings" />
<CheckBoxPreference android:title="@string/quick_note_title" android:key="quick_note" android:summary="@string/quick_note_summary" android:defaultValue="false" />
<ListPreference android:persistent="false" android:entries="@array/lock_after_timeout_entries" android:title="@string/lock_after_timeout" android:key="lock_after_timeout" android:summary="@string/lock_after_timeout_summary" android:entryValues="@array/lock_after_timeout_values" />
<CheckBoxPreference android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" android:key="power_button_instantly_locks" />
<CheckBoxPreference android:title="@string/lockpattern_settings_enable_tactile_feedback_title" android:key="unlock_tactile_feedback" />
[COLOR="red"]<CheckBoxPreference android:title="@string/quick_unlock_title" android:key="quick_unlock" android:summary="@string/quick_unlock_summary" />[/COLOR]
<PreferenceScreen android:title="@string/owner_info_settings_title" android:key="owner_info_settings" android:summary="@string/owner_info_settings_summary" android:fragment="com.android.settings.OwnerInfoSettings" />
</PreferenceScreen>
Navigate to /smali/com/android/settings/LockscreenMenuSettings.smali
Code:
.field private mPowerButtonInstantlyLocks:Landroid/preference/CheckBoxPreference;
.field private mQuicknote:Landroid/preference/CheckBoxPreference;
[COLOR="red"].field private mQuickUnlock:Landroid/preference/CheckBoxPreference;[/COLOR]
.field private mSignatureVerificationLevel:Landroid/preference/ListPreference;
.field private mTactileFeedback:Landroid/preference/CheckBoxPreference;
.method private createPreferenceHierarchy()Landroid/preference/PreferenceScreen;
WAIT!
WAIT!
You need to grab some ID's. Luckily they're already available so no need to compile, etc.!
There's only two.
Code:
:cond_5
const-string v4, "quick_note"
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v4
check-cast v4, Landroid/preference/CheckBoxPreference;
iput-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
.line 203
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
if-eqz v4, :cond_6
const v4, 0x7f07004f
if-eq v2, v4, :cond_6
.line 205
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z
.line 208
:cond_6
[COLOR="red"] const-string v4, "quick_unlock"
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v4
check-cast v4, Landroid/preference/CheckBoxPreference;
iput-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
.line 203
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
if-eqz v4, :cond_next
const v4, 0x7f070051 # type="xml" name="security_settings_password"
if-eq v2, v4, :cond_next
const v4, 0x7f070054 # type="xml" name="security_settings_pin"
if-eq v2, v4, :cond_next
.line 205
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z
:cond_next[/COLOR]
const-string v4, "visiblesignature"
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v4
check-cast v4, Landroid/preference/CheckBoxPreference;
iput-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mVisibleSignature:Landroid/preference/CheckBoxPreference;
WAIT!
WAIT!
Did you replace those two ID's in that last section? Good. Let's continue.
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/PreferenceZ
Code:
:cond_8
const-string v5, "quick_note"
invoke-virtual {v5, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v5
if-eqz v5, :cond_a
.line 503
invoke-virtual {p0}, Lcom/android/settings/LockscreenMenuSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v6, "lock_screen_quick_note"
iget-object v7, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
invoke-virtual {v7}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v7
if-eqz v7, :cond_9
move v3, v4
:cond_9
invoke-static {v5, v6, v3}, Landroid/provider/Settings$Secure;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_0
.line 504
:cond_a
[COLOR="red"]const-string v5, "quick_unlock"
invoke-virtual {v5, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v5
if-eqz v5, :cond_next
.line 503
invoke-virtual {p0}, Lcom/android/settings/LockscreenMenuSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v6, "quick_unlock"
iget-object v7, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
invoke-virtual {v7}, Landroid/preference/CheckBoxPreference;->isChecked()Z
move-result v7
if-eqz v7, :cond_quick
move v3, v4
:cond_quick
invoke-static {v5, v6, v3}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_0
.line 504
:cond_next[/COLOR]
const-string v3, "visiblesignature"
invoke-virtual {v3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_b
.method public onResume()V
Code:
:cond_2
iget-object v1, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
if-eqz v1, :cond_3
.line 438
iget-object v1, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/LockscreenMenuSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "lock_screen_quick_note"
invoke-static {v4, v5, v3}, Landroid/provider/Settings$Secure;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-eqz v4, :cond_8
:goto_1
invoke-virtual {v1, v2}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 440
:cond_3
[COLOR="red"]iget-object v1, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
if-eqz v1, :cond_next
.line 438
iget-object v1, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
invoke-virtual {p0}, Lcom/android/settings/LockscreenMenuSettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v4
const-string v5, "quick_unlock"
invoke-static {v4, v5, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v4
if-eqz v4, :cond_quick
:goto_quick
invoke-virtual {v1, v2}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
.line 440
:cond_next[/COLOR]
iget-object v1, p0, Lcom/android/settings/LockscreenMenuSettings;->mVisibleSignature:Landroid/preference/CheckBoxPreference;
if-eqz v1, :cond_4
.line 441
iget-object v1, p0, Lcom/android/settings/LockscreenMenuSettings;->mVisibleSignature:Landroid/preference/CheckBoxPreference;
invoke-virtual {v0}, Lcom/android/internal/widget/LockPatternUtils;->isVisibleSignatureEnabled()Z
move-result v2
invoke-virtual {v1, v2}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V
Code:
:cond_7
move v1, v3
.line 434
goto :goto_0
:cond_8
move v2, v3
.line 438
goto :goto_1
[COLOR="red"]:cond_quick
move v2, v3
goto :goto_quick[/COLOR]
.end method
That's it for SecSettings. Compile.
android.policy.jar
4.1.x
Navigate to /smali/com/android/internal/policy/impl/PasswordUnlockScreen.smali
Code:
.field private mPwdPolicy:Landroid/app/enterprise/PasswordPolicy;
.field private mResuming:Z
[COLOR="Red"].field private mQuickUnlock:Z[/COLOR]
.field private final mStatusViewManager:Lcom/android/internal/policy/impl/KeyguardStatusViewManager;
.field private final mUpdateMonitor:Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;
.method public constructor <init>(Landroid/content/Context;Landroid/content/res/Configuration;Lcom/android/internal/widget/LockPatternUtils;Lcom/android/internal/policy/impl/KeyguardUpdateMonitor;Lcom/android/internal/policy/impl/KeyguardScreenCallbackV
Code:
iget-object v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mPasswordEntry:Landroid/widget/EditText;
const/16 v2, 0x81
invoke-virtual {v1, v2}, Landroid/widget/EditText;->setInputType(I)V
.line 250
:goto_4
iget-object v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mPasswordEntry:Landroid/widget/EditText;
new-instance v2, Lcom/android/internal/policy/impl/PasswordUnlockScreen$4;
invoke-direct {v2, p0}, Lcom/android/internal/policy/impl/PasswordUnlockScreen$4;-><init>(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)V
invoke-virtual {v1, v2}, Landroid/widget/EditText;->setOnClickListener(Landroid/view/View$OnClickListener;)V
.line 255
[COLOR="red"]iget-object v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const/4 v3, 0x0
const-string v9, "quick_unlock"
invoke-static {v1, v9, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
const/4 v2, 0x1
if-ne v1, v2, :cond_quick
move v1, v2
:goto_quick
iput-boolean v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mQuickUnlock:Z[/COLOR]
iget-object v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mPasswordEntry:Landroid/widget/EditText;
new-instance v2, Lcom/android/internal/policy/impl/PasswordUnlockScreen$5;
invoke-direct {v2, p0}, Lcom/android/internal/policy/impl/PasswordUnlockScreen$5;-><init>(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)V
invoke-virtual {v1, v2}, Landroid/widget/EditText;->addTextChangedListener(Landroid/text/TextWatcher;)V
Code:
new-instance v1, Lcom/android/internal/policy/impl/PasswordUnlockScreen$2;
invoke-direct {v1, p0}, Lcom/android/internal/policy/impl/PasswordUnlockScreen$2;-><init>(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)V
invoke-virtual {v10, v1}, Landroid/view/View;->setOnLongClickListener(Landroid/view/View$OnLongClickListener;)V
goto/16 :goto_3
.line 181
.end local v10 #pinDelete:Landroid/view/View;
:cond_f
const/4 v1, 0x0
goto :goto_5
[COLOR="red"]:cond_quick
move v1, v3
goto :goto_quick[/COLOR]
.line 242
:cond_10
iget-object v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mPasswordEntry:Landroid/widget/EditText;
invoke-static {}, Landroid/text/method/DigitsKeyListener;->getInstance()Landroid/text/method/DigitsKeyListener;
move-result-object v2
invoke-virtual {v1, v2}, Landroid/widget/EditText;->setKeyListener(Landroid/text/method/KeyListener;)V
.line 243
iget-object v1, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mPasswordEntry:Landroid/widget/EditText;
const/16 v2, 0x12
invoke-virtual {v1, v2}, Landroid/widget/EditText;->setInputType(I)V
goto/16 :goto_4
.end method
Add the following methods:
Code:
.method static synthetic access$100(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)Landroid/widget/EditText;
.locals 1
.parameter "x0"
.prologue
.line 76
iget-object v0, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mPasswordEntry:Landroid/widget/EditText;
return-object v0
.end method
[COLOR="Red"].method static synthetic access$1000(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)Z
.locals 1
.parameter "x0"
.prologue
.line 76
iget-boolean v0, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mQuickUnlock:Z
return v0
.end method
.method static synthetic access$1100(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)Lcom/android/internal/widget/LockPatternUtils;
.locals 1
.parameter "x0"
.prologue
.line 76
iget-object v0, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
return-object v0
.end method[/COLOR]
.method static synthetic access$200(Lcom/android/internal/policy/impl/PasswordUnlockScreen;)Lcom/android/internal/policy/impl/KeyguardScreenCallback;
.locals 1
.parameter "x0"
.prologue
.line 76
iget-object v0, p0, Lcom/android/internal/policy/impl/PasswordUnlockScreen;->mCallback:Lcom/android/internal/policy/impl/KeyguardScreenCallback;
return-object v0
.end method
Now download the zip attached to this post and extract to the root of your project.
Compile and enjoy!
4.3
Navigate to smali/com/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView.smali
Add the following in red:
Code:
.field protected mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
.field protected mPasswordEntry:Landroid/widget/TextView;
[COLOR="Red"].field private mQuickUnlock:Z[/COLOR]
Add the following method in red:
Code:
.method static synthetic access$300(Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;)Landroid/widget/Button;
.locals 1
.parameter "x0"
.prologue
.line 68
iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;->mEmergencyButton:Landroid/widget/Button;
return-object v0
.end method
[COLOR="red"].method static synthetic access$400(Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;)Z
.locals 1
.parameter "x0"
.prologue
.line 42
iget-boolean v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;->mQuickUnlock:Z
return v0
.end method[/COLOR]
.method protected onFinishInflate()V
Make sure this is larger than 3
Code:
.method protected onFinishInflate()V
[COLOR="Red"] .locals 4[/COLOR]
Code:
.line 176
iget-object v1, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;->mPasswordEntry:Landroid/widget/TextView;
new-instance v2, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView$1;
invoke-direct {v2, p0}, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView$1;-><init>(Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;)V
invoke-virtual {v1, v2}, Landroid/widget/TextView;->setOnClickListener(Landroid/view/View$OnClickListener;)V
[COLOR="red"]iget-object v1, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "quick_unlock"
const/4 v3, 0x0
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-eqz v1, :cond_quick
const/4 v1, 0x1
:goto_0
iput-boolean v1, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;->mQuickUnlock:Z[/COLOR]
.line 182
iget-object v1, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;->mPasswordEntry:Landroid/widget/TextView;
new-instance v2, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView$2;
invoke-direct {v2, p0}, Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView$2;-><init>(Lcom/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView;)V
invoke-virtual {v1, v2}, Landroid/widget/TextView;->addTextChangedListener(Landroid/text/TextWatcher;)V
Code:
:cond_2
return-void
[COLOR="red"]:cond_quick
const/4 v1, 0x0
goto :goto_0[/COLOR]
.end method
Awesome stuff my man!
(P.S. I think you might have a toggle problem. )
Edit:
Works perfect. :good:
upndwn4par said:
Awesome stuff my man!
(P.S. I think you might have a toggle problem. )
Click to expand...
Click to collapse
I love me some toggles!
loserskater said:
I love me some toggles!
Click to expand...
Click to collapse
I love how all of your mods include the toggle in the Settings app! I hate having to have a seperate tweak/mod app.
Much props and huge apprectiation for passing on your modding/deving knowledge!
Sent from my SAMSUNG-SGH-I747 using xda app-developers app
Thanks man for this feature. For me this will be the killer feature on Touchwiz ROM. Do we need decomplie the APK and JAR file mentioned in the OP. I am bad in coding
shane87 said:
I love how all of your mods include the toggle in the Settings app! I hate having to have a seperate tweak/mod app.
Much props and huge apprectiation for passing on your modding/deving knowledge!
Sent from my SAMSUNG-SGH-I747 using xda app-developers app
Click to expand...
Click to collapse
It's good, but awkward on updates!
Many thanks for this! do you know if it will work on a galaxy note 2 tw based 4.1.2 rom? no worries if not, i will try later and let you guys know
Found it in values/public. notepad++ was being finicky when I searched
Thanks for this brother, and for sharing all your knowledge
worked like a dream. Thanks !
I'm trying to follow your guide but I am getting a compile error at the end and I think I'm lost on this part that you explain...
---------------------------------------------------------------------------------------------------------------------
.method private createPreferenceHierarchy()Landroid/preference/PreferenceScreen;
WAIT!
WAIT!
You need to grab some ID's. Luckily they're already available so no need to compile, etc.!
There's only two.
Code:
:cond_5
const-string v4, "quick_note"
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->findPreference(Ljava/lang/CharSequenceLandroid/preference/Preference;
move-result-object v4
check-cast v4, Landroid/preference/CheckBoxPreference;
iput-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
.line 203
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
if-eqz v4, :cond_6
const v4, 0x7f07004f
if-eq v2, v4, :cond_6
.line 205
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuicknote:Landroid/preference/CheckBoxPreference;
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/PreferenceZ
.line 208
:cond_6
const-string v4, "quick_unlock"
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->findPreference(Ljava/lang/CharSequenceLandroid/preference/Preference;
move-result-object v4
check-cast v4, Landroid/preference/CheckBoxPreference;
iput-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
.line 203
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
if-eqz v4, :cond_next
const v4, 0x7f070051 # type="xml" name="security_settings_password"
if-eq v2, v4, :cond_next
const v4, 0x7f070054 # type="xml" name="security_settings_pin"
if-eq v2, v4, :cond_next
.line 205
iget-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mQuickUnlock:Landroid/preference/CheckBoxPreference;
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/PreferenceZ
:cond_next
const-string v4, "visiblesignature"
invoke-virtual {v3, v4}, Landroid/preference/PreferenceScreen;->findPreference(Ljava/lang/CharSequenceLandroid/preference/Preference;
move-result-object v4
check-cast v4, Landroid/preference/CheckBoxPreference;
iput-object v4, p0, Lcom/android/settings/LockscreenMenuSettings;->mVisibleSignature:Landroid/preference/CheckBoxPreference;
WAIT!
WAIT!
Did you replace those two ID's in that last section? Good. Let's continue.
-----------------------------------------------------------------------------------------------------------------
I was just adding the red. What do you mean by grabbing ID's and replacing ID's? Specific thing that's not universal that I have to figure out?(sorry for ignorance, i'm not a developer/experienced with coding)
lmike6453 said:
I'm trying to follow your guide but I am getting a compile error at the end and I think I'm lost on this part that you explain...
I was just adding the red. What do you mean by grabbing ID's and replacing ID's? Specific thing that's not universal that I have to figure out?(sorry for ignorance, i'm not a developer/experienced with coding)
Click to expand...
Click to collapse
Look in the code for lines that have the #
Code:
const v4, [COLOR="Red"]0x7f070051[/COLOR] # type="xml" name="security_settings_password"
Now search in /res/values/public.xml for what's after the #
You should see something like
Code:
<public type="xml" name="security_settings_pattern" id="[COLOR="red"]0x7f070051[/COLOR]" />
Now look back at the line in the smali and replace the 0x7fxxxxxx with what is in your public.xml (Match what's in red)
loserskater said:
Look in the code for lines that have the #
Code:
const v4, [COLOR="Red"]0x7f070051[/COLOR] # type="xml" name="security_settings_password"
Now search in /res/values/public.xml for what's after the #
You should see something like
Code:
<public type="xml" name="security_settings_pattern" id="[COLOR="red"]0x7f070051[/COLOR]" />
Now look back at the line in the smali and replace the 0x7fxxxxxx with what is in your public.xml (Match what's in red)
Click to expand...
Click to collapse
Loser,
He has a point as the way you explain about the part in getting the id's is a bit different than I've seen in others. I had to do a double take to make sure I was understanding the wording.
I love this mod though...so simple but negates out the "ok" step to make it seem more fluid
Remember that doing these mods is not for everyone. Loser is very kind to even bother explaining how to match the ids (or anything else for that matter). Most devs post the mod and don't offer any support. Everyone should try not to bother him too much.
upndwn4par said:
Remember that doing these mods is not for everyone. Loser is very kind to even bother explaining how to match the ids (or anything else for that matter). Most devs post the mod and don't offer any support. Everyone should try not to bother him too much.
Click to expand...
Click to collapse
Just trying to see where the guy was coming from. I myself probably didn't even come across how I meant to. I wasn't complaining.
So if I'm not "good enough" I don't need to post ?
loserskater said:
Look in the code for lines that have the #
Code:
const v4, [COLOR="Red"]0x7f070051[/COLOR] # type="xml" name="security_settings_password"
Now search in /res/values/public.xml for what's after the #
You should see something like
Code:
<public type="xml" name="security_settings_pattern" id="[COLOR="red"]0x7f070051[/COLOR]" />
Now look back at the line in the smali and replace the 0x7fxxxxxx with what is in your public.xml (Match what's in red)
Click to expand...
Click to collapse
Many thanks for the reply and guidance! I can understand how annoying dumb questions can get and I hope that mine does not discourage ya in any way.
Always know that ppl in my shoes that are just "getting my feet wet" appreciate it that much more since your guides for such useful MODS are a rarity among developers as upndwn4par explained.
I will give it another go and post back my findings for TW based 4.1.2 ROM for Galaxy Note 2 that I'll be attempting it for :good:
hednik said:
Just trying to see where the guy was coming from. I myself probably didn't even come across how I meant to. I wasn't complaining.
So if I'm not "good enough" I don't need to post ?
Click to expand...
Click to collapse
That was not directed at you buddy, but everyone in general.
Just reminding everyone that these are dev level mods.
I post these guides in hopes that people will attempt to get into learning how they work instead of just copy and pasting the guide. I know smali is a crazy foreign language to most people and it is a very steep learning curve, but anybody that sees these guides and starts seeing patterns, and then attempt to do their own mods is a great success to me.
You're right that the ID section is vague, but I'm hoping that people have done enough mods that they will understand what is meant. It's just one of those things that I don't want to post in every how-to. I have mulitple guides that explain how to get IDs that I don't see the point in posting it over and over. I also don't mind answering people that have issues with getting ID's (as you can see in my previous post) so it's not that big of an issue.
And I don't mind being bothered as long as it's in my thread and not a PM. I'm MUCH more likely to help if you post in the thread. It also allows other users to help out if they've come across the issue you're having which helps me out a lot.
Hi Loserskater,
I'm trying to apply the mod to the Galaxy S2. When i apply the changes to SecSettings.apk, I get an error:
Code:
I: Smaling...
[3177,16] Label "cond_quick" is not defined.
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: C:\Users\Do Khac Minh Duc\Desktop\apktool\SecSettings\smali\com\android\settin
gs\LockscreenMenuSettings.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:66)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:50)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:257)
at brut.androlib.Androlib.buildSources(Androlib.java:214)
at brut.androlib.Androlib.build(Androlib.java:205)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Can you please tell me, what I'm doing wrong? I have already changed line references to match the S2 smali.
I'll attach the publics.xml and LockscreenMenuSettings.smali.
Thanks for your response in advance!

[TUTORIAL] [MOD] Add Android ICS Platlogo

Hello Today I again Here i have make ICS Platlogo for Our Phone
Required
Framework.jar
Deodex ROM
AndroidICSPlatlogo
AF-Apk Go Here Click Here
Instructions:
1) Decompile Your framework.jar
2)Go in /smali/com/android/internal/app/PlatLogoActivity.smali
3)Remove All Lines
4) Add This
Code:
.class public Lcom/android/internal/app/PlatLogoActivity;
.super Landroid/app/Activity;
.source "PlatLogoActivity.java"
# direct methods
.method public constructor <init>()V
.registers 1
.prologue
.line 12
invoke-direct {p0}, Landroid/app/Activity;-><init>()V
return-void
.end method
# virtual methods
.method protected onCreate(Landroid/os/Bundle;)V
.registers 7
.parameter "savedInstanceState"
.prologue
.line 16
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
.line 18
new-instance v1, Landroid/content/Intent;
const-string v2, "android.intent.action.MAIN"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 19
.local v1, intent:Landroid/content/Intent;
new-instance v2, Landroid/content/ComponentName;
const-string v3, "com.androidfire.ics"
const-string v4, "com.androidfire.ics.PlatLogoActivity"
invoke-direct {v2, v3, v4}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
invoke-virtual {v1, v2}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
.line 23
:try_start_16
invoke-virtual {p0, v1}, Lcom/android/internal/app/PlatLogoActivity;->startActivity(Landroid/content/Intent;)V
:try_end_19
.catch Landroid/content/ActivityNotFoundException; {:try_start_16 .. :try_end_19} :catch_1d
.line 39
:goto_19
invoke-virtual {p0}, Lcom/android/internal/app/PlatLogoActivity;->finish()V
.line 41
return-void
.line 31
:catch_1d
move-exception v0
.line 35
.local v0, e:Landroid/content/ActivityNotFoundException;
const-string v2, "First install that app AndroidFire told you to!"
const/4 v3, 0x0
invoke-static {p0, v2, v3}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v2
invoke-virtual {v2}, Landroid/widget/Toast;->show()V
goto :goto_19
.end method
5)Recompile Push to /system/framework
6)Install AndoidICSPlatlogo as Normal App
7)Reboot Your Phone
8)Go to Settings About Section
9)Click 3.x Times on Android Version
Credits:-
Eggster
Credits: @iamareebjamal @Giupy 99
Specially to NineOldAndroid
Downoad
In Attachment
nyc guide
:good:great ..Keep it up
good

[Guide][tut] [Enable/Disable] Navigation bar Tint ( depends on app material )

Hello guys here i am presenting you new guide
a small mod from my Krypton rom
this is for both MM and LP
For MM look for post#2
So i will discuss from LP
First you need
android.policy.jar (deodexed)
settings.apk (deodexed)
1. Decompile android.policy.jar
2. open com/android/internal/policy/impl/PhoneWindow.smali
find this method
Code:
.method private getOptionsPanelGravity()I
before that add these methods
Code:
.method private getNavBarColorMod(I)I
.locals 4
const/high16 v2, -0x1000000
move/from16 v1, p1
iget v3, p0, Lcom/android/internal/policy/impl/PhoneWindow;->mStatusBarColor:I
invoke-direct {p0}, Lcom/android/internal/policy/impl/PhoneWindow;->getNavBarTweak()Z
move-result v0
if-eqz v0, :cond_0
or-int v1, v2, v3
:cond_0
return v1
.end method
.method private getNavBarTweak()Z
.locals 3
const/4 v0, -0x1
invoke-virtual {p0}, Lcom/android/internal/policy/impl/PhoneWindow;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "navbar_color_mod"
invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-nez v1, :cond_0
const/4 v0, 0x0
:goto_0
return v0
:cond_0
const/4 v0, 0x1
goto :goto_0
.end method
3. now from this method
Code:
.method protected generateLayout(Lcom/android/internal/policy/impl/PhoneWindow$DecorView;)Landroid/view/ViewGroup;
look for this code
Code:
invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z
move-result v25
if-eqz v25, :cond_1a
.line 3479
if-nez v22, :cond_1a
const/16 v25, 0x22
const/16 v26, 0x0
move/from16 v0, v25
move/from16 v1, v26
invoke-virtual {v4, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
move-result v25
if-eqz v25, :cond_1a
Note this :cond_1a (1a may vary with device may not be same )
in that before
Code:
if-eqz v25, :cond_1a
add this code
Code:
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindow;->getNavBarTweak()Z
move-result v0
if-nez v0, :cond_ta
after the same line of
Code:
if-eqz v25, :cond_1a
add this
Code:
:cond_ta
Finally it look like this
Code:
invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z
move-result v25
if-eqz v25, :cond_1a
.line 3479
if-nez v22, :cond_1a
const/16 v25, 0x22
const/16 v26, 0x0
move/from16 v0, v25
move/from16 v1, v26
invoke-virtual {v4, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
move-result v25
[COLOR="red"] invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindow;->getNavBarTweak()Z
move-result v0
if-nez v0, :cond_ta[/COLOR]
if-eqz v25, :cond_1a
[COLOR="Red"] :cond_ta[/COLOR]
4. Now look for this line in same method
Code:
iput v0, v1, Lcom/android/internal/policy/impl/PhoneWindow;->mNavigationBarColor:I
Before that add this code
Code:
invoke-direct {v1, v0}, Lcom/android/internal/policy/impl/PhoneWindow;->getNavBarColorMod(I)I
move-result v0
5. Done.....! save and compile and replace
For settings Go to post #3
Have fun
For MM
First you need
framework.jar (deodexed)
settings.apk (deodexed)
1. Decompile framework.jar
2. open framework.jar/smali/com/android/internal/policy/PhoneWindow.smali
find this method
Code:
.method private getOptionsPanelGravity()I
before that add these methods
Code:
.method private getNavBarColorMod(I)I
.locals 4
const/high16 v2, -0x1000000
move/from16 v1, p1
iget v3, p0, Lcom/android/internal/policy/PhoneWindow;->mStatusBarColor:I
invoke-direct {p0}, Lcom/android/internal/policy/PhoneWindow;->getNavBarTweak()Z
move-result v0
if-eqz v0, :cond_0
or-int v1, v2, v3
:cond_0
return v1
.end method
.method private getNavBarTweak()Z
.locals 3
const/4 v0, -0x1
invoke-virtual {p0}, Lcom/android/internal/policy/PhoneWindow;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "navbar_color_mod"
invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-nez v1, :cond_0
const/4 v0, 0x0
:goto_0
return v0
:cond_0
const/4 v0, 0x1
goto :goto_0
.end method
3. now from this method
Code:
.method protected generateLayout(Lcom/android/internal/policy/PhoneWindow$DecorView;)Landroid/view/ViewGroup;
look for this code
Code:
invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z
move-result v21
if-eqz v21, :cond_15
.line 4035
if-nez v19, :cond_15
.line 4036
const/16 v21, 0x22
.line 4037
const/16 v22, 0x0
.line 4035
move/from16 v0, v21
move/from16 v1, v22
invoke-virtual {v3, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
move-result v21
if-eqz v21, :cond_15
Note this :cond_15 (15 may vary with device may not be same )
in that before
Code:
if-eqz v21, :cond_15
add this code
Code:
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/PhoneWindow;->getNavBarTweak()Z
move-result v0
if-nez v0, :cond_ta
after the same line of
Code:
if-eqz v21, :cond_15
add this
Code:
:cond_ta
Finally it look like this
Code:
invoke-static {}, Landroid/app/ActivityManager;->isHighEndGfx()Z
move-result v21
if-eqz v21, :cond_15
.line 4035
if-nez v19, :cond_15
.line 4036
const/16 v21, 0x22
.line 4037
const/16 v22, 0x0
.line 4035
move/from16 v0, v21
move/from16 v1, v22
invoke-virtual {v3, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
move-result v21
[COLOR="red"] invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/PhoneWindow;->getNavBarTweak()Z
move-result v0
if-nez v0, :cond_ta[/COLOR]
if-eqz v21, :cond_15
[COLOR="Red"] :cond_ta[/COLOR]
4. Now look for this line in same method
Code:
iput v0, v1, Lcom/android/internal/policy/PhoneWindow;->mNavigationBarColor:I
Before that add this code
Code:
invoke-direct {v1, v0}, Lcom/android/internal/policy/PhoneWindow;->getNavBarColorMod(I)I
move-result v0
5. Done.....! save and compile and replace
For settings Go to post #3
Have fun
Settings for MM and LP
hmm
its time for settings part
i had no time to write a new code..
so try to follow guide from here ( click here )
in that you need to replace
Code:
android:key="[COLOR="Red"]navbar_color_mod[/COLOR]"
or Download this Zip (Click here)
merge to settings
in any part of your xml ( example :- settings.apk/res/xml/display_settings.xml )
add this line
Code:
<com.android.settings.cyanogenmod.SystemSettingSwitchPreference android:title="NavBar Tint" android:key="navbar_color_mod" android:defaultValue="0" android:summaryOn="Enabled" android:summaryOff="Disabled"
Save it and compile and have fun
Credits
xpirt for basic mod
Me for MM and LP krypton rom
Dont forget to Mention me if you use my work
Good luck
Not working on stock rom?-
Black Nav on Homescreen 6.0.1
karrouma said:
Not working on stock rom?-
Click to expand...
Click to collapse
this is for both stock and other roms bro
ReadReadz said:
Black Nav on Homescreen 6.0.1
Click to expand...
Click to collapse
new home doesn't support material
so its black bro
venkat kamesh said:
hmm
its time for settings part
i had no time to write a new code..
so try to follow guide from here ( click here )
in that you need to replace
Code:
android:key="[COLOR="Red"]navbar_color_mod[/COLOR]"
or Download this Zip (Click here)
merge to settings
in any part of your xml ( example :- settings.apk/res/xml/display_settings.xml )
add this line
Code:
<com.android.settings.cyanogenmod.SystemSettingSwitchPreference android:title="NavBar Tint" android:key="navbar_color_mod" android:defaultValue="0" android:summaryOn="Enabled" android:summaryOff="Disabled"
Save it and compile and have fun
Credits
xpirt for basic mod
Me for MM and LP krypton rom
Dont forget to Mention me if you use my work
Good luck
Click to expand...
Click to collapse
Can't glash via recovery. Meta file is missing
how to set defaut tinted without edit settings just edit on android.policy.jar?lolipop 5.1.1
Hey bro,
I'm trying to use this with your SwitchPreferences guide. The toggle switch works, but the nav bar is always tinted, it doesn't change. I've changed all the keys and made sure that my XML is good, but nothing happens.
My XML is like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/wireless_networks_settings_title"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceCategory android:title="@string/rm_ui_navbar_resize_category" />
<com.android.settings.rz.MySeekBarPreference android:title="@string/rm_ui_navbar_resize_portrait" android:key="navigation_bar_height" settings:type="15" />
<com.android.settings.rz.MySeekBarPreference android:title="@string/rm_ui_navbar_resize_landscape" android:key="navigation_bar_width" settings:type="16" />
<PreferenceCategory android:title="@string/rm_ui_navbar_tweak_category" />
<SwitchPreference android:title="@string/rm_ui_navbar_tint_toggle" android:key="key_navbar_color_mod" android:defaultValue="false" android:summaryOn="@string/rm_ui_navbar_tint_toggle_on" android:summaryOff="@string/rm_ui_navbar_tint_toggle_off" />
</PreferenceScreen>
And my smali like so:
Code:
.class public Lcom/android/settings/rz/EnableNavBarTint;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "EnableNavBarTint.java"
# instance fields
.field private mENABLE_NAV_BAR_TINT:Landroid/preference/SwitchPreference;
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 28
invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 5
.param p1, "savedInstanceState" # Landroid/os/Bundle;
.prologue
const/4 v3, 0x0
const/4 v2, 0x1
.line 42
invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V
.line 43
invoke-virtual {p0}, Lcom/android/settings/rz/EnableNavBarTint;->getActivity()Landroid/app/Activity;
move-result-object v1
invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
.line 44
.local v0, "resolver":Landroid/content/ContentResolver;
const v1, 0x7f08008a # xml public key
invoke-virtual {p0, v1}, Lcom/android/settings/rz/EnableNavBarTint;->addPreferencesFromResource(I)V
.line 46
const-string v1, "key_navbar_color_mod"
invoke-virtual {p0, v1}, Lcom/android/settings/rz/EnableNavBarTint;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
check-cast v1, Landroid/preference/SwitchPreference;
iput-object v1, p0, Lcom/android/settings/rz/EnableNavBarTint;->mENABLE_NAV_BAR_TINT:Landroid/preference/SwitchPreference;
.line 47
iget-object v4, p0, Lcom/android/settings/rz/EnableNavBarTint;->mENABLE_NAV_BAR_TINT:Landroid/preference/SwitchPreference;
const-string v1, "navbar_color_mod"
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
if-ne v1, v2, :cond_0
move v1, v2
:goto_0
invoke-virtual {v4, v1}, Landroid/preference/SwitchPreference;->setChecked(Z)V
.line 57
return-void
:cond_0
move v1, v3
.line 47
goto :goto_0
.end method
.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
.locals 5
.param p1, "preferenceScreen" # Landroid/preference/PreferenceScreen;
.param p2, "preference" # Landroid/preference/Preference;
.prologue
const/4 v1, 0x0
const/4 v2, 0x1
.line 61
iget-object v3, p0, Lcom/android/settings/rz/EnableNavBarTint;->mENABLE_NAV_BAR_TINT:Landroid/preference/SwitchPreference;
if-ne p2, v3, :cond_1
.line 62
iget-object v3, p0, Lcom/android/settings/rz/EnableNavBarTint;->mENABLE_NAV_BAR_TINT:Landroid/preference/SwitchPreference;
invoke-virtual {v3}, Landroid/preference/SwitchPreference;->isChecked()Z
move-result v0
.line 63
.local v0, "value":Z
invoke-virtual {p0}, Lcom/android/settings/rz/EnableNavBarTint;->getActivity()Landroid/app/Activity;
move-result-object v3
invoke-virtual {v3}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v3
const-string v4, "navbar_color_mod"
if-eqz v0, :cond_0
move v1, v2
:cond_0
invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
.line 78
.end local v0 # "value":Z
:goto_0
return v2
.line 65
:cond_1
invoke-super {p0, p1, p2}, Lcom/android/settings/SettingsPreferenceFragment;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z
move-result v2
goto :goto_0
.end method
Any ideas bro?
Screenshot please. Thanks

Categories

Resources