[TUTORIAL]Xposed module devlopment - XDA-University

Iv'e recently started a blog on Xposed Module development. It goes through the basics for a beginner and explains in as much detail as possible. You can find it here
http://xposedtutorial.blogspot.co.uk/p/tutorial-1-setting-up.html
Edit: I've now decided to keep the tutorial on XDA. I might also keep a copy on the blog, not sure yet
P.S: A lot of this tutorial is based on the original development tutorial which can be found here, credits to rovo89
Tutorial 1 - Setting up
There are a few requirements for making an Xposed Module.
*Eclipse, or Java IDE of your choice, with Android SDK and devlopment enviornment set up. I'm not going to cover that in this tutorial
*Knowledge of Java programming language
*An android phone which supports Xposed, with Xposed installed and working for testing on
*Some knowledge of Android development
*Time
*An idea of course
For the purpose of this tutorial, we will be creating two modules (using two different features of the xposed bridge). The first will replace the clock in the status bar with a smiley face. The second will change the height of the navigation bar. I will be using Eclipse or Android Studio in this tutorial.
Eclipse
NEW: this tool will setup the project for you! http://forum.xda-developers.com/showthread.php?t=2712825
Firstly you must set up an Android project as normal. For the target API, use the latest available. Name the project Smiley Clock, and choose a package name.
We won't need an Activity for this module, so don't create one
{
"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"
}
Android Studio
Firstly you must set up an Android project as normal. For the target API, use the latest available. Name the project Smiley Clock, and choose a package name.
We won't need an Activity for this module, so don't create one
OK, that's the project created. Now we need to make Xposed recognize this as a module. Add the following meta tags to your Android Manifest, within the Application tag
Code:
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposedminversion"
android:value="30" />
<meta-data
android:name="xposeddescription"
android:value="Add a smiley face" />
At this point you can run the application on your test device. It should show up in the Xposed Installer app as a module. Check the box to enable your module and reboot your device. Of course, the module won't do anything yet!
A good idea at this point would be to add a new filter to your logcat to track error messages from Xposed.
Studio: Go on Android Monitor (along bottom). Make a new filter and filter by tag name. The tag is "xposed"
Eclipse:
Add a filter named "Xposed" and filter by the tag name "Xposed"
(picture is for Eclipse)
You will now see messages from the Xposed Framework
There will be an error for your module about xposed_init file, don't worry, getting to that!
Make a new package (same as package name we used when making the Android Project) and within that package make a class. Call it anything, I'll call mine Main.
Secondly add the XposedBridge API jar. This can be found on this thread on XDA. Add the jar to the root directory of the project, NOT the lib directory.
Eclipse: Right click - build path - add to build path. Do not export it in the Order and Export tab.
Studio: Right click, add as library. Then go in gradle files and find build.gradle for the app module. Find the dependency which looks something like this
compile files('src/main/java/com/hamzahrmalik/xposedtutorial/XposedBridgeApi-54.jar')
and change the "compile" to "provided" so it is like
provided files('src/main/java/com/hamzahrmalik/xposedtutorial/XposedBridgeApi-54.jar')
Now create a file in the assets directory called xposed_init.
Studio users:
First you will need to make the assets directory. I think the easiest way is to first switch to "project files" view at the top of the navigation pane as shown below. Then create a folder inside src/main called assets. Then place the xposed_init in the assets folder.
Inside this file, type:
packagename.classname
where packname is the name of your package and class name is the name of your class. So in my case I will type
com.hamzah.smileyclock.Main
This tells Xposed where to look for the code for the module. You file tree should now look like this
Now the project is set up. In the next tutorial, we will look at how Xposed works, this will help you understand how to make modules.
Tutorial 2 - Brief introduction to how Xposed works
This tutorial is not really a true tutorial (gasp!). It will outline some basic features of Xposed which will help you understand future tutorials.
Xposed allows a developer to access and modify the code for system applications. For example, one useful feature is the "find and hook" feature. This allows a developer to find a method inside another application and add their own code after it. So you could find the method in the Android source code that alerts the user when the wrong pattern is entered, and then instruct the system to hook onto that method and edit the alert to say something else. Another thing that Xposed allows us to do is replace resources. This includes Strings dimensions, drawables and much more. So we could edit the dimension of the navigation bar height (which we will in later tutorials) by replacing the resource which tells it what height to be.
The next tutorial, we will start exploring the Android code and see what methods to hook to replace the clock with a smiley face!
Tutorial 3 - Exploring the target and modifying it
Ok so at this point, you should have an Xposed mod thatdoes nothing. The next step is to work out exactly what we want it to do! We want it to edit the clock, by hooking the method (read the last tutorial for more informtion on this). So the first step is to find that method.
So visit http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/ in your browser to view Android's source code. If (in Android 4+) you browse to com.android.systemui.statusbar.policy.Clock.java
you will find the class that controls the clock. In here, there is a handy method called updateClock() which ppears to be controlling what gets written to the TextView in the statusbar (this whole class extends TextView). Now if you know how to make Android apps (which you should) you will be familiar with TextView. We can manipulate this TextView by changing colour, text, font, size etc, as you could with a TextView in a normal Android app.
Of course this was easy, but depending on exactly what you want your module to do, you may have to hook many methods. If you've ever modded APK's, you'll know what i mean
This was another short tutorial, in the next one we will start coding the module
Tutorial 4 - The Code
In this tutorial we can finally get to some code. Exciting right?
OK so we now have the following information
*We can hook methods using Xposed
*There happens to be a method which writes text to the clock
*We can hook this method to edit the text
So first of all, fire up your eclipse workspace and have you Xposed class implement IXposedHookLoadPackage
Then add unimplemented methods.
Your class should now look like:
Code:
package com.hamzah.smileyclock;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
public class Main implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
}
}
The method that we are overriding gets called every time the user or system opens an app. We can use the parameter of the method to check when systemui gets loaded, then hook into it and modify the clock. Easy right?
Add this inside your method
Code:
if (!lpparam.packageName.equals("com.android.systemui"))//check if the package being loaded is systemUI
return;
//All code here is only called if it is indeed SystemUI
So now we need our hook, add this code after the return:
Code:
findAndHookMethod("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, "updateClock", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});
NOTE: this will only work because updateClock doesn't need any parameters. If the method you want to hook does, see tutorial 9
You must also add the following imports statements
Code:
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
Explanation: The findAndHookMethod is hooking onto com.android.systemui.statusbar.policy.Clock
The afterHookedMethod allows us to add our own code after the system method is executed, so in this case, the code to add a smiley face will go here. The MethodHookParam allows us to modify the TextView of the method we are hooking. So we need to get hold of that TextView, add this code
Code:
TextView tv = (TextView) param.thisObject;
This is the TextView containing the clock, whatever we do with this TextView at this point, will happen to the TextView in the statusbar, So now simply add
Code:
tv.setText(":)");
This will replace the clock with a smiley face. Alternatively, use
Code:
tv.appendText(":)");
to keep the time and add the smiley after it
Now deploy the app to your test device, and reboot. You should see a smiley face in place of the clock!
Full Code
Code:
package com.hamzah.smileyclock;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import android.widget.TextView;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
public class Main implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals("com.android.systemui"))
return;
findAndHookMethod("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, "updateClock", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
TextView tv = (TextView) param.thisObject;
tv.setText(":)");
}
});
}
}
That's it for SmileyClock, in the next tutorial, we will look at another feature of Xposed, that is, replacing resources, and will enable/disable the screen wake up on unplug and also edit the height of the system navigation bar.
Tutorial 5 - Replacing Resources
Xposed allows us to replace resources such as String, int, boolean, dimen, or even drawables. In this tutorial we will enable/disable screen wake-up on unplug and in the next one, replace the dimen of navigation bar height and width to make it half size. Simple resources like int and String can be replaced by passing the new value as a parameter but more complex ones like drawable and dimen must be referenced from your own resources. Don't worry, I'll explain it all!
First, we will replace a boolean which tells the system whether or not to wake the screen on unplug. There is a boolean in the framework-res.apk (found in /system/framework) which tells the system this information. We can used Xposed to edit this value, without touching the APK. My phone's default is false so I'm going to make it true, if yours is already true, make it false to make it more noticeable. In a future tutorial, when we learn saving preferences, we will add the ability for the user to set the value. For now, it will be hard coded.
Firstly set up a new project as in tutorial 1. Call it anything. Again, no activity or icon required, though you might want an icon anyway.
Have your class implement IXposedHookZygoteInit
and add unimplemented methods. This is called before anything else and we will use it for replacing our resource.
Add this code inside the initZygote method
Code:
XResources.setSystemWideReplacement("android", "bool", "config_unplugTurnsOnScreen", false);
android is the package name of framework-res, bool is the type of resource (boolean) "config_unplugTurnsOnScreen" is the variable we are replacing and false is the new value.
Now when you run this module, enable and reboot, you should find that if you plug in a charger, turn off the screen, and unplug it, nothing will happen. If you were to change it to TRUE instead of FALSE, when you unplugged, it would wake the screen.
In the text tutorial, we will replace the navigation bar height
Tutorial 6 - Complex Resources
In this tutorial we will change the height of the navigation bar to 36dp, normal is 48dp. Much is the same as last time, but there are a few differences. Once again, set up a new project. Have your module class implement IXposedHookZygoteInit once again. Also implement IXposedHookInitPackageResources
Add the unimplemented methods.
Make a new variable inside the initZygote method:
Code:
String MODULE_PATH = startupParam.modulePath;
In the handleInitPackageResources method, add
Code:
if (!resparam.packageName.equals("android"))
return;
Now we know we are in the right package
Add:
Code:
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
Use CTRL-SHIFT-O in Eclipse to import the necessary packages.
Next we need a dimen resource to forward as the height of the navigation bar. Make a new XML files inside /values called dimens.xml. Add this inside it
Code:
36dp
Now all that's left is to forward this to be used. Add this code inside handleInitPackageResources
Code:
XResources.setSystemWideReplacement("android", "dimen", "navigation_bar_height", modRes.fwd(R.dimen.navigationbarSize));
The first 3 parameters are the same as the ones in tutorial 5. The last one has the same function as in the las tutorial, but rather than passing a variable, we are forwarding a resource. This could also be done with drawables, I once made a module to replace all buttons on the navigation bar with the ones found on Xperia ROM's.
At this point, when you deploy the module, enable it and reboot, your navigation bar should be noticeably smaller.
In the next tutorial we will look at creating and user interfaces and saving data in ways that both interface and module can read and write to. We will be using the mod we made in tutorial 4, and allow the user to define text rather than have a smiley face.
Tutorial 7 - User Interfaces and Preferences
Open up the SmileyClock we made in Tutorial 4. We did not make an Activity so make one now, File>New>Android Activity. Make sure you make it a Launcher Activity. We need to widgets in our UI, a textbox and an Apply button. I'm not going to cover making these, just make sure you have a method called when the button is pressed. Make the EditText id "input" so it will be easier to follow the tutorial because that is what i am making mine.
When the apply button is pressed in my case this method is called
Code:
public void apply(){
EditText et = (EditText) findViewById(R.id.input);
String input = et.getText().toString();
}
So now I have the user input as a String, I need to save it. Use Android SharedPreferences for this,
Code:
SharedPreferences pref = getSharedPreferences("user_settings", MODE_WORLD_READABLE);
The mode world readable is crucial to allow the Xposed Module to read it, otherwise you will get permission denied. Now get the Editor and save this string as "user_text",
Code:
Editor editor = pref.edit();
editor.putString("user_text", input);
Now it is saved, we need the Xposed Module to read it. Switch back to the class containing the Xposed Module, the one we made in tutorial 4. Find this line:
Code:
tv.setText(":)");
Instead, replace it with this
Code:
XSharedPreferences pref = new XSharedPreferences("com.hamzah.smileyclock", "user_settings");
//Gets the shared preference
String text = pref.getString("user_text", "");
//reads the value which is saves, using nothing as default value to use if nothing is saved
tv.setText(text);
//sets the text to saved value
When you deploy this and set some text, that text should then appear in the status bar after the clock. Note that when you save this value, it will not change in the statusbar until you restart SystemUI. It might change when time changes, not sure.
In the next tutorial we will cover modifying layouts
Tutorial 8 - Modifying Layouts
Xposed lets us modify layouts in other apps. In this tutorial, we will modify the navigation bar with various tweaks. Firstly we will make the background blue. So make a new Xposed Project and have your module class implement IXposedHookInitPackageResources. This gives is a parameter that can be used for modifying layouts. Add the unimplemented method and add this code inside the method
Code:
resparam.res.hookLayout("com.android.systemui", "layout", "navigation_bar", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
}
});
com.android.systemui is the package name for the app containing the navigation bar View, layout is the type of resource, navigation_bar is the View name as defined in /res/layout (of SystemUI.apk). Now we need to get a View object for the navigation bar. Add this code inside the overriden method
Code:
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
View navbar = (View) liparam.view.findViewById(
liparam.res.getIdentifier("nav_buttons", "id", "com.android.systemui"));
}
We have gotten the view using the findViewById method, and passing in the ids. We know the id is "nav_buttons" because if we look at /res/layouts/navigation_bar.xml in SystemUI.apk, we see this
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.NavigationBarView android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<FrameLayout android:id="@id/rot0" android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal" android:id="@id/nav_buttons" android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:animateLayoutChanges="true">
<View android:visibility="invisible" android:layout_width="40.0dip" android:layout_height="fill_parent" android:layout_weight="0.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:layout_width="80.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_back" android:layout_weight="0.0" android:contentDescription="@string/accessibility_back" systemui:keyCode="4" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:layout_width="80.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_home" android:layout_weight="0.0" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:keyRepeat="false" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/recent_apps" android:layout_width="80.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_weight="0.0" android:contentDescription="@string/accessibility_recent" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/menu" android:visibility="invisible" android:layout_width="40.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_menu" android:layout_weight="0.0" android:contentDescription="@string/accessibility_menu" systemui:keyCode="82" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
</LinearLayout>
<LinearLayout android:orientation="horizontal" android:id="@id/lights_out" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:layout_width="80.0dip" android:layout_height="fill_parent" android:layout_marginLeft="40.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="80.0dip" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="80.0dip" android:layout_height="fill_parent" android:layout_marginRight="40.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
</LinearLayout>
<View android:layout_gravity="top" android:id="@id/deadzone" android:clickable="true" android:layout_width="fill_parent" android:layout_height="@dimen/navigation_bar_deadzone_size" />
</FrameLayout>
<FrameLayout android:id="@id/rot90" android:paddingTop="0.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
[COLOR="Green"]<LinearLayout android:orientation="vertical" [COLOR="Red"]android:id="@id/nav_buttons"[/COLOR] android:clipChildren="false" android:clipToPadding="false" android:layout_width="fill_parent" android:layout_height="fill_parent" android:animateLayoutChanges="true">[/COLOR]
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/menu" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="40.0dip" android:src="@drawable/ic_sysbar_menu_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_menu" systemui:keyCode="82" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/recent_apps" android:layout_width="fill_parent" android:layout_height="80.0dip" android:src="@drawable/ic_sysbar_recent_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_recent" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:layout_width="fill_parent" android:layout_height="80.0dip" android:src="@drawable/ic_sysbar_home_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" systemui:keyRepeat="false" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/back" android:layout_width="fill_parent" android:layout_height="80.0dip" android:src="@drawable/ic_sysbar_back_land" android:layout_weight="0.0" android:contentDescription="@string/accessibility_back" systemui:keyCode="4" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="40.0dip" android:layout_weight="0.0" />
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/lights_out" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent" android:layout_height="80.0dip" android:layout_marginTop="40.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="fill_parent" android:layout_height="80.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_large" android:scaleType="center" android:layout_weight="0.0" />
<View android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" />
<ImageView android:layout_width="fill_parent" android:layout_height="80.0dip" android:layout_marginBottom="40.0dip" android:src="@drawable/ic_sysbar_lights_out_dot_small" android:scaleType="center" android:layout_weight="0.0" />
</LinearLayout>
<View android:layout_gravity="left" android:id="@id/deadzone" android:clickable="true" android:layout_width="@dimen/navigation_bar_deadzone_size" android:layout_height="fill_parent" />
</FrameLayout>
<View android:id="@id/rot270" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" />
</com.android.systemui.statusbar.phone.NavigationBarView>
Now we can call methods we could normally call on a View object. Add
Code:
navbar.setBackgroundColor(Color.BLUE);
When you run this on your phone, your navigation bar will be blue. Now of course you can also call other methods, such as adding in new TextView's or whatever. If you were to inspect the code more closely, you would find there are also ids called "home" "back" and "recent_apps". You could use these to mess around with the buttons, though I cannot imagine what!
Tutorial 9 - Methods with parameters
In an earlier tutorial, we covered hooking methods. But what if a method wants a parameter too?
Say if i want to hook onCreate(Bundle savedInstances) in com.android.settings
If i hook it using
Code:
findAndHookMethod("com.android.settings.Settings", lpparam.classLoader, "onCreate", new XC_MethodHook() {
});
It will throw a methodNotFound error. So we need to specify the parameters. The method wants a Bundle object. So add Bundle.class as a parameter
Code:
findAndHookMethod("com.android.settings.Settings", lpparam.classLoader, "onCreate", [B]Bundle.class[/B], new XC_MethodHook() {
});
Now lets pretend Bundle.class isnt in the SDK and is a system class so cant be referenced. I would use a String instead:
"android.os.Bundle"
Code:
findAndHookMethod("com.android.settings.Settings", lpparam.classLoader, "onCreate", [B]"android.os.Bundle"[/B], new XC_MethodHook() {
});

