FORUMS

Android 5.1.1 Omni ROM For Motorola Xoom

Back in Feb 2011, the Motorola Xoom became the first device to be sold with Android 3.0 … more

CleanSlate Brings Fingerprint Scanner Mod to HTC One M9+

Work of XDA Recognized Developer tbalden, CleanSlate custom kernel for the HTC … more

Sunday Debate: Which Factors Caused HTC’s Woes?

Join us in a fun Sunday Debate on HTC’s situation. Come with your … more

HTC’s New Ad Campaign And What It Really Means

HTC has just released three new blind test adverts comparing app loading … more

MOD][GUIDE] Stand Alone Battery Bar With Options

129 posts
Thanks Meter: 82
 
By syaeful, Senior Member on 7th March 2015, 05:49 PM
Post Reply Subscribe to Thread Email Thread
Original Guide is made by Didact74 here :

[MOD][GUIDE] Stand Alone Battery Bar w/Options and color picker


All credit to him and Kryten2k35 for some smali method



This guide allows you to add the battery bar to your ROM with out any Add-On APKs

Ok, let's go to guide!!!

We will be working with two files:
SystemUI.apk
SecSettings.apk

Note : Blue=add

PART I, Secsettings.apk


navigate to res/xml/display_settings.xml
Code:
<PreferenceCategory android:title="@string/battery_bar_setting" android:key="battery_icon_category">
		<ListPreference android:entries="@array/battery_bar_entries" android:title="@string/battery_bar" android:key="battery_bar" android:entryValues="@array/battery_bar_values" />
		<ListPreference android:entries="@array/battery_bar_style_entries" android:title="@string/battery_bar_style_title" android:key="battery_bar_style" android:entryValues="@array/battery_bar_style_values" />
		<ListPreference android:entries="@array/battery_bar_thickness_entries" android:title="@string/battery_bar_thickness_title" android:key="battery_bar_thickness" android:entryValues="@array/battery_bar_thickness_values" />
		<CheckBoxPreference android:title="@string/battery_bar_animate_title" android:key="battery_bar_animate" android:summary="@string/battery_bar_animate_summary" />
	</PreferenceCategory>
	<PreferenceCategory android:title="@string/more_settings" android:key="more_settings" />
Navigate to res/values/arrays
Code:
<string-array name="battery_bar_entries">
        <item>Hide</item>
        <item>Show</item>
        </string-array>
    <string-array name="battery_bar_values">
        <item>0</item>
        <item>1</item>
        </string-array>
    <string-array name="battery_bar_style_entries">
        <item>Regular</item>
        <item>Center-mirrored</item>
    </string-array>
    <string-array name="battery_bar_style_values">
        <item>0</item>
        <item>1</item>
    </string-array>
    <string-array name="battery_bar_thickness_entries">
        <item>1 dp</item>
        <item>2 dp</item>
        <item>3 dp</item>
        <item>4 dp</item>
    </string-array>
    <string-array name="battery_bar_thickness_values">
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
    </string-array>
</resources>


Navigate to res/values/strings
Code:
<string name="battery_bar_setting">Battery Bar Setting</string>
	<string name="battery_bar">Enable battery bar</string>
    <string name="battery_bar_color">Choose battery bar color</string>
    <string name="battery_bar_style_title">Battery bar style</string>
    <string name="battery_bar_thickness_title">Battery Bar Thickness</string>
    <string name="battery_bar_animate_title">Battery Bar Animation</string>
    <string name="battery_bar_animate_summary">Animate bar when charging</string>
    <string name="battery_bar_summary">%s</string>
    <string name="battery_bar_color_summary">Bar color</string>
    <string name="battery_bar_style_title_summary">%s</string>
    <string name="battery_bar_thickness_title_summary">%s</string>
</resources>


Navigate to com/android/setting/DisplaySettings.smali
Code:
.field private mAnimationView:Landroid/widget/ImageView;

