Post Reply

[GUIDE][GB] Status bar and notification panel color changer | owner pic mod

OP b16h22

27th June 2013, 05:33 PM   |  #1  
b16h22's Avatar
OP Recognized Themer
Flag Intercooler piping
Thanks Meter: 2,066
 
1,119 posts
Join Date:Joined: Apr 2012
More
Long story short. I decided to port some of my mods to a stock status bar .I tried to make the process relatively easy. So it shouldn't be too much of a problem trying.

Quote:

Status bar and notification panel color changer


Step 1

Decompile your systemui.apk. Extract the attached zip file. Copy the contents into the smali folder.

Step 2

Open res/layout/status_bar.xml.
Find the first line

Code:
<com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="#ff000000" android:focusable="true" android:descendantFocusability="afterDescendants"
Change it to

Code:
<com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="#00000000" android:focusable="true" android:descendantFocusability="afterDescendants"
We just changed the background color to transparent in the above step

After the first line paste this

Code:
    <com.b16h22.statusbar.StatusBar android:id="@id/status_bar" android:layout_width="fill_parent" android:layout_height="fill_parent" />
Now save this file

Step 3

Open res/layout/status_bar_tracking.xml

Find this code just below first line

Code:
    <View android:background="#ff8e979f" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" />
Change it to this

Code:
    <com.b16h22.statusbar.Pulldown android:id="@id/view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" />
Now save this file

Step 4

Open res/values/ids.xml and add these at the end

Code:
    <item type="id" name="status_bar">false</item>
    <item type="id" name="view">false</item>
Save the file and compile systemui.apk.

Step 5


Now decompile the systemui again

Open public.xml and find these

Code:
    <public type="id" name="status_bar" id="0x7f090028" />
    <public type="id" name="view" id="0x7f090029" />

Open smali/com/b16h22/statusbar/StatusBar.smali

Find

Code:
    const v2, 0x7f090026
Change it to the id in blue in public.xml


Code:
    const v2, 0x7f090028

Now open smali/com/b16h22/statusbar/Pulldown.smali

Find

Code:
    const v2, 0x7f090027
Change it to the id in red in public.xml


Code:
    const v2, 0x7f090029

Now re-compile systemui again and push it to phone. Use StatusBarMods.apk from the attachment to change the color.


Quote:

Status bar owner picture

This mod is a little complicated.But if you follow the steps well enough,it's going to be fairly easy.Think twice before asking a doubt.

We are adding owner picture functionality to status bar like android 4.2 and integrate the photo picker to the settings.apk. So let's start with integrating photo picker to settings.I wrote a few classes for this.Extract the "Owner_mod_files_settings.zip" and get the smali files and resource files from it.

Step 1

Get these files from the extracted zip

Code:
res/layout/profile_info.xml
res/drawable/done.xml
res/drawable/pick_profile_picture.xml
res/drawable-ldpi/done_normal.png
res/drawable-ldpi/done_pressed.png
res/drawable-ldpi/ic_qs_default_user.png
res/drawable-ldpi/ic_settings_owner.png
res/drawable-ldpi/pick_profile_normal.png
res/drawable-ldpi/pick_profile_pressed.png
Decompile settings.apk and put the above files in respective folders

Step 2

Get these smali files from the extracted zip and place it in the smali/ folder of decompiled apk

Code:
smali/com/b16h22/Profile.smali
smali/com/b16h22/Profile$1.smali
smali/com/b16h22/Profile$2.smali
Step 3

Now open the ids.xml and add these ids in it

Code:
    <item type="id" name="image">false</item>
    <item type="id" name="owner">false</item>
    <item type="id" name="linear_layout">false</item>
    <item type="id" name="profile_pic">false</item>
    <item type="id" name="layout1">false</item>
    <item type="id" name="change_picture_text">false</item>
    <item type="id" name="photo_picker">false</item>
    <item type="id" name="linear_layout1">false</item>
    <item type="id" name="layout2">false</item>
    <item type="id" name="name_field">false</item>
    <item type="id" name="name_edit">false</item>

Open strings.xml and add these strings

Code:
    <string name="change_pic">Change profile picture</string>
    <string name="profile_pic">SET PROFILE PICTURE</string>
    <string name="profile_name">CHANGE PROFILE NAME</string>

Step 4

Now recompile the apk and decompile it again. Now open the public.xml and find these ids.These may not be the same in your apk. It may differ.I have color coded them to make it easier to distinguish in the upcoming steps

Code:
    <public type="layout" name="profile_info" id="0x7f03005a" />
    <public type="drawable" name="ic_qs_default_user" id="0x7f0200b2" />
    <public type="id" name="image" id="0x7f0b011b" />
    <public type="id" name="owner" id="0x7f0b011c" />
    <public type="id" name="photo_picker" id="0x7f0b0121" />
    <public type="id" name="name_field" id="0x7f0b0124" />
    <public type="id" name="name_edit" id="0x7f0b0125" />
Now open smali/com/b16h22/Profile.smali and find the method

Code:
.method protected onCreate(Landroid/os/Bundle;)V
And replace the ids in it with the ones from public.xml


Code:
.method protected onCreate(Landroid/os/Bundle;)V
    .locals 4
    .parameter "savedInstanceState"

    .prologue
    .line 27
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 28
    const v2, 0x7f03005a # profile_info

    invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->setContentView(I)V

    .line 30
    const v2, 0x7f0b0121 #photo_picker

    invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    .line 31
    .local v0, photo:Landroid/widget/ImageView;
    const v2, 0x7f0b011c # owner

    invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/TextView;

    iput-object v2, p0, Lcom/b16h22/Profile;->owner:Landroid/widget/TextView;

    .line 32
    const v2, 0x7f0b0124 # name_field

    invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/EditText;

    iput-object v2, p0, Lcom/b16h22/Profile;->name:Landroid/widget/EditText;

    .line 33
    const v2, 0x7f0b0125 # name_edit

    invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    iput-object v2, p0, Lcom/b16h22/Profile;->done:Landroid/widget/ImageView;

    .line 34
    const v2, 0x7f0b011b # image

    invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    iput-object v2, p0, Lcom/b16h22/Profile;->imageView:Landroid/widget/ImageView;

    .line 37
    const-string v2, "EvoPrefsFile"

    const/4 v3, 0x0

    invoke-virtual {p0, v2, v3}, Lcom/b16h22/Profile;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 38
    .local v1, sharedPreferences:Landroid/content/SharedPreferences;
    const-string v2, "profileName"

    const-string v3, "null"

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;

    .line 39
    iget-object v2, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;

    const-string v3, "null"

    if-ne v2, v3, :cond_0

    .line 40
    iget-object v2, p0, Lcom/b16h22/Profile;->owner:Landroid/widget/TextView;

    const-string v3, "Owner"

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 46
    :goto_0
    const-string v2, "profilePic"

    const-string v3, "null"

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lcom/b16h22/Profile;->imageUri:Ljava/lang/String;

    .line 47
    iget-object v2, p0, Lcom/b16h22/Profile;->imageUri:Ljava/lang/String;

    const-string v3, "null"

    if-ne v2, v3, :cond_1

    .line 48
    iget-object v2, p0, Lcom/b16h22/Profile;->imageView:Landroid/widget/ImageView;

    const v3, 0x7f0200b2 #ic_qs_default_user

    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 53
    :goto_1
    new-instance v2, Lcom/b16h22/Profile$1;

    invoke-direct {v2, p0}, Lcom/b16h22/Profile$1;-><init>(Lcom/b16h22/Profile;)V

    invoke-virtual {v0, v2}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 64
    iget-object v2, p0, Lcom/b16h22/Profile;->done:Landroid/widget/ImageView;

    new-instance v3, Lcom/b16h22/Profile$2;

    invoke-direct {v3, p0}, Lcom/b16h22/Profile$2;-><init>(Lcom/b16h22/Profile;)V

    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 80
    return-void

    .line 42
    :cond_0
    iget-object v2, p0, Lcom/b16h22/Profile;->owner:Landroid/widget/TextView;

    iget-object v3, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;

    invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 43
    iget-object v2, p0, Lcom/b16h22/Profile;->name:Landroid/widget/EditText;

    iget-object v3, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;

    invoke-virtual {v2, v3}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0

    .line 50
    :cond_1
    iget-object v2, p0, Lcom/b16h22/Profile;->imageView:Landroid/widget/ImageView;

    iget-object v3, p0, Lcom/b16h22/Profile;->imageUri:Ljava/lang/String;

    invoke-static {v3}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v3

    invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageURI(Landroid/net/Uri;)V

    goto :goto_1