Great
Sent from my Nexus 4 using Tapatalk

Excellent

The next few tutorials are up,
1-Setting Up
2-Background Info on Xposed
3-Exploring Your Target
4-The Code

The full tutorial is now at the top of this thread and all future tutorials will be added to that post. I will also post another post on this thread when i add one so subscribers will get a message

Great guide! And Congratulations! You are on XDA Portal!
I was compiling this guide in MS Word, but you did it first!
Congrats again!

Been waiting for this since so long
Congrats

Nice, i was searching for this

Excellent tut hoping to see more from you! Best of luck n congrats!
Sent from my Xperia Tipo using XDA Premium 4 mobile app

Sweet tutorial Much appreciated!

Nice Tutorials, but this what you've posted until now is already published by a lot of peoples (also on the offical GitHub-Page).
It would be awesome if you show some other (non-public) Tutorials, e.g how to make a PreferenceMenu and use it
#KeepItUp

Awesome tutorial... buddy.
Sent from my Micromax A67 using Tapatalk 4

good guide bro !! thanks pressed :d

Amazing!, I will start my Xposed learning by this, thanks man.

Thanks a lot.
Not only intereting but very well explained.

Android-xp said:
Nice Tutorials, but this what you've posted until now is already published by a lot of peoples (also on the offical GitHub-Page).
It would be awesome if you show some other (non-public) Tutorials, e.g how to make a PreferenceMenu and use it
#KeepItUp
Click to expand...
Click to collapse
In this tutorial i plan to explain every feature of Xposed thoroughly