.field private mAutoLockmode:Landroid/preference/CheckBoxPreference;

.field mBatteryBarAnimate:Landroid/preference/CheckBoxPreference;
	
.field mBatteryBarList:Landroid/preference/ListPreference;

.field mBatteryBarStyle:Landroid/preference/ListPreference;

.field mBatteryBarThickness:Landroid/preference/ListPreference;


go to : .method private updateState()V
Code:
const-string v4, "button_key_light"

    const/16 v5, 0x5dc

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
	
	iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarList:Landroid/preference/ListPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "battery_bar"

    const/16 v5, 0x0

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarStyle:Landroid/preference/ListPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "battery_bar_style"

    const/16 v5, 0x0

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarThickness:Landroid/preference/ListPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "battery_bar_thickness"

    const/16 v5, 0x0

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

    .line 883
    iget-boolean v0, p0, Lcom/android/settings/DisplaySettings;->mSupportFolderType:Z

    if-eqz v0, :cond_0

    .line 884
    invoke-direct {p0}, Lcom/android/settings/DisplaySettings;->updateAccelerometerRotationSecondCheckbox()V

    .line 885
    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mAutoLockmode:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v4, "sub_lcd_auto_lock"


go to : .method public onCreate(Landroid/os/BundleV
Code:
const-string v10, "font_size"

    invoke-virtual {p0, v10}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v10

    check-cast v10, Landroid/preference/ListPreference;

    iput-object v10, p0, Lcom/android/settings/DisplaySettings;->mFontSizePref:Landroid/preference/ListPreference;

    .line 428
    iget-object v10, p0, Lcom/android/settings/DisplaySettings;->mFontSizePref:Landroid/preference/ListPreference;

    invoke-virtual {v10, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
	
	const-string v11, "battery_bar"

    invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v11

    check-cast v11, Landroid/preference/ListPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarList:Landroid/preference/ListPreference;

    iget-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarList:Landroid/preference/ListPreference;

    invoke-virtual {v11, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V

    const-string v11, "battery_bar_style"

    invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v11

    check-cast v11, Landroid/preference/ListPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarStyle:Landroid/preference/ListPreference;

    iget-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarStyle:Landroid/preference/ListPreference;

    invoke-virtual {v11, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V

    const-string v11, "battery_bar_thickness"

    invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v11

    check-cast v11, Landroid/preference/ListPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarThickness:Landroid/preference/ListPreference;

    iget-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarThickness:Landroid/preference/ListPreference;

    invoke-virtual {v11, p0}, Landroid/preference/ListPreference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
    
    .line 430
    const-string v10, "display_battery_level"


still same method :
Code:
.line 553
    const-string v10, "key_multi_window"

    invoke-virtual {p0, v10}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v10

    check-cast v10, Landroid/preference/CheckBoxPreference;

    iput-object v10, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;
	
	const-string v11, "battery_bar_animate"

    invoke-virtual {p0, v11}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v11

    check-cast v11, Landroid/preference/CheckBoxPreference;

    iput-object v11, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarAnimate:Landroid/preference/CheckBoxPreference;

    .line 554
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v10

    const-string v11, "com.sec.feature.multiwindow.phone"


go to : .method public onPreferenceChange(Landroid/preference/Preference;Ljava/lang/ObjectZ
Code:
.line 1071
    const-string v1, "DisplaySettings"

    const-string v2, "could not persist Touch key light setting"

    invoke-static {v1, v2, v0}, Landroid/util/secutil/Log;->secE(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_4

    .line 1073
    :cond_a
	const-string v2, "battery_bar_style"

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_barstyle

    .line 986
    check-cast p2, Ljava/lang/String;

    invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "battery_bar_style"

    invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 989
    iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarStyle:Landroid/preference/ListPreference;

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarStyle:Landroid/preference/ListPreference;

    iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarStyle:Landroid/preference/ListPreference;

    invoke-virtual {v1}, Landroid/preference/ListPreference;->getEntry()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V

    goto/16 :goto_4

    .line 993
    :cond_barstyle
    const-string v2, "battery_bar"

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_style

    .line 986
    check-cast p2, Ljava/lang/String;

    invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "battery_bar"

    invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 989
    iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarList:Landroid/preference/ListPreference;

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarList:Landroid/preference/ListPreference;

    iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarList:Landroid/preference/ListPreference;

    invoke-virtual {v1}, Landroid/preference/ListPreference;->getEntry()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V

    goto/16 :goto_4

    .line 993
    :cond_style
    const-string v2, "battery_bar_thickness"

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_tickness

    .line 986
    check-cast p2, Ljava/lang/String;

    invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "battery_bar_thickness"

    invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 989
    iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarThickness:Landroid/preference/ListPreference;

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarThickness:Landroid/preference/ListPreference;

    iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarThickness:Landroid/preference/ListPreference;

    invoke-virtual {v1}, Landroid/preference/ListPreference;->getEntry()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V

    goto/16 :goto_4

    .line 993
    :cond_tickness
    const-string v2, "quick_launch"

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2


go to : .method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/PreferenceZ
BEFORE :
Code:
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 990
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 991
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

    if-eqz v0, :cond_16

    :goto_a
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1

    :cond_16
    move v1, v2

    goto :goto_a
.end method


AFTER :
Code:
iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_batteryAnimate  <-- (change from ":cond_0" to new cond below = :cond_batteryAnimate)

    .line 990
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 991
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

    if-eqz v0, :cond_16

    :goto_a
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1

    :cond_16
    move v1, v2

    goto :goto_a
	
	:cond_batteryAnimate
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarAnimate:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p2, v0}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0   <-- (this cond is from old cond i'm marked orange)

    .line 1022
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarAnimate:Landroid/preference/CheckBoxPreference;

    invoke-virtual {v0}, Landroid/preference/CheckBoxPreference;->isChecked()Z

    move-result v0

    .line 1023
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "battery_bar_animate"

    if-eqz v0, :cond_battAnim

    :goto_anM
    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    goto/16 :goto_1     <--- (this cond is from cond above i'm marked yellow)

    :cond_battAnim
    move v1, v2

    goto :goto_anM
.end method


go to : .method public onResume()V
BEFORE :
Code:
.line 821
    :cond_1
    sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

    if-eqz v0, :cond_2

    .line 822
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    if-ne v3, v1, :cond_6

    :goto_2
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 823
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "multi_window_enabled"

    invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

    .line 825
    :cond_2
    return-void

    :cond_3
    move v0, v2


AFTER :
Code:
.line 821
    :cond_1
    sget-boolean v0, Lcom/android/settings/DisplaySettings;->UseMultiWindow:Z

    if-eqz v0, :cond_newAnim

    .line 822
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowPref:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "multi_window_enabled"

    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    if-ne v3, v1, :cond_6

    :goto_2
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 823
    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "multi_window_enabled"

    invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mMultiWindowModeObserver:Landroid/database/ContentObserver;

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
	
	:cond_newAnim
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarAnimate:Landroid/preference/CheckBoxPreference;

    if-eqz v0, :cond_2
	
    .line 3001
    iget-object v0, p0, Lcom/android/settings/DisplaySettings;->mBatteryBarAnimate:Landroid/preference/CheckBoxPreference;

    invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "battery_bar_animate"

    const/4 v1, 0x0

    invoke-static {v3, v4, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    if-eqz v3, :cond_noShow

    const/4 v1, 0x1

    goto :goto_yesShow

    :cond_noShow
    const/4 v1, 0x0

    :goto_yesShow
    invoke-virtual {v0, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

    .line 825
    :cond_2
    return-void

    :cond_3
    move v0, v2



PART II, SystemUI.apk

Navigate to res/layout/tw_status_bar.xml
Code:
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <ImageSwitcher android:id="@id/tickerIcon" android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:layout_marginRight="4.0dip">
            <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="centerInside" />
            <com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" android:scaleType="centerInside" />
        </ImageSwitcher>
        <com.android.systemui.statusbar.phone.TickerView android:id="@id/tickerText" android:paddingTop="2.0dip" android:paddingRight="10.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
            <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:id="@id/ticker_text_view_old" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
            <TextView android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker" android:id="@id/ticker_text_view_new" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
        </com.android.systemui.statusbar.phone.TickerView>
    </LinearLayout>
	<com.android.systemui.statusbar.policy.BatteryBarController android:visibility="gone" android:layout_width="fill_parent" android:layout_height="1.0dip" android:layout_alignParentTop="true" systemui:viewLocation="1" />
</com.android.systemui.statusbar.phone.PhoneStatusBarView>


Navigate to res/values/attrs
Code:
<attr name="viewLocation" format="integer" />
</resources>


Navigate to smali/com/android/systemui/statusbar/policy/Prefs.smali
add this :
Code:
.method public static read(Landroid/content/Context;)Landroid/content/SharedPreferences;
    .locals 2
    .parameter "context"

    .prologue
    .line 32
    const-string v0, "status_bar"

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    return-object v0
.end method

.method public static getLastBatteryLevel(Landroid/content/Context;)I
    .locals 3

    invoke-static {p0}, Lcom/android/systemui/statusbar/policy/Prefs;->read(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    const-string v1, "last_battery_level"

    const/16 v2, 0x32

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v0

    return v0
.end method

.method public static getLastFastChargeState(Landroid/content/Context;)Z
    .locals 3

    invoke-static {p0}, Lcom/android/systemui/statusbar/policy/Prefs;->read(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    const-string v1, "last_fcharge_state"

    const/4 v2, 0x0

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method

.method public static setLastBatteryLevel(Landroid/content/Context;I)V
    .locals 2

    invoke-static {p0}, Lcom/android/systemui/statusbar/policy/Prefs;->edit(Landroid/content/Context;)Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    const-string v1, "last_battery_level"

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    return-void
.end method

.method public static setLastFastChargeState(Landroid/content/Context;Z)V
    .locals 2

    invoke-static {p0}, Lcom/android/systemui/statusbar/policy/Prefs;->edit(Landroid/content/Context;)Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    const-string v1, "last_fcharge_state"

    invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    return-void
.end method


Find the attached zip file and place all files in smali/com/android/systemui/statusbar/policy
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2015-03-08-00-32-33.png
Views:	1834
Size:	58.7 KB
ID:	3199045  
Attached Files
File Type: zip BatBarFiles.zip - [Click for QR Code] (10.3 KB, 210 views)
The Following 3 Users Say Thank You to syaeful For This Useful Post: [ View ]
 
 
7th March 2015, 06:23 PM |#2  
Junior Member
Thanks Meter: 1
 
More
Nice guide sir thanks
The Following User Says Thank You to wahyu adhy wicaksono For This Useful Post: [ View ]
8th March 2015, 04:23 AM |#3  
OP Senior Member
Flag Purbalingga
Thanks Meter: 82
 
More
Quote:
Originally Posted by wahyu adhy wicaksono

Nice guide sir thanks

Thank you sir
8th March 2015, 05:35 AM |#4  
OP Senior Member
Flag Purbalingga
Thanks Meter: 82
 
More
for compare.
I attach :
DisplaySettingsBefore.smali <-- Before edit
DisplaySettingsAfter <-- After edit
Attached Files
File Type: rar DisplaySettings.rar - [Click for QR Code] (30.4 KB, 70 views)
20th April 2015, 11:04 AM |#5  
Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by syaeful

for compare.
I attach :
DisplaySettingsBefore.smali <-- Before edit
DisplaySettingsAfter <-- After edit

i rom 4.1.2 LG not the same SS
--------------------------------------------------------------------------
|Mon 20/04/2015 -- 17:00:33.48|
--------------------------------------------------------------------------
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) Client VM (build 25.40-b25, mixed mode)
I: Checking whether sources has changed...
I: Smaling...
[4698,13] Label "goto_4" is not defined.
[4744,13] Label "goto_4" is not defined.
[4750,4] mismatched tree node: I_STATEMENT_FORMAT35c_METHOD expecting I_CATCHES
[4752,4] mismatched tree node: I_STATEMENT_FORMAT11x expecting <UP>
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: D:\GL F120L\VH\APK-Multi-Tool HDKP\other\..\projects\LGSettings3_2_kp41.apk\smal i\com\android\settings\DisplaySettings.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexF ileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexF ileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuil der.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)
20th April 2015, 03:26 PM |#6  
OP Senior Member
Flag Purbalingga
Thanks Meter: 82
 
More
Quote:
Originally Posted by f120ltn

i rom 4.1.2 LG not the same SS
--------------------------------------------------------------------------
|Mon 20/04/2015 -- 17:00:33.48|
--------------------------------------------------------------------------
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) Client VM (build 25.40-b25, mixed mode)
I: Checking whether sources has changed...
I: Smaling...
[4698,13] Label "goto_4" is not defined.
[4744,13] Label "goto_4" is not defined.
[4750,4] mismatched tree node: I_STATEMENT_FORMAT35c_METHOD expecting I_CATCHES
[4752,4] mismatched tree node: I_STATEMENT_FORMAT11x expecting <UP>
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: D:\GL F120L\VH\APK-Multi-Tool HDKP\other\..\projects\LGSettings3_2_kp41.apk\smal i\com\android\settings\DisplaySettings.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexF ileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexF ileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuil der.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)

ok sir, You can't just copy and paste from guide, you must do compare, because every rom has different condition,
For more easy, follow my guide :
PART I, Secsettings.apk
Download attachment file and merged to your decompiled Settings.apk
navigate to res/xml/display_settings.xml
Code:
<PreferenceCategory android:title="@string/battery_bar_setting" android:key="battery_icon_category">
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_entries" android:title="@string/battery_bar" android:key="battery_bar" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_values" />
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_style_entries" android:title="@string/battery_bar_style_title" android:key="battery_bar_style" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_style_values" />
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_thickness_entries" android:title="@string/battery_bar_thickness_title" android:key="battery_bar_thickness" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_thickness_values" />
        <com.android.settings.syaeful.SystemSettingCheckBoxPreference android:title="@string/battery_bar_animate_title" android:key="battery_bar_animate" android:summary="@string/battery_bar_animate_summary" />
    </PreferenceCategory>
</PreferenceScreen>


Navigate to res/values/arrays.xml
Code:
<string-array name="battery_bar_entries">
        <item>Hide</item>
        <item>Show</item>
        </string-array>
    <string-array name="battery_bar_values">
        <item>0</item>
        <item>1</item>
        </string-array>
    <string-array name="battery_bar_style_entries">
        <item>Regular</item>
        <item>Center-mirrored</item>
    </string-array>
    <string-array name="battery_bar_style_values">
        <item>0</item>
        <item>1</item>
    </string-array>
    <string-array name="battery_bar_thickness_entries">
        <item>1 dp</item>
        <item>2 dp</item>
        <item>3 dp</item>
        <item>4 dp</item>
    </string-array>
    <string-array name="battery_bar_thickness_values">
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
    </string-array>
</resources>


Navigate to res/values/strings.xml
Code:
<string name="battery_bar_setting">Battery Bar Setting</string>
	<string name="battery_bar">Enable battery bar</string>
    <string name="battery_bar_color">Choose battery bar color</string>
    <string name="battery_bar_style_title">Battery bar style</string>
    <string name="battery_bar_thickness_title">Battery Bar Thickness</string>
    <string name="battery_bar_animate_title">Battery Bar Animation</string>
    <string name="battery_bar_animate_summary">Animate bar when charging</string>
    <string name="battery_bar_summary">%s</string>
    <string name="battery_bar_color_summary">Bar color</string>
    <string name="battery_bar_style_title_summary">%s</string>
    <string name="battery_bar_thickness_title_summary">%s</string>
</resources>


finish for part setting.. recompile, sign, push to your system.. check in Display menu. it should not fc.

Note : if you follow this guide for part settings.. skip edit samli DisplaySettings.smali!!!!
Attached Files
File Type: rar smali_checkbox_list.rar - [Click for QR Code] (2.2 KB, 28 views)
The Following User Says Thank You to syaeful For This Useful Post: [ View ]
21st April 2015, 02:17 AM |#7  
Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by syaeful

ok sir, You can't just copy and paste from guide, you must do compare, because every rom has different condition,
For more easy, follow my guide :
PART I, Secsettings.apk
Download attachment file and merged to your decompiled Settings.apk
navigate to res/xml/display_settings.xml

Code:
<PreferenceCategory android:title="@string/battery_bar_setting" android:key="battery_icon_category">
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_entries" android:title="@string/battery_bar" android:key="battery_bar" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_values" />
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_style_entries" android:title="@string/battery_bar_style_title" android:key="battery_bar_style" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_style_values" />
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_thickness_entries" android:title="@string/battery_bar_thickness_title" android:key="battery_bar_thickness" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_thickness_values" />
        <com.android.settings.syaeful.SystemSettingCheckBoxPreference android:title="@string/battery_bar_animate_title" android:key="battery_bar_animate" android:summary="@string/battery_bar_animate_summary" />
    </PreferenceCategory>
</PreferenceScreen>


Navigate to res/values/arrays.xml
Code:
<string-array name="battery_bar_entries">
        <item>Hide</item>
        <item>Show</item>
        </string-array>
    <string-array name="battery_bar_values">
        <item>0</item>
        <item>1</item>
        </string-array>
    <string-array name="battery_bar_style_entries">
        <item>Regular</item>
        <item>Center-mirrored</item>
    </string-array>
    <string-array name="battery_bar_style_values">
        <item>0</item>
        <item>1</item>
    </string-array>
    <string-array name="battery_bar_thickness_entries">
        <item>1 dp</item>
        <item>2 dp</item>
        <item>3 dp</item>
        <item>4 dp</item>
    </string-array>
    <string-array name="battery_bar_thickness_values">
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
    </string-array>
</resources>


Navigate to res/values/strings.xml
Code:
<string name="battery_bar_setting">Battery Bar Setting</string>
	<string name="battery_bar">Enable battery bar</string>
    <string name="battery_bar_color">Choose battery bar color</string>
    <string name="battery_bar_style_title">Battery bar style</string>
    <string name="battery_bar_thickness_title">Battery Bar Thickness</string>
    <string name="battery_bar_animate_title">Battery Bar Animation</string>
    <string name="battery_bar_animate_summary">Animate bar when charging</string>
    <string name="battery_bar_summary">%s</string>
    <string name="battery_bar_color_summary">Bar color</string>
    <string name="battery_bar_style_title_summary">%s</string>
    <string name="battery_bar_thickness_title_summary">%s</string>
</resources>


finish for part setting.. recompile, sign, push to your system.. check in Display menu. it should not fc.

Note : if you follow this guide for part settings.. skip edit samli DisplaySettings.smali!!!!

Thankyou
i work "ok" on file .xml. not edit DisplaySettings.smali
Attached Thumbnails
Click image for larger version

Name:	2015-04-21-10-43-37.jpg
Views:	162
Size:	150.4 KB
ID:	3273739   Click image for larger version

Name:	2015-04-21-13-00-33.jpg
Views:	154
Size:	171.0 KB
ID:	3273878  
Last edited by f120ltn; 21st April 2015 at 07:21 AM.
21st April 2015, 09:27 AM |#8  
OP Senior Member
Flag Purbalingga
Thanks Meter: 82
 
More
Quote:
Originally Posted by f120ltn

Thankyou
i work "ok" on file .xml. not edit DisplaySettings.smali

Yes. Should work. Regards.
The Following User Says Thank You to syaeful For This Useful Post: [ View ]
21st April 2015, 11:03 AM |#9  
Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by syaeful

ok sir, You can't just copy and paste from guide, you must do compare, because every rom has different condition,
For more easy, follow my guide :
PART I, Secsettings.apk
Download attachment file and merged to your decompiled Settings.apk
navigate to res/xml/display_settings.xml

Code:
<PreferenceCategory android:title="@string/battery_bar_setting" android:key="battery_icon_category">
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_entries" android:title="@string/battery_bar" android:key="battery_bar" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_values" />
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_style_entries" android:title="@string/battery_bar_style_title" android:key="battery_bar_style" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_style_values" />
        <com.android.settings.syaeful.SystemSettingListPreference android:entries="@array/battery_bar_thickness_entries" android:title="@string/battery_bar_thickness_title" android:key="battery_bar_thickness" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/battery_bar_thickness_values" />
        <com.android.settings.syaeful.SystemSettingCheckBoxPreference android:title="@string/battery_bar_animate_title" android:key="battery_bar_animate" android:summary="@string/battery_bar_animate_summary" />
    </PreferenceCategory>
</PreferenceScreen>


Navigate to res/values/arrays.xml
Code:
<string-array name="battery_bar_entries">
        <item>Hide</item>
        <item>Show</item>
        </string-array>
    <string-array name="battery_bar_values">
        <item>0</item>
        <item>1</item>
        </string-array>
    <string-array name="battery_bar_style_entries">
        <item>Regular</item>
        <item>Center-mirrored</item>
    </string-array>
    <string-array name="battery_bar_style_values">
        <item>0</item>
        <item>1</item>
    </string-array>
    <string-array name="battery_bar_thickness_entries">
        <item>1 dp</item>
        <item>2 dp</item>
        <item>3 dp</item>
        <item>4 dp</item>
    </string-array>
    <string-array name="battery_bar_thickness_values">
        <item>1</item>
        <item>2</item>
        <item>3</item>
        <item>4</item>
    </string-array>
</resources>


Navigate to res/values/strings.xml
Code:
<string name="battery_bar_setting">Battery Bar Setting</string>
	<string name="battery_bar">Enable battery bar</string>
    <string name="battery_bar_color">Choose battery bar color</string>
    <string name="battery_bar_style_title">Battery bar style</string>
    <string name="battery_bar_thickness_title">Battery Bar Thickness</string>
    <string name="battery_bar_animate_title">Battery Bar Animation</string>
    <string name="battery_bar_animate_summary">Animate bar when charging</string>
    <string name="battery_bar_summary">%s</string>
    <string name="battery_bar_color_summary">Bar color</string>
    <string name="battery_bar_style_title_summary">%s</string>
    <string name="battery_bar_thickness_title_summary">%s</string>
</resources>


finish for part setting.. recompile, sign, push to your system.. check in Display menu. it should not fc.

Note : if you follow this guide for part settings.. skip edit samli DisplaySettings.smali!!!!

Quote:
Originally Posted by syaeful

Yes. Should work. Regards.

style Bar color not work.
22nd April 2015, 05:54 AM |#10  
OP Senior Member
Flag Purbalingga
Thanks Meter: 82
 
More
Quote:
Originally Posted by f120ltn

style Bar color not work.

yes sir. not for now (maybe later will fix).. that's why I did't include the word "colorpicker" in this guide title
The Following User Says Thank You to syaeful For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
battery bar, guide on the fly
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes