Related
Hello, this is Chris talking, your fellow Time Keeper (yeah, I was nicknamed) and this is my tutorial on how to build a simple, lightweight analog clock!
______________________________________________________________
This guide assumes that you have successfully set up the Android SDK, ADT, Eclipse, some basic Java knowledge and image editing skills.
_______________________________________________________________
Let's start!
Go to the menu bar and click File > New > Android Project
Give your project a name, such as "XDA Devs Clock". Anything you prefer. This isn't going to affect the final app.
Next, select Android 1.6 as the build target. Analog clocks don't require anything special.
Now it's time to create the package name. I usually make mine like "com.xda.clock.chris".
Untick the "Create Activity" checkbox.
Info: We don't need to create an Activity because we are making a widget. Widgets don't have Activities, otherwise, they would be shown in the app drawer.
Click Finish and Eclipse will set up the project.
{
"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"
}
________________________________________________________________
Next up, you need to make 3 images for the clock:
The dial (which is the clock's background)
The hour's hand
The minute's hand
Use your incredible Photoshop/GIMP/Illustrator skills to make your awesome clock!
Few tips:
Make the canvas 300*300 pixels
Make the dial with 10% padding
To easily make the hands, keep the dial background and draw the hour's and minute's hand as they were at position zero (Hour at 12 o'clock and minute at zero). Erase the dial and save each hand image
Save with a .png extension. So, in the end, you will have 3 images. Name them:
hand_dial.png
hand_minute.png
hand_hour.png
All lower case. It is extremely important or else you will get an error!
Also, create an app icon. You need to make 3 different ones for every screen size.
HDPI - 72*72 px
MDPI - 48*48 px
LDPI - 36*36 px
Save them with the name "ic_launcher.png" and overwrite the images that are already in the project's respective folders.
________________________________________________________________
Following, we gotta put them to our app.
So, first, right-click res > New > New folder and name it "drawable".
Drag your images you created previously into there.
Now, let's make the layout of the clock.
Go to res > layout > main.xml
Go to the main.xml tab (at the bottom) and delete the TextView block. Next, change the layout from Linear to Relative.
Now, we will add the clock's code.
Code:
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:dial="@drawable/hand_dial"
android:hand_minute="@drawable/hand_minute"
android:hand_hour="@drawable/hand_hour"/>
So, what did we do there?
We gave the item an id
We put it in the middle of the screen
We redirected the drawables to the respective hand and dial
The final xml is this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:dial="@drawable/hand_dial"
android:hand_minute="@drawable/hand_minute"
android:hand_hour="@drawable/hand_hour"/>
</RelativeLayout>
_______________________________________________________________
Next, we need to tell Android that what we are actually doing is a widget.
Right click res and create a folder named "xml".
Right clock xml > New > Android XML file
Change the Resource Type to AppWidgetProvider and give it a name such as "widget_config.xml". Lower case!
Delete everything and paste this in:
Code:
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="140dip"
android:minHeight="140dip"
android:updatePeriodMillis="0"
android:initialLayout="@layout/main"/>
There we set how many rows the widget will take. The calculation method is
74 * [number of rows] - 4
We want the widget to be 2*2 so the width is 146dip and the height is also 146dip. But we'll change it to 140 to make it a little bigger.
Then we set an update period... which actually doesn't work below 30 minutes. It's a bug in Android and last, we gave it a layout, which we made previously (main.xml).
____________________________________________________________
Now, we must declare the widget in the manifest.xml with a <receiver> element.
Open the manifest xml and delete the <activity> block. As said previously, we won't have any activity.
Inside the <application> add this piece of code:
Code:
<receiver android:name=".Clock_Actions" android:label="XDA Analog Clock">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_config" />
</receiver>
The android:name is the class we are going to create in a few minutes.
The label is the name that will be shown in the widget picker of your homescreen. Then we specified the update and linked the widget_config.xml
The final xml is:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xda.clock.chris"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name=".Clock_Actions" android:label="XDA Analog Clock">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_config" />
</receiver>
</application>
</manifest>
_______________________________________________________________
Now it's time to create the Clock_Actions class.
Right click the package > New > Class
Give it the above name.
Delete everything and paste this in:
Code:
package com.xda.clock.chris;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.widget.RemoteViews;
public class Clock_Actions extends AppWidgetProvider{
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
PendingIntent pendingIntent;
if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
{
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.main);
pendingIntent = PendingIntent.getActivity(context, 0,getAlarmPackage(context), 0);
views.setOnClickPendingIntent(R.id.analogClock1, pendingIntent);
AppWidgetManager
.getInstance(context)
.updateAppWidget(
intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS),
views);
}
}
public Intent getAlarmPackage(Context context)
{
PackageManager packageManager = context.getPackageManager();
Intent AlarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
String clockImpls[][] = {
{ "Standard Alarm", "com.android.alarmclock",
"com.android.alarmclock.AlarmClock" },
{ "HTC Alarm ClockDT", "com.htc.android.worldclock",
"com.htc.android.worldclock.WorldClockTabControl" },
{ "Standard Alarm ClockDT", "com.android.deskclock",
"com.android.deskclock.AlarmClock" },
{ "Froyo Nexus Alarm ClockDT",
"com.google.android.deskclock",
"com.android.deskclock.DeskClock" },
{ "Moto Blur Alarm ClockDT",
"com.motorola.blur.alarmclock",
"com.motorola.blur.alarmclock.AlarmClock" },
{ "Samsung Galaxy S", "com.sec.android.app.clockpackage",
"com.sec.android.app.clockpackage.ClockPackage" } };
boolean foundClockImpl = false;
for (int i = 0; i < clockImpls.length; i++)
{
String packageName = clockImpls[i][1];
String className = clockImpls[i][2];
try
{
ComponentName cn = new ComponentName(packageName, className);
packageManager.getActivityInfo(cn,PackageManager.GET_META_DATA);
AlarmClockIntent.setComponent(cn);
foundClockImpl = true;
} catch (NameNotFoundException nf)
{
}
}
if (foundClockImpl)
{
return AlarmClockIntent;
}
else
{
return null;
}
}
}
Change the package name to your own after pasting.
So here, we set up the update, the remote views and the pending intent which redirects you to the Desk Clock app. Because different phones have different Desk Clock package names, we set up a method to handle that.
Many thanks to sndytime. Got the code from his post here.
____________________________________________________________
Next up...nothing! Our clock is done! We just have to export it.
Right click the project > Android tools > Export signed application
Choose next, select Create new keystore > click browse and give it a name.
Create a password and click next.
In alias put whatever you want. I usually put "chris95x8"
Enter your password again and put, like, 100 year for validity. You get the rest.
Click Next, browse and enter a name for the apk.
Click Finish and congrats on your first analog clock! Yay!
If you have done everything right it should work. Otherwise, comment here on the thread.
*Sorry for big images
______________________________________________________________
I hope to see some clock on the Themes & Apps section soon. Good luck everyone!
Exelent guide buddy
Another score for successful guides
W!LßSO @ XDA
Thanks Chris.
Will come in handy.
-----------------
- Swift -, formerly known as IrishStuff09
Thank you Chris !
Sent from my X8 using xda premium
great tutorial buddy!
getting right to do the job!
I made one sometime ago but all ended when started to add settings
Anything didnt work anymore from then on
Lol interesting, thanks.
Too fun ! Thank you dude !
Great Job Chriss, nice and clear. However I still menaged to get stuck.
Now it's time to create the Clock_Actions class.
Right click the package > New > Class
Click to expand...
Click to collapse
Where/what should I right click?
For now I created in in src folder in (default package), but I get 3 errors, so I assume I did it wrong.
Anyway tutorial looks great
Chris95X8 said:
Hello, this is Chris talking, your fellow Time Keeper (yeah, I was nicknamed) and this is my tutorial on how to build a simple, lightweight analog clock!
______________________________________________________________
This guide assumes that you have successfully set up the Android SDK, ADT, Eclipse, some basic Java knowledge and image editing skills.
_______________________________________________________________
Let's start!
Go to the menu bar and click File > New > Android Project
Give your project a name, such as "XDA Devs Clock". Anything you prefer. This isn't going to affect the final app.
Next, select Android 1.6 as the build target. Analog clocks don't require anything special.
Now it's time to create the package name. I usually make mine like "com.xda.clock.chris".
Untick the "Create Activity" checkbox.
Info: We don't need to create an Activity because we are making a widget. Widgets don't have Activities, otherwise, they would be shown in the app drawer.
Click Finish and Eclipse will set up the project.
________________________________________________________________
Next up, you need to make 3 images for the clock:
The dial (which is the clock's background)
The hour's hand
The minute's hand
Use your incredible Photoshop/GIMP/Illustrator skills to make your awesome clock!
Few tips:
Make the canvas 300*300 pixels
Make the dial with 10% padding
To easily make the hands, keep the dial background and draw the hour's and minute's hand as they were at position zero (Hour at 12 o'clock and minute at zero). Erase the dial and save each hand image
Save with a .png extension. So, in the end, you will have 3 images. Name them:
hand_dial.png
hand_minute.png
hand_hour.png
All lower case. It is extremely important or else you will get an error!
Also, create an app icon. You need to make 3 different ones for every screen size.
HDPI - 72*72 px
MDPI - 48*48 px
LDPI - 36*36 px
Save them with the name "ic_launcher.png" and overwrite the images that are already in the project's respective folders.
________________________________________________________________
Following, we gotta put them to our app.
So, first, right-click res > New > New folder and name it "drawable".
Drag your images you created previously into there.
Now, let's make the layout of the clock.
Go to res > layout > main.xml
Go to the main.xml tab (at the bottom) and delete the TextView block. Next, change the layout from Linear to Relative.
Now, we will add the clock's code.
Code:
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:dial="@drawable/hand_dial"
android:hand_minute="@drawable/hand_minute"
android:hand_hour="@drawable/hand_hour"/>
So, what did we do there?
We gave the item an id
We put it in the middle of the screen
We redirected the drawables to the respective hand and dial
The final xml is this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:dial="@drawable/hand_dial"
android:hand_minute="@drawable/hand_minute"
android:hand_hour="@drawable/hand_hour"/>
</RelativeLayout>
_______________________________________________________________
Next, we need to tell Android that what we are actually doing is a widget.
Right click res and create a folder named "xml".
Right clock xml > New > Android XML file
Change the Resource Type to AppWidgetProvider and give it a name such as "widget_config.xml". Lower case!
Delete everything and paste this in:
Code:
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="146dip"
android:minHeight="146dip"
android:updatePeriodMillis="0"
android:initialLayout="@layout/main"/>
There we set how many rows the widget will take. The calculation method is
74 * [number of rows] - 4
We want the widget to be 2*2 so the width is 146dip and the height is also 146dip.
Then we set an update period... which actually doesn't work below 30 minutes. It's a bug in Android and last, we gave it a layout, which we made previously (main.xml).
____________________________________________________________
Now, we must declare the widget in the manifest.xml with a <receiver> element.
Open the manifest xml and delete the <activity> block. As said previously, we won't have any activity.
Inside the <application> add this piece of code:
Code:
<receiver android:name=".Clock_Actions" android:label="XDA Analog Clock">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_config" />
</receiver>
The android:name is the class we are going to create in a few minutes.
The label is the name that will be shown in the widget picker of your homescreen. Then we specified the update and linked the widget_config.xml
The final xml is:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xda.clock.chris"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name=".Clock_Actions" android:label="XDA Analog Clock">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_config" />
</receiver>
</application>
</manifest>
_______________________________________________________________
Now it's time to create the Clock_Actions class.
Right click the package > New > Class
Give it the above name.
Delete everything and paste this in:
Code:
package com.xda.clock.chris;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.widget.RemoteViews;
public class Clock_Actions extends AppWidgetProvider{
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
PendingIntent pendingIntent;
if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
{
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.main);
pendingIntent = PendingIntent.getActivity(context, 0,getAlarmPackage(context), 0);
views.setOnClickPendingIntent(R.id.analogClock1, pendingIntent);
AppWidgetManager
.getInstance(context)
.updateAppWidget(
intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS),
views);
}
}
public Intent getAlarmPackage(Context context)
{
PackageManager packageManager = context.getPackageManager();
Intent AlarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
String clockImpls[][] = {
{ "Standard Alarm", "com.android.alarmclock",
"com.android.alarmclock.AlarmClock" },
{ "HTC Alarm ClockDT", "com.htc.android.worldclock",
"com.htc.android.worldclock.WorldClockTabControl" },
{ "Standard Alarm ClockDT", "com.android.deskclock",
"com.android.deskclock.AlarmClock" },
{ "Froyo Nexus Alarm ClockDT",
"com.google.android.deskclock",
"com.android.deskclock.DeskClock" },
{ "Moto Blur Alarm ClockDT",
"com.motorola.blur.alarmclock",
"com.motorola.blur.alarmclock.AlarmClock" },
{ "Samsung Galaxy S", "com.sec.android.app.clockpackage",
"com.sec.android.app.clockpackage.ClockPackage" } };
boolean foundClockImpl = false;
for (int i = 0; i < clockImpls.length; i++)
{
String packageName = clockImpls[i][1];
String className = clockImpls[i][2];
try
{
ComponentName cn = new ComponentName(packageName, className);
packageManager.getActivityInfo(cn,PackageManager.GET_META_DATA);
AlarmClockIntent.setComponent(cn);
foundClockImpl = true;
} catch (NameNotFoundException nf)
{
}
}
if (foundClockImpl)
{
return AlarmClockIntent;
}
else
{
return null;
}
}
}
Change the package name to your own after pasting.
So here, we set up the update, the remote views and the pending intent which redirects you to the Desk Clock app. Because different phones have different Desk Clock package names, we set up a method to handle that.
Many thanks to sndytime. Got the code from his post here.
____________________________________________________________
Next up...nothing! Our clock is done! We just have to export it.
Right click the project > Android tools > Export signed application
Choose next, select Create new keystore > click browse and give it a name.
Create a password and click next.
In alias put whatever you want. I usually put "chris95x8"
Enter your password again and put, like, 100 year for validity. You get the rest.
Click Next, browse and enter a name for the apk.
Click Finish and congrats on your first analog clock! Yay!
If you have done everything right it should work. Otherwise, comment here on the thread.
*Sorry for big images
______________________________________________________________
I hope to see some clock on the Themes & Apps section soon. Good luck everyone!
Click to expand...
Click to collapse
U awe from me a thanks and a beer.. N1 bro.. :beer::thumbup:
Sent from my GT-S6102 using xda premium
west1988 said:
Great Job Chriss, nice and clear. However I still menaged to get stuck.
Where/what should I right click?
For now I created in in src folder in (default package), but I get 3 errors, so I assume I did it wrong.
Anyway tutorial looks great
Click to expand...
Click to collapse
Stupid me. It shouldn't be a default package, but a one with my unique name that I needed to create
Great lesson and I have my very own clock now
west1988 said:
Stupid me. It shouldn't be a default package, but a one with my unique name that I needed to create
Great lesson and I have my very own clock now
Click to expand...
Click to collapse
Will you post it?
Sent from my HTC One S
It is just a photo of my old friends and me as a dial of the clock, so nothing fancy
Hi,How to add second to it?
Hello.Thank you for this great tutorial.I'm beginner and i have problem with clock.When i use clock with some of launchers Go Launcher,Apex launcher.. when restert phone i get error-Problem loading widget.Pleace help me.Sorry for my English
so how to add date & weather to it ?
Cant find main xml
First off, wonderful tutorial! Thanks :good:
So, forgive my n00bness please. I've never fully taken on the world of designing apps or widgets so much of this is new to me. I set everything up according to directions but have gotten stuck looking for the main xml file. After an hour or so of looking, and looking... and looking, I CAN NOT for the life of me seem to locate it anywhere. I have downloaded the most recent ADT package ( build: v21.0.0-519525 ) and it's running Eclipse 3.8. I've included a screenshot. Not sure if I've done something wrong or what, but I'm guessing it's most likely in plain sight. I am just not sure where to begin to look! Any help would be awesome, I have a slew of custom new clocks I feel the Android community would love :fingers-crossed:
EDIT: I've gone through and manually added an Android XML Layout file to the layout folder with the name of main.xml. After doing this I've gone through and followed step by step everything to the T. Everything checks out in the end after exporting, and even installs correctly. However, it does not show up in my widgets list or App drawer, and when trying to launch it from a file manager it says it cannot be launched.
Help!
WORKING!
D4RRYLJ4RVIS said:
First off, wonderful tutorial! Thanks :good:
So, forgive my n00bness please. I've never fully taken on the world of designing apps or widgets so much of this is new to me. I set everything up according to directions but have gotten stuck looking for the main xml file. After an hour or so of looking, and looking... and looking, I CAN NOT for the life of me seem to locate it anywhere. I have downloaded the most recent ADT package ( build: v21.0.0-519525 ) and it's running Eclipse 3.8. I've included a screenshot. Not sure if I've done something wrong or what, but I'm guessing it's most likely in plain sight. I am just not sure where to begin to look! Any help would be awesome, I have a slew of custom new clocks I feel the Android community would love :fingers-crossed:
EDIT: I've gone through and manually added an Android XML file to the layout folder with the name of main.xml. After doing this I've gone through and followed step by step everything to the T. Everything checks out in the end after exporting, and even installs correctly. However, it does not show up in my widgets list or App drawer, and when trying to launch it from a file manager it says it cannot be launched.
Help!
Click to expand...
Click to collapse
NEVERMIND! Ran into the same problem as West1988. Changed the package name to the unique name selected in the beginning of the project and, voila! LAZR CLOCK! I'll be posting this on the Play store soon for anyone to download. Thanks Chris!
Oh, glad you sorted it out. And my God! Awesome clock man!!!
Sent from my HTC One S using xda app-developers app
Thanks for this tut Chris!
I made one but I was really bored to make good graphs...but it works!!!!
Sent from my X8 using xda premium
Hello all,
Just thought i would drop you all a quick guide i will add to this as much as i can.. Drop me a message if you need anything else.
For Transparent NavBar - Decompile Prism.apk
Once decompiled navigate to \Prism\res\drawable-xxhdpi look for home_nav_bg
Just modify the above image to your liking color, transparency etc
For modified app drawer - 4 x 5 etc - Decompile Prism.apk
Once decompiled navigate to \Prism\res\integers - the below are the modifications you need to make
<integer name="config_allAppsTabbedCellCountX">4</integer>
<integer name="config_allAppsTabbedCellCountY">5</integer>
<integer name="config_allAppsTabbedCellCountXAlt">5</integer>
<integer name="config_allAppsTabbedCellCountYAlt">6</integer>
Once made you need to head over to the arrays XML and change - The below to match the above
<string-array name="apps_grid_option">
<item>4 × 5</item>
<item>5 × 6</item>
</string-array>
Please note modding the app drawer may require you to mod the dimensions in values to have it all fit nicely.
Ill check shortly but i am pretty sure its the below you need to modify for a better fit.
<dimen name="page_view_icon_cell_width">90.0dip</dimen>
<dimen name="page_view_icon_cell_height">97.0dip</dimen>
<dimen name="page_view_icon_cell_width_alt">75.0dip</dimen>
<dimen name="page_view_icon_cell_height_alt">90.0dip</dimen>
Statusbar Mods [Colors/Transparency etc] - Decompile SystemUI.apk
Navigate to \SystemUI\res\layout - Open Status_Bar.xml
Look at Line 2 where it says - android:background="@drawable/status_bar_background"
The Red is what we are going to modify
1. You will find in the drawables folder and image labeled status_bar_background open this and mod this to whatever you wish
2. Alternatively you can also mod this by changing the green text to "#FF000000" This is a Hex color - FF is level of Transparency and 000000 is the Color White
App Drawer / Blink Feed Clock Backgrond - Decompile Prism.apk
Navigate to \Prism\res\drawable-xxhdpi
Change automotive_common_app_bkg_top.png to whatever you wish
Recent Apps Pull Down Background - Decompile SystemUI.apk
To Change the Statusbar Pull-down Shade Background Color/Transparency
• First Decompile SystemUI.apk and navigate to the "res/layouts" and find "status_bar_expanded.xml"
• Next, find where it says android:background="@*android:color/black" and change it to android:background="@color/transparent_black" and save it.
• Now go to "res/values" and open "colors.xml"
• We are going to add a new color to this by adding this <color name="@color/transparent_black">#A5000000</color>
• Save that and recompile and now your pull-down shade is semi-transparent
#00000000 is 100% Transparent.
#40000000 is 75% Transparent.
#80000000 is 50% Transparent.
#B0000000 is 25% Transparent.
#FF000000 is 0% Transparent.
XML QUICK COLOR GUIDE
• When you see a Hex color in xml it will probably look like #FF1A2B3C (I will be explaining this from LEFT to RIGHT following the # sign)
• The First two digits represents the level of Transparency 00 is Transparent and FF is Opaque
• The Second two digits represents the level of RED where 00 is No Red (0) and FF is Full Red (255)
• The Third two digits represents the level of GREEN where 00 is No Green (0) and FF is Full Green (255)
• The Fourth two digits represents the level of BLUE where 00 is No Blue (0) and FF is Full Blue (255)
App Drawer Transparency - Decompile Prism.apk
Next navigate to \Prism\smali\com\htc\launcher
Go to Launcher . Smali and CTRL + F and search for .method public updateWallpaperVisibility(Z)V
Highlight this line and highlight everything below until you see end method. just to clarify we are deleting From .method to .end method
.method public updateWallpaperVisibility(Z)V
.end method
after this CTRL + F and search for updateWallpaperVisibility - remove any line that has this
[We now have to clean the code navigate to the 3 files below - for each CTRL + F and search for updateWallpaperVisibility and remove all lines which include this
Launcher$21.Smali
Launcher$22.Smali
Launcher$25.Smali
Workspace.smali
Now navigate to DragLayer.Smali
CTRL + F and search for const/high16 v2, -0x100, change this line to const/high16 v2, 0x0
Navigate to Prism/smali/com/htc/launcher/pageview
Open AllAppsPagedViewHost.smali - CTRL + F and search for const/high16 v2, -0x100, change this line to const/high16 v2, 0x0
When complete it looks like a small glitch but its a duplication transition animation to make this less glitchy navigate to Values/ Dimens and Modify the below till you achieve your desired results
<integer name="config_appsCustomizeZoomInTime">150</integer>
<integer name="config_appsCustomizeZoomOutTime">100</integer>
<integer name="config_appsCustomizeZoomInScaleFactor">200</integer>
<integer name="config_appsCustomizeZoomOutScaleFactor">133</integer>
<integer name="config_appsCustomizeFadeInTime">100</integer>
<integer name="config_appsCustomizeFadeOutTime">150</integer>
App Drawer / Blink Feed Background - Decompile Prism.apk
First of all to add backgrounds to either of these we need to achieve transparency (see guide below) App Drawer Transparency
Add the below to achieve a background for whatever you wish
res/layouts/feed_view.xml - Blinkfeed
<com.htc.launcher.feeds.view.FeedScrollView - At this line add android:background="@drawable/12345"
res/layout/all_apps_pagedview.xml - App Drawer
<com.htc.launcher.pageview.AllAppsPagedView - At this line add android:background="@drawable/12345"
\Prism\res\values\colors.xml - BlinkFeed Tiles - Change the red color below to your desired Color / Transparency
<color name="feedview_background">#ff33b5e5</color>
12345 - This refers to the name of your Background image - Once the tags have been added add the images to drawable-xxhdpi
#ff33b5e5 - 33b5e refers to the color and the FF refers to transparency, FF = non transparent / 00 = Fully Transparent / 68 = 50% i believe)
Remove App Drawer / Blinkfeed Clock - Decompile Prism.apk
!!!Please note this is a work in Progress!!!
SO FAR:
Navigate to Prism\smali\com\htc\launcher\masthead
Open Masthead.Smali
Remove this whole method - .method private attachToContainer(Landroid/view/ViewGroupV
We need to then navigate to Values Dimens and modify the following for the correct fitting
Remove Carrier Label - Decompile SystemUI.apk
Navigate to \SystemUI\res\layout - Open Status_Bar_Expanded.xml
At line <com.android.systemui.statusbar.phone.CarrierLabel where is says android:visibility="invisible change to "android:visibility="gone"
Center Clock - Decompile SystemUI.apk
Navigate to SystemUI\res\layout - Status_Bar.xml
Step 1. First of all locate and delete this line
Code:
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/system_icon_area" android:layout_width="wrap_content" android:layout_height="fill_parent">
Step 2. Next locate the following line - Change this to replicate the line below
Code:
Original - <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
New - <LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" >
Step 3. Copy the following above your modified line in Step 2
Code:
<LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent">
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="@*android:color/white" android:gravity="center" android:id="@id/clock" android:paddingTop="3.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" />
</LinearLayout>
Step 4. Check it resembles the below
Code:
<LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent">
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="@*android:color/white" android:gravity="center" android:id="@id/clock" android:paddingTop="3.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_weight="1.0" />
</LinearLayout>
<LinearLayout android:gravity="right|center" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" >
<LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:paddingLeft="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
<ViewStub android:id="@id/signal_cluster" android:inflatedId="@id/signal_cluster_tree" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="@*android:color/white" android:gravity="center_vertical" android:id="@id/battery_text" android:paddingLeft="1.0dip" android:paddingRight="1.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" />
<ImageView android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
Remove Status Bar Icons - Thanks to .torrented
To make statusbar icons disappear you must decompile SystemUI.apk navigate to the "res" folder and then into the "drawable - xxhdpi" folder and there you will see a bunch of png's.
From there locate which statusbar image you wish to make disappear and copy its exact name, change the tranparant png's name to whatever the original name was and replace it with the newly transparent version.
Just replicate this for any statusbar image you wish (delete the old ones are you are done with them)
Recompile SystemUI.apk and replace the one on the device, your statusbar images will now be GONE!
Settings Background - Decompile framework-res.apk
Coming Soon
Hello,
Thank you for this... Could you also add how to achieve a transparent app drawer? I am still using Nos2.03 and not interested in moving to the 4.2.2 version just yet. I see you have a zip already for this.
Cheers
Will post shortly
Sent from my HTC6435LVW using XDA Premium 4 mobile app
xvicedice said:
Will post shortly
Sent from my HTC6435LVW using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Rock on, editing smali leaves no room for error :good:
Updated
Sent from my HTC6435LVW using XDA Premium 4 mobile app
Hi,
Thanks for your guide, could you please try to port the following
http://forum.xda-developers.com/showthread.php?t=2138654
or guide which files to be modded to get the big photo on calling screen.
thanks
:thumbup:
Remove/Edit Some Statusbar Images
this is an xxhdpi resource
To make statusbar icons disappear you must decompile SystemUI.apk navigate to the "res" folder and then into the "drawable - xxhdpi" folder and there you will see a bunch of png's.
From there locate which statusbar image you wish to make disappear and copy its exact name, change the tranparant png's name to whatever the original name was and replace it with the newly transparent version.
Just replicate this for any statusbar image you wish (delete the old ones are you are done with them)
Recompile SystemUI.apk and replace the one on the device, your statusbar images will now be GONE!
Hope this helps anyone!
*** There probably are other ways of doing this but I find this the easiest (aka Quick'n'Dirty), OP is allowed to post this in the OP if he desires
Thank you for the help .torrented (OP updated)
I will update this shortly to show modifications for 4.3 and 4.4
Ashle said:
Please edit me ..... :crying:
Click to expand...
Click to collapse
Please backup first and then push this to the phone, let me know what happens.
https://dl.dropboxusercontent.com/u/67055555/SystemUI.apk
[QUOTxvicedice;49055500]Please backup first and then push this to the phone, let me know what happens.
https://dl.dropboxusercontent.com/u/67055555/SystemUI.apk[/QUOTE]
No ....systemui has stopped
To Change the Statusbar Pull-down Shade Background Color/Transparency
First Decompile SystemUI.apk and navigate to the "res/layouts" and find "status_bar_expanded.xml"
Next, find where it says android:background="@*android:color/black" and change it to android:background="@color/transparent_black" and save it.
Now go to "res/values" and open "colors.xml"
We are going to add a new color to this by adding this <color name="@color/transparent_black">#A5000000</color>
Save that and recompile and now your pull-down shade is semi-transparent
#00000000 is 100% Transparent.
#40000000 is 75% Transparent.
#80000000 is 50% Transparent.
#B0000000 is 25% Transparent.
#FF000000 is 0% Transparent.
XML QUICK COLOR GUIDE
When you see a Hex color in xml it will probably look like #FF1A2B3C (I will be explaining this from LEFT to RIGHT following the # sign)
The First two digits represents the level of Transparency 00 is Transparent and FF is Opaque
The Second two digits represents the level of RED where 00 is No Red (0) and FF is Full Red (255)
The Third two digits represents the level of GREEN where 00 is No Green (0) and FF is Full Green (255)
The Fourth two digits represents the level of BLUE where 00 is No Blue (0) and FF is Full Blue (255)
xvicedice said:
Drop me a message if you need anything else.
Click to expand...
Click to collapse
Thanks, this is all very useful information. Can you by any chance put a guide to which files need altering to change the home screen grid size and spacing in prism.apk?
Many Thanks
Of course I'm away from my pc today but I'll get that up for you tomorrow
Sent from my HTC Droid DNA using XDA Premium 4 mobile app
Hello I'm looking to decompile prism.apk to try and change values to enable me to have more then 4 app in my locksceeen dock and home screen dock. I have a HTC one max so it won't look out of place just hoping someone can help thanks.
Hi if you wish to do this you have to navigate to the values folder and find the integers.xml.
Once you are there look for hotseat_cell_count (think that’s the one) increase the value to what you like should be 5 as standard I think.
Once you increase it though bear in mind things will look squashed so you will need to modify the padding either side, so in the Values folder look for a file called dimens.xml look for 2 lines button_bar_width_left_padding & button_bar_width_right_padding decrease both values on these to suit.
Hope that helps
Jamie
I am attempting to replace the data an app* stores in an XML resource, and I can't figure out how to make it work. I followed the tutorial, but it only covers things like "drawable" (and the simple types like string and integer)
I have tried various combinations of compiled or textual XML, with the file in res/xml or res/raw, and so far have not found anything that had any effect on the app, while my module never reports any errors! (at least not in any log I've found)
*The app is Swype, I'm attempting to replace one of the English keyboard layouts (qwerty, azerty, or qwertz) with a completely new one I saw that's actually good for the sliding entry method instead of a slide left on the top row being at least 14 different possible words (Seriously, I made a list) including some very commonly needed ones like it, or, out, and our. The layouts are** stored in xml files such as res/xml/kbd_azerty_panlatin.xml but even attempting a single letter swap hasn't done anything yet.
So, what do I need to do to make a line like
Code:
resParam.res.setReplacement(resParam.packageName, "xml", "kbd_azerty_panlatin", xrf);
actually work? (xrf is from
Code:
XResForwarder xrf = modRes.fwd(R.raw.kbd_azerty_panlatin);
as of my last attempt. modRes is as per the tutorial) and that file is in the last attempt compiled by creating a new Swype apk with the modification via apktool then just grabbing it from there.)
**Note that actually attempting to run recompiled Swype APKs -- modded or not -- fails with a crash when the keyboard would appear, so I can't actually confirm that I'm right about the location of the layouts I need to change, but it seems to be reasonable that they are where I think. I also have No idea how to link them to the language options, so I can't see a way to create a new one instead of replacing an existing.
bump, I'm curious too
edit: if you scroll down on the tutroial page, it covers modifying xml layouts
ssojyeti2 said:
... if you scroll down on the tutroial page, it covers modifying xml layouts
Click to expand...
Click to collapse
It doesn't give much detail and since layouts are a separate type, it might not apply anyway.
I really hope it's not right about me needing to include All the xml files in the app just to make one work. I suppose I should try it anyway.
ok i was able to successfully replace an xml file in snapchat using xposed, although it caused snapchat to fc, but i think thats on the app itself. i basically copied the code on the tutorial word for word lol
Code:
package com.joss.geofilter;
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
public class GeoResize implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.snapchat.android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.snapchat.android", "layout", "battery_view", modRes.fwd(R.raw.battery_view));
}
}
because i put it in /raw, i had to compile the xml first using apktool and swap it into the xposed module using 7zip afterwards
I'm late, but i think you've misunderstand some things. For example, you can't mod Swype, not like you do here.
I give you an example. I've this xml file:
Code:
<resources>
<color name="white">#ff000000</color>
<color name="common_signin_btn_default_background">#ff000000</color>
</resources>
(taken from Twitter app)
I want to change that values. You can't replace the entire xml, but you can create an xml, name it like you want (xda.xml will work) and put in it:
Code:
<resources>
<color name="white">THE COLOR YOU WANT</color>
<color name="common_signin_btn_default_background">THE OTHER COLOR YOU WANT</color>
</resources>
and you put that file into res/values of your Xposed app. You've not to write all entries, you write only those you want to change. Now, you have to write the code that does the magic:
Code:
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
public class Main implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.twitter.android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.white));
resparam.res.setReplacement("com.twitter.android", "color", "faint_transparent_white", modRes.fwd(R.color.faint_transparent_white));
}
}
So, into 'resparam.res.setReplacement' you don't put the xml name, but you put the resource name. In this case, the color's name. So, if in your xml you have:
Code:
<resources>
<color name="forum">THE COLOR YOU WANT</color>
</resources>
you will use:
Code:
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.forum));
And that changes the color 'white' of Twitter app, into the color 'forum', that you've defined into your xlm xda.xml ('THE COLOR YOU WANT' here).
For layout, that is a bit different...
Ok sorry, my last post here is not totally correct. The way used in the first post should work, but it doesn't. Has someone find a solution?
P.S. The example of snapchat is a bit different, probably, because it uses 'layout'.
P.S.2 This thread should be moved in the 'Xposed' section...
robertogl said:
I'm late, but i think you've misunderstand some things. For example, you can't mod Swype, not like you do here.
I give you an example. I've this xml file:
Code:
<resources>
<color name="white">#ff000000</color>
<color name="common_signin_btn_default_background">#ff000000</color>
</resources>
(taken from Twitter app)
I want to change that values. You can't replace the entire xml, but you can create an xml, name it like you want (xda.xml will work) and put in it:
Code:
<resources>
<color name="white">THE COLOR YOU WANT</color>
<color name="common_signin_btn_default_background">THE OTHER COLOR YOU WANT</color>
</resources>
and you put that file into res/values of your Xposed app. You've not to write all entries, you write only those you want to change. Now, you have to write the code that does the magic:
Code:
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
public class Main implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.twitter.android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.white));
resparam.res.setReplacement("com.twitter.android", "color", "faint_transparent_white", modRes.fwd(R.color.faint_transparent_white));
}
}
So, into 'resparam.res.setReplacement' you don't put the xml name, but you put the resource name. In this case, the color's name. So, if in your xml you have:
Code:
<resources>
<color name="forum">THE COLOR YOU WANT</color>
</resources>
you will use:
Code:
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.forum));
And that changes the color 'white' of Twitter app, into the color 'forum', that you've defined into your xlm xda.xml ('THE COLOR YOU WANT' here).
For layout, that is a bit different...
Click to expand...
Click to collapse
what about editing strings? in an apps xml?
devzeus_ke said:
what about editing strings? in an apps xml?
Click to expand...
Click to collapse
Too many years have passed to remember that
robertogl said:
Too many years have passed to remember that
Click to expand...
Click to collapse
Oww. I am actually getting started with android development and i am also learning how the system itself works. However i haven't found an example to edit a string resource in an app. I only find examples on how to edit systemui resources. Any help with finding that?
devzeus_ke said:
Oww. I am actually getting started with android development and i am also learning how the system itself works. However i haven't found an example to edit a string resource in an app. I only find examples on how to edit systemui resources. Any help with finding that?
Click to expand...
Click to collapse
Note that this 'replacement' only works with the Xposed framework.
robertogl said:
Note that this 'replacement' only works with the Xposed framework.
Click to expand...
Click to collapse
actually i meant over writing. Like changing string values
Hello buddies..
From the concept SHARING IS CARING, I am going to share some mods specifically on SecSettings.apk that I stumbled across and share it with you in one thread
Keep in mind that most of them are not mine but from the community so actual credits are to be given to the owners. So please let me know if you have any modding that I didn't mention
So let's start!!
Needed tools:
1) Apktool or others that do the job
2) Notepad++ program from here
3) The patience and a willing partner! sorry no link for that
I am not going to teach you how to use these programs because I am assuming that you already know how to use them if not then check their respective documentations!
You must deodex SecSettings.apk before proceeding.
A lot of works are done by various xda members, some are from other sites, some are mine. If you found the guide of your mod here and you haven't been credited, please PM.
Click to expand...
Click to collapse
Adding Custom image + Onclick Functionality
Credits to @iamareebjamal
Decomplie SecSettings.apk using Apktool
Download the SettingsSource.zip
Extract contents of SettingsSource.zip to respective folders in SecSettings.apk
Open res/xml/device_info_settings.xml
Add this just a line above the first Preference tag
Code:
<PreferenceCategory android:layout="@layout/areebisawesome" android:key="blah" android:title="" />
Now go to res/drawable
There, you'll see cosmic.png Change it to any png of size 320x200 You can change this size description in res/layout/areebisawesome.xml
N.B: Also we can use android:layout_width="fill_parent"so that if we add small resolution picture then it will automatically fill whole width
Click to expand...
Click to collapse
Recompile
Onclick Functionality
Credits to @abhi922
Open res/layout/areebisawesome.xml
Add the blue code to the XML
Code:
<?xml version="1.0" encoding="utf-8"?>
<ImageView android:layout_gravity="center" android:paddingBottom="6.0dip" [COLOR="Blue"]android:clickable="true"[/COLOR] android:layout_width="fill_parent" android:layout_height="400.0px" [COLOR="blue"]android:src="@drawable/about"[/COLOR] android:scaleType="fitXY"
xmlns:android="http://schemas.android.com/apk/res/android" />
What I've Done ????
Added android:clickable="true" ------> to make our layout clickable
Added android:src="@drawable/about" ------> it is a xml not a picture/png...[it will replace our images on click ]
Create new file about.xml at drawable folder
Add this code to it
Code:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/about2" />
<item android:state_selected="true" android:drawable="@drawable/about2" />
<item android:drawable="@drawable/about1" />
</selector>
Now add about1.png as first unpressed picture
And about2.png as pressed picture...
Recomplie
Adding About ROM new information
Decompile SecSettings.apk
Open /res/xml/device_info_settings.xml
In device_info_settings.xml, go to the end and add these lines before </PreferenceScreen> line
Code:
<PreferenceCategory android:title="@string/rom_info" android:key="dummy_key">
<Preference android:title="@string/rom_name" android:key="rom_name" android:summary="@string/rom_name_details" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/rom_ver" android:key="rom_ver" android:summary="@string/rom_ver_details" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/rom_date" android:key="rom_date" android:summary="@string/rom_date_details" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/rom_developer" android:key="rom_developer" android:summary="@string/rom_developer_name" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/dev_thanks" android:key="dev_thanks" android:summary="@string/dev_thanks_name" style="?android:preferenceInformationStyle" />
</PreferenceCategory>
N.B: all referred android:key here are dummy ones they are only there just to prevent code fragmentation
Click to expand...
Click to collapse
Then open res/values/strings.xml & add the following lines
Code:
<string name="rom_info">[COLOR="Sienna"]About Rom[/COLOR]</string>
<string name="rom_name">[COLOR="Sienna"]Rom name[/COLOR]</string>
<string name="rom_name_details">[COLOR="Sienna"][ROM Name][/COLOR]</string>
<string name="rom_ver">[COLOR="Sienna"]Rom version[/COLOR]</string>
<string name="rom_ver_details">[COLOR="Sienna"]vx.x[/COLOR]</string>
<string name="rom_date">[COLOR="Sienna"]Release date[/COLOR]</string>
<string name="rom_date_details">[COLOR="Sienna"]month-year[/COLOR]</string>
<string name="rom_developer">[COLOR="Sienna"]Rom developer[/COLOR]</string>
<string name="rom_developer_name">[COLOR="Sienna"][your name] - xda.developers.com[/COLOR]</string>
<string name="dev_thanks">[COLOR="Sienna"]Thanks to[/COLOR]</string>
<string name="dev_thanks_name">[COLOR="Sienna"]Everyone for the support[/COLOR]</string>
You can change the green color text to whatever you want to display
Click to expand...
Click to collapse
You can add or remove fields in device_info_settings.xml and strings.xml as you like
Recompile
Integrating application
Decompile SecSettings.apk.
Decompile the program that you want to add to settings menu (in this example will take chainfire's SuperSU app)
Go to res\drawable-xhdpi folder and add icon for your program that you want to add (you can take it from decompiled program in res/mipmap-xhdpi.
Go to res\values folder and open strings.xml by NotePad++ and add these lines just before </resources> for your program
Code:
<string name="romaddons">ROM Addons</string>
<string name="superuser_text">Superuser</string>
Go to \res\xml folder and open settings_headers.xml by NotePad++ and add the blue lines
Code:
<header android:icon="@drawable/ic_settings_accessibility" android:id="@id/accessibility_settings" android:title="@string/accessibility_settings" android:fragment="com.android.settings.AccessibilitySettings" />
[COLOR="Blue"] <string name="romaddons">ROM Addons</string>
<header android:icon="@drawable/ic_settings_superuser" android:title="@string/superuser_text">
<intent android:targetPackage="eu.chainfire.supersu" android:action="android.intent.action.MAIN" android:targetClass="eu.chainfire.supersu.MainActivity" />
</header>[/COLOR]
<header android:icon="@drawable/ic_settings_development" android:id="@id/development_settings" android:title="@string/development_settings_title" android:fragment="com.android.settings.DevelopmentSettings" />
Then install the program you want to add on your phone
Extra step is to remove this line in AndroidManifest.xml in your decompiled SuperSU app so to disappear from the launcher
Code:
<category android:name="android.intent.category.LAUNCHER" />
Adding other apps
Sample down here for learning
Code:
<header android:icon="@drawable/ic_settings_xxxx" android:title="@string/xxxx_text">
<intent android:targetPackage="" android:action="" android:targetClass="" />
</header>
"android:icon="@drawable/ic_settings_xxxx"" : name of icon you put in drawable-xhdpi folder if you want it to be empty the add this to drawable and empty_icon as the name of the icon
"android:title="@string/xxxx_text"" : name of string put for added program in strings.xml
"android:targetPackage=""" : package of wanted program inside its own AndroidManifest.xml
"android:action=""" : first action of wanted program inside its own AndroidManifest.xml
"android:targetClass=""" : class of the wanted package inside its own AndroidManifest.xml to start with in this case its .MainActivity
Settings menu extra hidden options
Credits to @tkari4
Baksmali SecSettings.apk
Open com\android\settings\Settings.smali
Look for these lines and delete them:
Code:
invoke-interface {p1, v0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z
goto/16 :goto_23
Note that some FC so head to the forum or download SettingsSmali.rar to see what works or not
Adding TorchLight Option
Credits to @Stavr0s91i
Decompile SecSettings.apk
Goto res/xml/display_settings.xml
Apply Changes Below (Blue)
Code:
<PreferenceCategory android:title="@string/tts_general_section_title" android:key="general" />
<PreferenceScreen android:title="@string/wallpaper" android:key="wallpaper" android:fragment="com.android.settings.WallpaperSettings" />
<PreferenceScreen android:title="@string/led_indicator_settings" android:key="led_indicator_settings" android:fragment="com.android.settings.LedIndicatorSettings" />
[COLOR="Blue"]<PreferenceScreen android:title="Torchlight" android:key="torchlight" android:fragment="com.android.settings.torchlight.TorchlightSettings" />[/COLOR]
<PreferenceScreen android:title="@string/notification_panel_title" android:key="notification_panel_edit" android:fragment="com.android.settings.NotificationPanelMenu" />
<CheckBoxPreference android:title="@string/multi_window_title" android:key="key_multi_window" android:summary="@string/multi_window_summary" android:widgetLayout="@touchwiz:layout/preference_widget_twcheckbox" />
<SwitchPreferenceScreen android:title="@string/page_buddy" android:key="contextualpage_settings" android:summary="@string/page_buddy_summary" android:fragment="com.android.settings.ContextualPageSettings" />
Compile SecSettings.apk!
Setting up a custom settings tab
Credits to @Didact74
Download Smali.zip
Place it in smali/com/android/settings
Navigate to res/xml/settings_headers.xml
Add this line of code anywhere you want it
Code:
<header android:icon="@drawable/ic_settings_romcontrol" android:id="@id/new_tab" android:title="@string/rom_control" android:fragment="com.android.settings.NewTab" />
android:icon="@drawable/ic_settings_romcontrol = The icon you see in the tab and the location that icon is stored
android:id="@id/new_tab" = Android ID thats stored in res/values/ids
android:title="@string/rom_control" = The title the new tab is given located in res/values/strings
android:fragment="com.android.settings.NewTab" = points to the smali that controls this tab
Create your own icon.png (size 50 x 50) and drop it in res/drawable-xhdpi
Navigate to res/values/strings.xml & add this line of code before </resources>
Code:
<string name="rom_control">Rom Control</string>
<string name="rom_addons">Rom Addons</string>
Create an XML file with the name "new_tab.xml"
Navigate to res/values/ids.xml & add this line of code before </resources>
Code:
<item type="id" name="new_tab">false</item>
Example:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/rom_addons"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<!-- Place your settings here -->
</PreferenceScreen>
You will need to add the necessary lines to res/strings found in the XML if would add any others
Do not worry about finding a unique ID for res/public just let the system generate one for you
Click to expand...
Click to collapse
Recompile the decompile to generate ids in public.xml
Find this line in res/values/public.xml
Code:
<public type="xml" name="new_tab" id="0x7fxxxxxx" />
Take your unique id and change it in NewTab.smali from
Code:
const v1, [COLOR="Red"]0x7f070082[/COLOR]
To
Code:
const v1, [COLOR="Blue"]0x7fxxxxxx[/COLOR]
Then change
Code:
invoke-virtual {p0, v1}, Lcom/android/settings/[COLOR="Red"]didact/RomSettings[/COLOR];->addPreferencesFromResource(I)V
To
Code:
invoke-virtual {p0, v1}, Lcom/android/settings/[COLOR="Blue"]NewTab[/COLOR];->addPreferencesFromResource(I)V
Done :good:
Switch to Light theme
Decompile the SecSettings.apk
Go to "res/values/" folder and open the file "styles.xml" with Notepad++
Click "Replace" or press "Ctrl+H"
In the "Find What :" box enter "DeviceDefault" and hit next
In the "Replace with: " box enter "DeviceDefault.Light"
Make sure only "wrap around" box is checked
Then press replace all
Compile SecSettings.apk
Permanent "Official" Device Status
This one is explained very well by @[email protected] in this post. Make sure to hit Thanks button for him
Owner Profile in About Device
Credits to @Deckoz2302, @b16h22 and @nightwalker
Download the zip and extract it Owner_Profile_Mod.zip
Decompile SecSettings.apk
Go to res/values/ids.xml... add these:
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>
<item type="id" name="profile">false</item>
<item type="id" name="profile_name">false</item>
<item type="id" name="ic_qs_default_user">false</item>
Next go to res/values/strings.xml.. add these:
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>
Now find the files you extracted and put the com folder in correct directory..
Code:
SecSetting/smali/com/blac
Now put the files from the res folder in correct directories..
Code:
res/layout/lacourb.xml
res/layout/profile_info.xml
res/drawable-hdpi/ (is where the png files go)
res/drawables/done.xml
res/drawable/pick_profile_picture.xml
Forgot to include it so add ic_qs_default_user to res/drawable/xhdpi
Now go to where you want to have the option of changing the Profile Picture and Name. Maybe display_settings.xml it doesn't matter so put it where you want it.
Code:
<PreferenceScreen android:title="Owner Profile Picture">
<intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.blac.Profile" />
</PreferenceScreen>
XML's will vary too depending on which one you pick so you need adjust the tag in the beginning of the line and the end of line depending on what it is calling. Example: <PreferenceScreen></PreferenceScreen> OR <headers></headers> so visualize the layout of the xml
Now go to res/xml/device_info_settings.xml and add:
Code:
<PreferenceCategory android:title="Device Info" />
<PreferenceScreen android:fragment="[COLOR="Orange"]com.android.settings.deckoz.RomControl.General[/COLOR]" android:focusable="false" android:layout="@layout/lacourb" android:key="profile_pic" />
Pay special attention to the line in ORANGE. This line defines where it takes you when the image is clicked when in About Device. So you would NOT add the same directory as mine because you won't have it. But you DO need to define this because if DO NOT it will FC
So say you want it to be under Users in SecSettings/General/Users.. you would add it like this:
Code:
<PreferenceCategory android:title="Device Info" />
<PreferenceScreen android:fragment="[COLOR="Orange"]com.android.settings.UserSettings[/COLOR]" android:focusable="false" android:layout="@layout/lacourb" android:key="profile_pic" />
So now when you click the picture in About Device it will bring you to this directory in SecSettings. So you'll end up in SecSettings/General/Users
Now open your AndroidManifest.xml. At the bottom add these lines:
Code:
<activity android:label="@string/change_pic" android:name="com.blac.Profile">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
Okay now compile your SecSettings..Then grab the newly compiled one and decompile it.. Make sure you keep the AndroidManifest.xml because you changed it..
Now go to the MY public.xml you downloaded and extracted and then open YOUR res/values/public.xml open it and keep it open..You need to have these open to compare ids..
Open your smali folder you added: com/blac/
You need to find all the ids in the smali and change them to match yours.. for example open com/blac/Profile.smali.. Search 0x7f0401ee
Under my public.xml this id: 0x7f0401ee is for "profile_info".. Yours will NOT be the same.. SO you need to search each id in the smali and then in MY public.xml, you downloaded, then search yours and changed the id's...
NOTE: Be free to changed whatever you want..directories, names of xml etc...
Adding 5 icons shortcut on lockscreen
Credits to @Mirko ddd
Decompile SecSettings.apk and navigate to:
smali\com\android\settings\lockscreenshortcut\LockScreenShortcutSettings.smali
Search for the method ".method static constructor <clinit>()V"
Add the blue code in change of the red code
Code:
.method static constructor <clinit>()V
.registers 2
.prologue
const/4 v1, 0x0
.line 79
[COLOR="Blue"] const/4 v0, 0x5[/COLOR]
[COLOR="Red"] const/4 v0, 0x3[/COLOR]
sput v0, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->MAX_SHORTCUT_ICON:I
.line 80
sput v1, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->DEFAULT_CURSOR_WIDTH:I
.line 81
sput v1, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->ICON_5_CURSOR_WIDTH:I
return-void
.end method
Now we need to set the right icon width for the icons, if not the fifth icon won t be showed
Decompile framework-res.apk
Navigate to res\values-hdpi\dimens.xml
Edit these 2 strings with following values
Code:
<dimen name="keyguard_lockscreen_application_shortcut_icon_width">52.0dip</dimen>
<dimen name="keyguard_lockscreen_application_shortcut_icon_height">50.0dip</dimen>
Recompile and push both apks with 0644 permissions
Theming
1. Go to res/drawable-[your device dpi]
2. In here you'll find all kind of images but I'm gonna give you about some of the main images and you figure out the others
ic_settings_* : These where you find all the icons on the settings menu, some of these are unused which are hidden
ic_sync_*_holo : These are sync animations that appear in the "Accounts and sync" menu
ic_wifi_lock_signal_* & ic_wifi_signal_ *: These are wifi signals that appear in the "Wi-Fi" menu
shortcut_ *: These icons in which we make shortcuts from the settings widget
lock_anim_* : These are the tutorial images to teach you how to use pattern (don't bother if its hidden)
motion_ *: Motion tutorial (don't bother if its hidden)
3. Navigate to res/mipmap-[your device dpi]
ic_launcher_settings : Launcher icon
Now im gonna share with you S6 SecSettings resource files mainly png files. Link
CSC Features
Navigate to system/csc/feature.xml or others.xml..
These are some of the features you can add so read the description and choose your preference
Code:
[COLOR="Green"]<!-- Most of them are universal but no guarantees given -->[/COLOR]
[COLOR="green"] <!-- Start Features -->[/COLOR]
[COLOR="green"] <!-- Hide Software Update from Settings -->[/COLOR]
[COLOR="blue"]<CscFeature_Setting_DisableMenuSoftwareUpdate>true</CscFeature_Setting_DisableMenuSoftwareUpdate>[/COLOR]
[COLOR="green"] <!-- Show your hardware revision in Settings->About (same as dialing *#12580*369#) -->[/COLOR]
[COLOR="blue"]<CscFeature_Setting_EnableHwVersionDisplay>true</CscFeature_Setting_EnableHwVersionDisplay>[/COLOR]
[COLOR="green"]<!-- Restore the hidden APN -->[/COLOR]
[COLOR="blue"] <CscFeature_Setting_HideApnList>pcweb.tmobile.com</CscFeature_Setting_HideApnList>[/COLOR]
[COLOR="green"]<!-- Find my mobile/Sim replacement alert -->[/COLOR]
[COLOR="blue"] <CscFeature_Setting_DisableMenuFindMyMobile>false</CscFeature_Setting_DisableMenuFindMyMobile>
<CscFeature_Settings_FindMyMobile>true</CscFeature_Settings_FindMyMobile>[/COLOR]
[COLOR="green"]<!-- Call and message block -->[/COLOR]
[COLOR="blue"]<CscFeature_Setting_EnableMenuBlockCallMsg>true</CscFeature_Setting_EnableMenuBlockCallMsg>[/COLOR]
[COLOR="green"]<!-- Factory data reset password -->[/COLOR]
[COLOR="blue"] <CscFeature_Setting_EnableFactoryResetPasswordWhenNoSIM>true</CscFeature_Setting_EnableFactoryResetPasswordWhenNoSIM>[/COLOR]
[COLOR="green"]<!-- Display installed variant -->[/COLOR]
[COLOR="blue"]<CscFeature_Common_EnableRegionalDevice>true</CscFeature_Common_EnableRegionalDevice>[/COLOR]
[COLOR="green"] <!-- End Features -->[/COLOR]
Push the xml & set permissions to 0644
Reserved
Additions:
- Added CSC Features
Awesome guide mate
Straight Outta Wcoast
wcoast said:
Awesome guide mate
Straight Outta Wcoast
Click to expand...
Click to collapse
Thanks its only the beginning
RainbowLaw said:
Thanks its only the beginning[emoji14]
Click to expand...
Click to collapse
Keep up the good work...
Straight Outta Wcoast
Wohoo thanks a lot mate, i am new learner will test your guides on my galaxy note 5 rom. Keep up the good work mate
nice mate
since i never want to search about sec bla bla bla .apk mod tutorial
thx for ur guide
keep it up
Really good guide, hope you continue to add to it. Should be on xda portal
Sent from my SM-N920C using Tapatalk
RainbowLaw said:
Theming
1. Go to res/drawable-[your device dpi]
2. In here you'll find all kind of images but I'm gonna give you about some of the main images and you figure out the others
ic_settings_* : These where you find all the icons on the settings menu, some of these are unused which are hidden
ic_sync_*_holo : These are sync animations that appear in the "Accounts and sync" menu
ic_wifi_lock_signal_* & ic_wifi_signal_ *: These are wifi signals that appear in the "Wi-Fi" menu
shortcut_ *: These icons in which we make shortcuts from the settings widget
lock_anim_* : These are the tutorial images to teach you how to use pattern (don't bother if its hidden)
motion_ *: Motion tutorial (don't bother if its hidden)
3. Navigate to res/mipmap-[your device dpi]
ic_launcher_settings : Launcher icon
Now im gonna share with you S6 SecSettings resource files mainly png files. Link
CSC Features
Navigate to system/csc/feature.xml or others.xml..
These are some of the features you can add so read the description and choose your preference
Code:
[COLOR="Green"]<!-- Most of them are universal but no guarantees given -->[/COLOR]
[COLOR="green"] <!-- Start Features -->[/COLOR]
[COLOR="green"] <!-- Hide Software Update from Settings -->[/COLOR]
[COLOR="blue"]<CscFeature_Setting_DisableMenuSoftwareUpdate>true</CscFeature_Setting_DisableMenuSoftwareUpdate>[/COLOR]
[COLOR="green"] <!-- Show your hardware revision in Settings->About (same as dialing *#12580*369#) -->[/COLOR]
[COLOR="blue"]<CscFeature_Setting_EnableHwVersionDisplay>true</CscFeature_Setting_EnableHwVersionDisplay>[/COLOR]
[COLOR="green"]<!-- Restore the hidden APN -->[/COLOR]
[COLOR="blue"] <CscFeature_Setting_HideApnList>pcweb.tmobile.com</CscFeature_Setting_HideApnList>[/COLOR]
[COLOR="green"]<!-- Find my mobile/Sim replacement alert -->[/COLOR]
[COLOR="blue"] <CscFeature_Setting_DisableMenuFindMyMobile>false</CscFeature_Setting_DisableMenuFindMyMobile>
<CscFeature_Settings_FindMyMobile>true</CscFeature_Settings_FindMyMobile>[/COLOR]
[COLOR="green"]<!-- Call and message block -->[/COLOR]
[COLOR="blue"]<CscFeature_Setting_EnableMenuBlockCallMsg>true</CscFeature_Setting_EnableMenuBlockCallMsg>[/COLOR]
[COLOR="green"]<!-- Factory data reset password -->[/COLOR]
[COLOR="blue"] <CscFeature_Setting_EnableFactoryResetPasswordWhenNoSIM>true</CscFeature_Setting_EnableFactoryResetPasswordWhenNoSIM>[/COLOR]
[COLOR="green"]<!-- Display installed variant -->[/COLOR]
[COLOR="blue"]<CscFeature_Common_EnableRegionalDevice>true</CscFeature_Common_EnableRegionalDevice>[/COLOR]
[COLOR="green"] <!-- End Features -->[/COLOR]
Push the xml & set permissions to 0644
Click to expand...
Click to collapse
Nice
Super helpful thread
Does anyone want to know how to change the default app on the home screen? I want to basically be able to change it where my app shows default on the home. So even if I factory reset it will still show on the homescreen.
asapmoola310 said:
Does anyone want to know how to change the default app on the home screen? I want to basically be able to change it where my app shows default on the home. So even if I factory reset it will still show on the homescreen.
Click to expand...
Click to collapse
Well its off-topic but you need to decompile your launcher if its samsung launcher then its SecLauncher2.apk or touchwiz30launcher.apk then go to res/xml here you will find the arrangements modify it then compile push it to your device and then clear data for the launcher
@RainbowLaw thanks for mentioning one of my tricks. Great thread, welldone.
Thanks for the guide really helpful
I was wondering if you can help me theming
How to change actionbar blue color ?
And settings text color ?
image hosting free no registration
I couldnt find those colors in color.xml !!!!
Thanks in advance
Enabling multi-user
Decompile framework-res.apk
As of Android 5.0, the multi-user feature is disabled by default. To enable it, device manufacturers must define a resource overlay that replaces the following values in:
frameworks/res/values/bool.xml
frameworks/res/values/integer.xml
<!-- Whether Multiuser UI should be shown -->
<bool name="config_enableMultiUserUI">false</bool>
<!-- Maximum number of supported users -->
<integer name="config_multiuserMaximumUsers">1</integer>
Replace the value of config_enableMultiUserUI with: true
Replace the value for config_multiuserMaximumUsers with one greater than 1
recompile and sign