hamzahrmalik said:
In this tutorial i plan to explain every feature of Xposed thoroughly
Click to expand...
Click to collapse
Ok, very nice! I'm keepin up to date in here.

Tutorial 5 is up

Tutorial 6 is up, 7 will be tomorrow now

Great explanation...
Thanks man...

Related

(08-15)Noobs guide to changing the Status bar font color

I was having a very difficult finding any information on how to modify the font color in the status bar so I decided it would be best to document it...here on xda.
What's covered in this thread:
How to edit the font color on the status bar.
How to make the status bar transparent
Credit:
Gruesomewolf For giving me the initial instructions on how to make background and status bar transparent.
JsChiSurf For guiding me through what I was doing wrong in order to make the status bar transparent.
xml items to modify the font in the status bar
Located in SystemUI.apk
layout>status_bar_expanded.xml
*This changes the Gingeritis 3D BETA VII font color and font size (Or Sprint if EVO)
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Title" android:textSize="21.0px" android:textColor="#ff58aad0"
For EVO/EVO 3D the line code is:
<com.htc.widget.HtcBlinkingTextView android:textAppearance="?android:textAppearanceLarge" android:textSize="@dimen/status_bar_title_font_size" android:textColor="#ff58AAD0"
For the EVO/EVO 3D Clear button:
<TextView android:textSize="@dimen/clear_button_font_size" android:textColor="#ff58aad0"
{
"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"
}
layout>quick_settings.xml
*To change the color of the quick setting font color in the status bar
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Title" android:textSize="21.0px" android:textColor="#ff58aad0"
values>Drawables
*To change the color of the Status bar Nofication Font
item type="drawable" name="APKTOOL_DUMMY_015c">false</item>
<item type="drawable" name="shade_bgcolor">#ff282828</item>
<item type="drawable" name="notification_header_text_color">#ff58aad0</item> <<<<----This changes the Text, "Notification seen in the top of the status bar while under Notifications
<item type="drawable" name="notification_number_text_color">#ff000000</item> <<Change back to white
<item type="drawable" name="list_item_background">#ffffffff</item>
<item type="drawable" name="list_item_background_gray">#fff2f2f2</item>
values>Colors
*Changes the primary and secondary status bar font color
<color name="white">#ff58aad0</color> <<<<<----This changes what the font color is when pressed on the status bar
<color name="black">#ff000000</color>
<color name="half_white">#7fffffff</color>
<color name="half_black">#7f000000</color>
<color name="primary_text_color">#ffffffff</color> <<<<---Primary Font Color
<color name="secondary_text_color">#ff000000</color> <<<<----Secondary Font Color
values>styles
*Changes the status bar font from bold to normal (What says Ginergitis 3D V1.0/Sprint) If you don't want it bold. It looks better bolded
*It also changes the bold appearance of the secondary font. They both look better bolded
<style name="TextAppearance.StatusBar.Title" parent="@android:style/TextAppearance.StatusBar">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textSize">15.0sp</item>
<item name="android:textStyle">bold</item> <<<<-----change to normal for none bold font
<item name="android:textColor">@drawable/notification_header_text_color</item>
End Result of changing colors
As I learn more about the status bar, I'll be updating this thread.
How to make the status bar transparent
Decompile the SystemUI.apk, the smali edits to enable transparency are as fallows
Open up "StatusBarService.smali", located in /smali/com/android/systemui/statusbar/"
Look for this line:
Code:
.line 504 .local v7, view:Lcom/android/systemui/statusbar/StatusBarView;
Directly below that are these lines:
Code:
const/4 v1, 0x2
iput v1, p0, Lcom/android/systemui/statusbar/StatusBarService;->mPixelFormat:I
.line 506
Delete those lines
Several lines below that you should find this line:
Code:
iget v5, p0, Lcom/android/systemui/statusbar/StatusBarService;->mPixelFormat:I
Change that to this
Code:
const/4 v5, -0x3
Next find this line:
Code:
.line 1731
const/4 v5, 0x2
Change it to: (note this line should be under .method onBarViewAttached()V)
Code:
.line 1731
const/4 v5, -0x3
Smali editing is complete!
Then we have to do some xml editing!
Look for "status_bar_tracking.xml", found in /res/layout <<<<Should be status_bar_expanded.xml
Line:
Code:
<View android:id="@id/background" android:background="@drawable/list_item_background"
change to:
Code:
<View android:background="@drawable/status_bar_background"
After find this line:
Code:
<View android:id="@id/tab_header" android:background="@drawable/list_item_background"
and again change to this
Code:
<View android:background="@drawable/status_bar_background"
Done!! Recompile .apk
Im sure by now you can see that we will now be able to simply make the .png named status_bar_backround transparent and thats that! Hope this helps!
EDIT:
status_bar_expanded.xml is what you need to edit. BTW, you do not reference the .9 when referencing .pngs. The system handles this automatically.
The background is hard coded in status_bar_expanded, and you have to re-arrange things.
list_item_background is what controls the default background / color for the notifications. It is fixed to a color. You can change the color, or even change it to point to an image if you want, such as the image you are attempting to modify, or assign it a full transparency if you don't want an image in the background, but rather, just for it to be clear, "#00000000".
Change the Quick Settings status bar to Transparent
Open up quick_setttings.xml found in res/layout/
Look for this line:
Code:
<LinearLayout android:orientation="vertical" android:background="@drawable/list_item_background" android:layout_width="fill_parent" android:layout_height="wrap_content">
Change "list_item_background to status_bar_background
It should look like this:
Code:
<LinearLayout android:orientation="vertical" android:background="@drawable/status_bar_background" android:layout_width="fill_parent" android:layout_height="wrap_content">
FAQ
Q:I placed @drawable/status_bar_background to anyplace it said @drawable/list_item_background.
However, my transparent png is located in SystemUI.apk/drawable-hdpi. Will the system still find it even though the code says, "drawable?"
A: Your close. It all depends on how your XML is laid out as it relates to parents / children, and their respective backgrounds, etc. It seems you should get want you want.
in terms of hdpi folders, etc, this too is automatically chosen by the phone, based on its resolution, etc, and you always reference simply as 'drawable' in your XML.
Q:Also, my png is named: status_bar_item_background_normal.9.png. Which is different from "status_bar_background." Will the system know what png I'm wanting to use even though it's not named the same?
A: status_bar_background is typically just the curtain, again, based on how your XML is laid out, meaning the background beneath the notifications but above the "drag bar".
Disclaimer:
If you have a customized .9 png (be careful, you must use care when editing .9 pngs as they have meta information on how they can be stretched), you can change the background to point to the exact name (less the .9.png extension, instead of status_bar_background) and see what happens.
You may also want to consider decompiling some of the SystemUI.apk files I recently posted, as I had to re-arrange some of the background settings to get things to show how I wanted, and it may help you see what I did as an example.
How to Remap the clear button:
Note: The below picture represents the clear button remap before liamstears edited it. With the below code, the clear button will be fixed and the blank status bar should no longer appear.
Credit:liamstears
Found in:res/layout/status_bar_expanded.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.ExpandedView android:orientation="horizontal" android:focusable="true" android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:background="@drawable/status_bar_header_background" android:paddingRight="@dimen/clear_button_padding_right" android:layout_width="fill_parent" android:layout_height="wrap_content">
<com.android.systemui.statusbar.CarrierLabel android:gravity="center_vertical" android:layout_gravity="center_vertical" android:orientation="vertical" android:id="@id/carrierLabel" android:paddingLeft="5.0dip" android:paddingTop="1.0dip" android:paddingBottom="1.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
<com.htc.widget.HtcBlinkingTextView android:textAppearance="?android:textAppearanceLarge" android:textSize="@dimen/status_bar_title_font_size" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/plmnLabel" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:textAppearance="?android:textAppearanceLarge" android:textSize="@dimen/status_bar_title_font_size" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/spnLabel" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</com.android.systemui.statusbar.CarrierLabel>
</LinearLayout>
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
<ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:overScrollMode="ifContentScrolls">
<com.android.systemui.statusbar.NotificationLinearLayout android:orientation="vertical" android:id="@id/notificationLinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Title" android:id="@id/noNotificationsTitle" android:background="@drawable/title_bar_portrait" android:paddingLeft="14.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/status_bar_no_notifications_title" />
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Title" android:id="@id/ongoingTitle" android:background="@drawable/title_bar_portrait" android:paddingLeft="14.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/status_bar_ongoing_events_title" />
<LinearLayout android:orientation="vertical" android:id="@id/ongoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" android:drawable="@drawable/list_item_background" />
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Title" android:id="@id/latestTitle" android:background="@drawable/title_bar_portrait" android:paddingLeft="14.0px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/status_bar_latest_events_title" />
<LinearLayout android:orientation="vertical" android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" android:drawable="@drawable/list_item_background" />
<TextView android:textSize="@dimen/clear_button_font_size" android:textColor="#ffffffff" android:layout_gravity="center" android:id="@id/clear_all_button" android:background="@drawable/btn_default_small" android:layout_width="fill_parent" android:layout_height="40.0dip" android:text="@string/status_bar_clear_all_button" style="?android:buttonStyle" />
</com.android.systemui.statusbar.NotificationLinearLayout>
</ScrollView>
<ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/title_bar_shadow" android:scaleType="fitXY" />
</FrameLayout>
</LinearLayout>
<ImageView android:id="@id/tab_divider" android:layout_width="2.0px" android:layout_height="fill_parent" android:src="@drawable/notification_separator" android:scaleType="fitXY" />
</com.android.systemui.statusbar.ExpandedView>
The main line that makes this work is as follows:
Code:
<TextView android:textSize="@dimen/clear_button_font_size" android:textColor="#ffffffff" android:layout_gravity="center" android:id="@id/clear_all_button" android:background="@drawable/btn_default_small" android:layout_width="fill_parent" android:layout_height="40.0dip" android:text="@string/status_bar_clear_all_button" style="?android:buttonStyle" />
Once again good job man!
btw the original instructions for transparency can be found here. I believe they were the same ones wolf gave you ;-)
http://forum.xda-developers.com/showpost.php?p=15199389&postcount=1237
and what is this about jschisurf? He's still around! woot woot
Dude what's that theme that your using? It looks awesome!
Sent from my ADR6300 using XDA App
tommytomatoe said:
Once again good job man!
btw the original instructions for transparency can be found here. I believe they were the same ones wolf gave you ;-)
http://forum.xda-developers.com/showpost.php?p=15199389&postcount=1237
and what is this about jschisurf? He's still around! woot woot
Click to expand...
Click to collapse
Awesome thread you posted. Thanks. I'm sure I missed something because the quick setttings status bar isn't transparent like the notification bar is. I'm sure I'll figure out what I did wrong after reading your post, thanks.