.end method

Step 5

Now open the res/xml/settings.xml

and add this iconpreferencescreen.You can add it anywhere you want.I'm assuming you have basic knowledge about preference xmls.

Code:
    <com.android.settings.IconPreferenceScreen android:title="Owner Profile" settings:icon="@drawable/ic_settings_owner">
        <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.b16h22.Profile" />
    </com.android.settings.IconPreferenceScreen>
EDIT:I forgot to write the step to assign new activity to the android manifest. Thanks to 3r41nl33n for remembering me

Open AndroidManifest.xml and add this

Code:
        <activity android:label="@string/change_pic" android:name="com.b16h22.Profile">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
Now save files and compile the settings.apk and push it to system.You have to resign the apk and other system apks or disable signature verification. Now you will have somethng like this




Now we can move on to modifying the systemui.apk.Decompile systemui.apk

Step 6

Open status_bar_expanded.xml and paste this where you want to put the owner image.

Code:
        <LinearLayout  android:layout_width="106.66699dip" android:layout_height="106.66699dip">
            <com.b16h22.statusbar.ProfilePicture android:id="@id/profile" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="1.0px" android:layout_marginTop="1.0px" android:layout_marginRight="1.0px" android:layout_marginBottom="1.0px" android:scaleType="centerCrop" />
            <com.b16h22.statusbar.ProfileName android:textStyle="normal" android:textColor="#ffffffff" android:gravity="center" android:layout_gravity="center_vertical" android:id="@id/profile_name" android:background="#cc000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="1.0px" android:layout_marginRight="1.0px" android:layout_marginBottom="1.0px" android:layout_alignParentBottom="true" />
        </LinearLayout >
Now extract the "Owner_mod_files_systemui.zip" and put the smali folder in the systemui smali folder and the pngs in the drawable-ldpi folder.


Step 7
Open ids.xml and add these

Code:
    <item type="id" name="profile">false</item>
    <item type="id" name="profile_name">false</item>
Recompile the apk and decompile it again

Step 8
Open public.xml and note these ids

Code:
    <public type="id" name="profile" id="0x7f09003a" />
    <public type="id" name="profile_name" id="0x7f09003b" />
    <public type="drawable" name="ic_qs_default_user" id="0x7f02012e" />
Step 9
Open smali/com/b16h22/statusbar/ProfilePicture.smali and find this

Code:
    .line 21
    const v4, 0x7f09003a
replace the id with the id of "profile"

find

Code:
    const v5, 0x7f02012e
replace it with the id of drawable "ic_qs_default_user"

Open smali/com/b16h22/statusbar/ProfilePicture$2.smali

Find

Code:
const v2, 0x7f02012e
replace it with id of drawable "ic_qs_default_user"

Open smali/com/b16h22/statusbar/ProfileName.smali

find

Code:
    .line 19
    const v2, 0x7f09003b
replace it with the id of "profile_name"

Now recompile the apk and push to system. You should be able to change picture from the settings. Think twice before askin anything. Please point out the faults in the guide if there is any.

DOWNLOADS
owner_mod_files_systemui.zip

owner_mod_files_settings.zip