[GUIDE] Pattern Lock Tweaks - Wallpaper Brightness, Pattern Lock Dots, etc.

This is a summary of a Galaxy S II thread, but it should be applicable to other Android phones with a pattern lock. Some of this info is elsewhere in bits and pieces, but enough of it is new to warrant a full post. Plus it is helpful to have it all in one place.
Pattern Lock Wallpaper Brightness
Normally the pattern lock wallpaper is not as bright as the original image-- there's a dim or dark filter over it. To change this, decompile framework-res.apk (use apktool or apk_manager), and edit res\layout\keyguard_screen_unlock_portrait.xml.
On line 4, change android:background="#70000000" to android:background="@color/transparent"
Compile framework-res.apk and put it back into system\framework. Reboot and you should see that the pattern lock wallpaper is the same brightness as the original image! You can also try changing the "#70000000" to another hex color code for different effects.
Alternative by LfcFan1977:
LfcFan1977 said:
I am using a Htc Desire on dGB aosp rom but just to add to this thread. In the keyguard_screen_unlock_portrait.xml, I changed:
android:background="#70000000" to android:background="@drawable/patternlock_background"
Added an image called patternlock_background.png to the drawable-hdpi folder.
Click to expand...
Click to collapse
Pattern Lock Wallpaper Sizing
ICWiener_ said:
Hi,
a few month ago I investigated the size of the background image to fit the pattern dots, and after a few experiments I saw that android was doing a bit of resizing, even if the image was exactly the screen size.
What worked for me, is to make an image smaller than 800 in height (763px to be precise) and 480 in width (regular width of 1 screen). But when done editing, I stretch its height back to 800. Then, when applying within gallery ("use as..."), it stretch it back to undeformed.
I made a template in photoshop, for those who are interested, also with my actual pattern background. Still can't post urls here, so...it's hosted at mediafire.com :
Code:
/?fo04gtvp82y1xw1 (the template)
/?82txu5qxdea6usb (the background)
Click to expand...
Click to collapse
Pattern Lock Dots
I found the pattern lock dots to be too large and dark, covering up most of the wallpaper. I wanted to make the dots smaller and more transparent so that I could see the wallpaper but still see where the dot locations are.
The images for the pattern lock dots are in the framework-res.apk, under res\drawable-hdpi. These are png images so if you just want to change the dots, you do not need to use apktool to decompile framework-res.apk. Just open framework-res.apk with 7zip and replace the images directly.
These are the images you need to edit:
btn_code_lock_default.png -- This is the white dot in the middle
indicator_code_lock_point_area_default.png -- This is the dark circular background of the dot
Here are some replacement png's you can try: http://forum.xda-developers.com/showpost.php?p=17806354&postcount=5
For this one, I reduced both the white middle dot and the outer ring by 50%. Then I increased the transparency of both and made the outer ring a lighter gray.
I am not a Photoshop wiz, so I recommend Paint.NET as a free image editor that is relatively simple to use and works well with transparency.
Some other pattern lock dot images you can change (thanks ICWiener_):
ICWiener_ said:
The pngs that shows up when the pattern is the wrong one :
indicator_code_lock_point_area_red.png (the circle around)
indicator_code_lock_drag_direction_red_up.png (the arrow showing the direction)
And if you use "visible pattern" in the options, these are the green ones :
indicator_code_lock_point_area_green.png
indicator_code_lock_drag_direction_green_up.png
btn_code_lock_touched.png (the small dot in the center, touched version)
Click to expand...
Click to collapse
Pattern Lock Clock font
The clock font on the pattern lock screen is Clockopia.ttf located in /system/fonts. Replacing this file will replace the font. You can also use the Font Changer app, available on XDA or Market: http://forum.xda-developers.com/showthread.php?t=874658 (You'll find Clockopia in the "Advanced" tab of Font Changer.)
However, simply replacing Clockopia with a normal font results in placement issues. This thread on Rootzwiki gives a good description of the Clockopia alignment problem and how to fix it. Basically, use a font editor to replace the glyphs in the Clockopia.ttf with the glyphs from your favorite font.
As an example, here is a Roboto font replacement for Clockopia, where I replaced each of the Clockopia glyphs with the ones from Roboto. This font now aligns perfectly on the pattern lockscreen.
Pattern Lock Path Color [HELP NEEDED]
Big thanks to pendo for figuring out the pattern lock path color (the white semi-transparent line when you drag a pattern, if you have "Visible Pattern" enabled in Settings.) And also to LfcFan1977 for following up on this.
pendo said:
Decompile framework.jar and look in smali/com/android/internal/widget/LockPatternView.smali and look for a line like this
Code:
iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;
const/4 v3, -0x1
The "-0x1" is what you'd want to change. That's white. You should be able to just set any hex value you want.
Click to expand...
Click to collapse
LfcFan1977 said:
I could only get black 0x0 or white -0x1 until I changed it to the following:
Code:
.line 266
iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;
const/4 v3, [COLOR="Red"]0x0[/COLOR]
invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setColor(I)V
.line 267
iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;
const/16 v3, [COLOR="Red"]0x0[/COLOR]
invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setAlpha(I)V
Which gave me full transparency.
Click to expand...
Click to collapse
Sample Pattern Lock Screen
Here is a nice example of a custom pattern lock screen by LfcFan1977.
LfcFan1977 said:
{
"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"
}
Click to expand...
Click to collapse
It would be great to see some wallpapers that incorporate the pattern lock into their design. There could be some pretty cool ideas by mixing a pattern lock wallpaper with custom pattern dots and lines.
Editing the Text / Information on the Pattern Lock Screen
Thanks to byrong for putting together a detailed reference on editing the various text elements on the pattern lock screen: [MOD] Pattern Lock screen - remove/add information Check out his thread for a great graphic on what parts of the XML match up with the various text elements.
To edit the text, decompile framework-res.apk (use apktool or apk_manager), and edit res\layout\keyguard_screen_unlock_portrait.xml.
In my case, I wanted to just add an extra line to the pattern lock screen to give my contact info, in case I lost my phone and somebody wanted to return it to me. So I just added an extra LinearLayout text block underneath the pattern lock dots, with smaller font size for a cleaner look.
Here is my change highlighted in red:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@id/patternlockscreenwallpaper_root" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient android:gravity="center_horizontal" android:orientation="vertical" android:background="@color/transparent" android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textAppearance="?textAppearanceMedium" android:ellipsize="marquee" android:gravity="bottom|right|center" android:id="@id/carrier" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6.0dip" android:layout_marginRight="8.0dip" android:singleLine="true" android:layout_toRightOf="@id/time" android:layout_alignParentTop="true" android:layout_alignParentRight="true" />
<com.android.internal.widget.DigitalClock android:id="@id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20.0dip" android:layout_marginTop="15.0dip" android:layout_alignParentLeft="true" android:layout_alignParentTop="true">
<TextView android:textAppearance="?textAppearanceMedium" android:textSize="56.0sp" android:ellipsize="none" android:gravity="bottom" android:id="@id/timeDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6.0dip" android:singleLine="true" android:shadowColor="#c0000000" android:shadowDx="0.0" android:shadowDy="0.0" android:shadowRadius="3.0" />
<TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:ellipsize="none" android:gravity="bottom" android:id="@id/am_pm" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="4.0dip" android:singleLine="true" android:shadowColor="#c0000000" android:shadowDx="0.0" android:shadowDy="0.0" android:shadowRadius="3.0" />
</com.android.internal.widget.DigitalClock>
<TextView android:textAppearance="?textAppearanceMedium" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="24.0dip" android:layout_below="@id/time" />
</RelativeLayout>
<View android:id="@id/divider" android:background="@drawable/divider_horizontal_dark" android:layout_width="fill_parent" android:layout_height="1.0dip" android:layout_marginTop="8.0dip" android:layout_marginBottom="8.0dip" />
<LinearLayout android:gravity="left" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="12.0dip" android:layout_marginTop="0.0dip">
<TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:id="@id/status1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="4.0dip" />
<TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:id="@id/statusSep" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:layout_marginRight="5.0dip" />
<TextView android:textAppearance="?textAppearanceMedium" android:textSize="18.0sp" android:id="@id/status2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="4.0dip" android:layout_alignParentTop="true" />
</LinearLayout>
<com.android.internal.widget.LockPatternView android:id="@id/lockPattern" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_marginTop="2.0dip" android:layout_weight="1.0" android:aspect="@string/lock_pattern_view_aspect" />
[COLOR="Red"]<LinearLayout android:gravity="center_horizontal" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="0.0dip" android:layout_marginTop="0.0dip">
<TextView android:textAppearance="?textAppearanceMedium" android:textSize="14.0sp" android:text="If found, please contact me at [email protected]" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="4.0dip" />
</LinearLayout>[/COLOR]
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<RelativeLayout android:id="@id/footerNormal" android:layout_width="fill_parent" android:layout_height="fill_parent">
<Button android:id="@id/emergencyCallAlone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/lockscreen_emergency_call" android:drawableLeft="@drawable/ic_emergency" android:drawablePadding="8.0dip" android:layout_centerInParent="true" style="@style/Widget.Button.Transparent" />
</RelativeLayout>
<LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/footerForgotPattern" android:layout_width="fill_parent" android:layout_height="fill_parent">
<Button android:id="@id/emergencyCallTogether" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_marginLeft="4.0dip" android:layout_marginTop="4.0dip" android:layout_marginRight="2.0dip" android:layout_marginBottom="4.0dip" android:text="@string/lockscreen_emergency_call" android:drawableLeft="@drawable/ic_emergency" android:drawablePadding="8.0dip" android:layout_weight="1.0" style="@style/Widget.Button.Transparent" />
<Button android:id="@id/forgotPattern" android:visibility="invisible" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_marginLeft="2.0dip" android:layout_marginTop="4.0dip" android:layout_marginRight="4.0dip" android:layout_marginBottom="4.0dip" android:layout_weight="1.0" style="@style/Widget.Button.Transparent" />
</LinearLayout>
</FrameLayout>
</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
</RelativeLayout>
Again, check out byrong's thread for more details and options.
[Reserved for future use.]
Pattern Lock Path Color [HELP NEEDED]
Here are some files I hope will shed light on what controls the white semi-transparent line that appears when we draw/finger drag a pattern.
See screenshot in [OP].
In the keyguard_screen_unlock_portrait.xml on line 18 is the following code which I assume is linked to the process.
If that is part of the process then I am confused as to why the end of that line does not appear in keyguard_screen_unlock_landscape.xml.
Code:
<com.android.internal.widget.LockPatternView android:id="@id/lockPattern" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_marginTop="2.0dip" android:layout_weight="1.0" android:aspect="@string/lock_pattern_view_aspect" />
I have been looking at the source code LockPatternView here and a third of the way down there is reference to R.styleable.LockPatternView_aspect and all the images used for the lockpattern.
Amongst that is
Code:
mPathPaint.setColor(Color.WHITE); // TODO this should be from the style
but by this time I am completely lost and plucking at straws.
Any help would be very much appreciated.
keyguard_screen_unlock_portrait.xml
keyguard_screen_unlock_landscape.xml
LockPatternView.smali
LinearLayoutWithDefaultTouchRecepient.smali
Good info, thanks for posting this. Looking forward to the color answer. Someone has to have changed this before!
do you think there's any way we would be able to use the Samsung lock screen for the galaxy s2 (I like the messaging and music integration) but with a secondary lock with a pattern for example without a 3rd party app?
Do you not just need to press Menu - Settings - Location & security - Set up screen lock - Pattern.
Sorry if I have completely misunderstood you.
no, I'm looking for a sort of "double lock" without the use of a third party app. I remember my HTC hero back then had this feature where you would unlock the phone then enter the password. I think even iphones have the same feature.
I only need it now because syncing email requires that I have the security lock on the device
[Solved] Transparent drag/draw line
Big thanks to Pendo for pointing me right to the correct spot.
pendo said:
Decompile framework.jar and look in smali/com/android/internal/widget/LockPatternView.smali and look for a line like this
Code:
iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;
const/4 v3, -0x1
The "-0x1" is what you'd want to change. That's white. You should be able to just set any hex value you want.
Click to expand...
Click to collapse
Superb, thanks Pendo.
I could only get black 0x0 or white -0x1 until I changed it to the following:
Code:
.line 266
iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;
const/4 v3, [COLOR="Red"]0x0[/COLOR]
invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setColor(I)V
.line 267
iget-object v2, p0, Lcom/android/internal/widget/LockPatternView;->mPathPaint:Landroid/graphics/Paint;
const/16 v3, [COLOR="Red"]0x0[/COLOR]
invoke-virtual {v2, v3}, Landroid/graphics/Paint;->setAlpha(I)V
Which gave me full transparency.
Need to have a play around with is some more because I could not get different colours to either show or even compile most times.
Again, that you very much for the help.
Got the pattern lock color change to work in a theme for my droid X. Thanks for this!
Helpful guide to changing the text displayed [MOD] Pattern Lock screen - remove/add information
New one
patternlock_background.png - 480x762
btn_code_lock_default.png - Transparent
btn_code_lock_touched.png - Fingerprint
indicator_code_lock_point_area_default.png - Transparent
indicator_code_lock_point_area_green.png - Transparent
indicator_code_lock_point_area_red.png - Transparent
indicator_code_lock_drag_direction_green_up.png - Semi transparent small white blurred dot
indicator_code_lock_drag_direction_red_up.png - Semi transparent small white blurred dot
ic_emergency.png - white
The drag/draw line described in post #9 is transparent.
Anybody know what the emergency call button is named?
On screen it is a semi transparent rectangle. To change its appearance I have added a red retangle to the patternlock_background.png but I would like to edit the actual button to match the other red parts of the screen.
Request from manishdev
I was asked to shared the imaged I used to create my patternlock screens.
It is a bit of a jumbled zip file but it should help recreate what I've done.
It contains two xml files but the are just added as a guide, they are in no way to be used as a straight swap with the ones in your framework-res.
Hope it is of use.
download zip
It's been a while since I visited this thread, but I updated the earlier posts with pendo and LfcFan's updates on the pattern lock path color, and also byrong's reference to the pattern lock text. Thanks to everybody for their great work and contributions!
I have been looking forever for this info...THANKS!!
Question though...When I open keyguard_screen_unlock_portrait.xml, no matter whether I use Notepad++, UltraEdit, and Dreamweaver, they all open with partial text and mostly jumbled code/images..etc.
Also, line 4 does have a little text, but it's not related. The closest text I can find to "android:background=..." is line 16 but it has the above jumbled code and an http address.
I'm on Skyrocket i727 4.0.3..
Am I just not opening/viewing the xml correctly?
I changed it to txt and uploaded in case anyone can take a look..
@BRIMS7ON3
You need to decompile framework-res to be able to edit an xml file.
Search for decompile or apktool. It takes a bit of work to set it all up but well worth the effort.
LfcFan1977 said:
You need to decompile framework-res to be able to edit an xml file.
Search for decompile or apktool. It takes a bit of work to set it all up but well worth the effort.
Click to expand...
Click to collapse
I opened it in 7-zip, then extracted the xml. I take it neither doing that nor unzipping it get the same results?
Sent from my SAMSUNG-SGH-I727 using xda premium
@BRIMS7ON3
BRIMS7ON3 said:
I opened it in 7-zip, then extracted the xml. I take it neither doing that nor unzipping it get the same results?
Sent from my SAMSUNG-SGH-I727 using xda premium
Click to expand...
Click to collapse
No, unzipping/extracting is ok for .png edits but for .9.png images, xml files and smali files, the only option is to decompile.
well aint that cute
thank you
p.s. do you maybe know how to change the pattern lock path size ? To make it thinner.
All I know is that will be in smali/com/android/internal/widget/LockPatternView.smali
Hi guys, i have two questions
- how do you decompile framework.jar ? I have tried by opening it with winrar but i have found only a preloaded-classes file and a meta-inf directory with a manifest.mf file. Nothing about the path you describe to change the color of the line you drag when unlock the screen
- how do you modify the png with the green and red circles ? With adobe photoshop i have to change the settings to rgb color but after that i obtain a very ugly image with black background.
Thanks for the help

[Q] Android Studio Layout

Hi,
I am new to Android App Development and am having a bit of bother getting my screen layout the way I want it. I will do my best to explain the problem. I am doing a small app just to get used to Android Studio. I am following a tutorial to go through most of the features. I have inserted a TextView on the the screen firstly, in a root LinearLayout. I have then created an embedded LinearLayout with a button and an image. I will post the code below for this. In the tutorial it shows the TextView at the top of the screen and the Button and Image directly below it. My problem is that I can't move my Button and image(embedded LinearLayout) directly below. It has to be at the right hand side of the TextView.
The only way I can think on explaining a solution would be in Microsoft Word, no Text Wrapping allows you to drag the image anywhere on the page. Is there an option for something similar in Android Studio or am I missing something I should know? Any help would be appreciated. If I haven't explained in enough detail please let me know and I will do my best to correct.
This is the tutorial page(as a new member I can't post url):
www(dot)raywenderlich(dot)com/78576/android-tutorial-for-beginners-part-2
This is my code:
<LinearLayout (Cant post xml version url)
android:layout_width="wrap_content"
android:layout_height="500dp"
tools:context=".MainActivity"
androidrientation="horizontal"
android:id="@+id/">
<TextView android:id="@+id/main_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="@string/textview" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
androidrientation="horizontal"
android:id="@+id/">
<Button
android:id="@+id/main_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:text="@string/button" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:src="@mipmap/ic_launcher"/>
</LinearLayout>
<!-- Displays keyboard when touched -->
<EditText
android:id="@+id/main_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_gravity="center_vertical"
android:hint="@string/hint" />
<!-- Set OnClickListener to trigger results when pressed -->
</LinearLayout>

value of a TextvVieuw doesn't change

(i removed all standart links to 3 cuz i arent allowed to post links)
Activity:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="3"
xmlns:tools="3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
androidrientation="vertical"
androidaddingBottom="@dimen/activity_vertical_margin"
androidaddingLeft="@dimen/activity_horizontal_margin"
androidaddingRight="@dimen/activity_horizontal_margin"
androidaddingTop="@dimen/activity_vertical_margin"
tools:context="plopmenzinc.nsapp.Start"
android:saveEnabled="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Uw aantal punten:"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="50dp"
android:singleLine="true"
android:textColor="#FF2646B0"
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/disp"
android:id="@+id/score"
android:layout_alignBottom="@+id/textView"
android:layout_toRightOf="@+id/textView"
android:layout_toEndOf="@+id/textView"
android:textSize="22sp" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Add Points"
androidnClick="onClickBtn"
android:layout_marginBottom="73dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
Start.java:
package plopmenzinc.nsapp;
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class Start extends AppCompatActivity {
@override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
}
public void onClickBtn(View v)
{
int number = 1;
String disp = Integer.toString(number);
}
}
My problem is that the TextVieuw doesn't change if i change the string it is referred to, i even tried changing it before the app activity has start launching, but it keeps only being the original start value. Anyone know how to fix this?
I don't see where you are "finding" your text view,
example:
TextView var = (TextView) findViewById(R.id.score);
And then set the value:
var.setText("My new text");