Quote:

Anyone can use this mods but give credits where its due and keep the spirit of open source. Kanging is bad mmkay

Attached Files
File Type: zip files.zip - [Click for QR Code] (4.4 KB, 1737 views)
File Type: apk StatusBarMods.apk - [Click for QR Code] (668.5 KB, 2108 views)
Last edited by b16h22; 31st July 2013 at 02:46 PM.
The Following 90 Users Say Thank You to b16h22 For This Useful Post: [ View ]
27th June 2013, 05:40 PM   |  #2  
-CALIBAN666-'s Avatar
Recognized Contributor
Flag Leverkusen
Thanks Meter: 3,499
 
5,699 posts
Join Date:Joined: Feb 2012
More
Awesome guide,like your rom bro:thumbup:

GREEEEETZ WITH BEATZ!!!
27th June 2013, 06:46 PM   |  #3  
Minions_Army's Avatar
Senior Member
Flag 【Gru Laboratories】
Thanks Meter: 155
 
434 posts
Join Date:Joined: Nov 2012
More
awesome guide

i have problem to decompile ure systemui
haha
bt now i know where the secret
haha

i like ure rom brother
27th June 2013, 07:42 PM   |  #4  
Account currently disabled
XDA
Thanks Meter: 982
 
602 posts
Join Date:Joined: Jun 2013
Awesome

Can you make one for the 3 layouts of statusbar too

And AOKP Toggles?

Excited
The Following User Says Thank You to nolinuxnoparty For This Useful Post: [ View ]
27th June 2013, 07:46 PM   |  #5  
DvikzzDroid's Avatar
Senior Member
Flag Surabaya,INDONESIA
Thanks Meter: 72
 
214 posts
Join Date:Joined: May 2013
Donate to Me
More
i wanna try bro ! good job
27th June 2013, 08:44 PM   |  #6  
m4RinKo2's Avatar
Senior Member
Thanks Meter: 461
 
828 posts
Join Date:Joined: Oct 2012
More
Hey b16h22, dont make tuts for other stuff, ur rom will not be uniqe!

Sent from my GT-S5360 using xda app-developers app
The Following User Says Thank You to m4RinKo2 For This Useful Post: [ View ]
27th June 2013, 09:10 PM   |  #7  
DvikzzDroid's Avatar
Senior Member
Flag Surabaya,INDONESIA
Thanks Meter: 72
 
214 posts
Join Date:Joined: May 2013
Donate to Me
More
Quote:
Originally Posted by m4RinKo2

Hey b16h22, dont make tuts for other stuff, ur rom will not be uniqe!

Sent from my GT-S5360 using xda app-developers app

I guess so bro

Sent From With Connection
Visit My blog : Dvikzz.com
28th June 2013, 08:41 AM   |  #8  
Senior Member
Flag Kolkata
Thanks Meter: 498
 
336 posts
Join Date:Joined: Feb 2013
Donate to Me
More
awesome
thanx bro. gonna hav it in our rom maybe..
28th June 2013, 01:12 PM   |  #9  
PineappleOwl's Avatar
Recognized Themer
Flag La Union
Thanks Meter: 829
 
479 posts
Join Date:Joined: Mar 2013
Donate to Me
More
Great guide. Gonna try to make my own sir.
28th June 2013, 02:14 PM   |  #10  
markmellarpes's Avatar
Recognized Themer
Flag Taguig
Thanks Meter: 514
 
891 posts
Join Date:Joined: Aug 2012
More
thanks to your guide..
Click image for larger version

Name:	uploadfromtaptalk1372425208777.jpg
Views:	2309
Size:	20.5 KB
ID:	2076180
Click image for larger version

Name:	uploadfromtaptalk1372425244636.jpg
Views:	1966
Size:	12.6 KB
ID:	2076181

Sent from my GT-S5360 using xda premium

The Following User Says Thank You to markmellarpes For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy Y GT-S5360 Themes and Apps by ThreadRank