ListView ArrayAdapter doesn't display list items in Navigation Drawer Activity

I have some problems with the list items of a ListView. I've implemented a Navigation Drawer Activity and want to display a simple ListView with some list items. I haven't changed the implementation of the navigation bar yet, just tried to display an activity I've already implemented. So in the automatically generated app_bar_start.xml I just replaced in the <include layout="@layout/activity_main_list" /> section the example activity by my own activity. So far so good, but I figured out that the list items, I want to add by an ArrayAdapter, doesn't appear in the app.
On the other hand, when I implement an string-array in strings.xml and include this items via android:entries in the xml file of my activity, it works fine.
Also when I display my activity directly, so without the Navigation Drawer Activity, everything works fine too.
So does anybody have an idea why it just don't work included in the Navigation Drawer Acitivity?
MainList.java (this is my own written activity):
Code:
public class MainList extends AppCompatActivity {
private ListView mListView;
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_list);
mListView = (ListView) findViewById(R.id.mainlist);
List<String> list = new ArrayList<String>();
list.add("Dies ist ein Test");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
mListView.setAdapter(adapter);
}
}
activity_main_list.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="..."
xmlns:app="..."
xmlns:tools="..."
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_start"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">
<ListView
android:id="@+id/mainlist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_green_dark"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
</android.support.constraint.ConstraintLayout>
StartActivity.java:
Code:
public class StartActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
}
activity_start.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="..."
xmlns:app="..."
xmlns:tools="..."
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_start"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_start"
app:menu="@menu/activity_start_drawer" />
</android.support.v4.widget.DrawerLayout>
app_bar_start.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="..."
xmlns:app="..."
xmlns:tools="..."
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="martinfactory.archibook.StartActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/activity_main_list" />
</android.support.design.widget.CoordinatorLayout>
Problem solved
Okay I've solved the problem, or actually kind of avoided it. I had to change the structure of my files because I have to implement some fragments and after that all the list items are displayed.

Categories

Resources