You have to use it every time you access shared preferencesThanks can you tell me where I use that word i already use that word in my fragment class.
Sent from my amazingly awesome OnePlus One using Tapatalk
You have to use it every time you access shared preferencesThanks can you tell me where I use that word i already use that word in my fragment class.
Shared preference or xsharedpreference?You have to use it every time you access shared preferences
Sent from my amazingly awesome OnePlus One using Tapatalk
shares preferences
protected void onVolumeChanged(int streamType, int flags)
XposedHelpers.findAndHookMethod(classVolumePanel, "onVolumeChanged", Integer.class, Integer.class, new MethodHook());
Either rewrtite the method in your Xposed module and replace the whole original methodI'm a bit confused on how all this works. All the subject in the tutorials, I've picked up fairly easily. But what about when I just want to tweak portions of a method? i.e.,
public void methodToChange() {
String original = "text";
do.someStuff(original);
do.someOtherStuff();
}
How can I access do to use do.someOtherStuff() if do isn't defined within my personal code? It seems a bit excessive to import all that code into my project. Do I build my project using the source of the apk I'm modifying as a library?
You'd have to get the source code using APK tool or similar then find the appropriate method and hook itCan you please guide me how to create xposed module for Facebook app(make most recent story as default)!!??
You'd have to get the source code using APK tool or similar then find the appropriate method and hook it
Sent from my amazingly awesome OnePlus One using Tapatalk
public class Appname implements IXposedHookInitPackageResources {
RelativeLayout mainBack;
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.appname.android"))
return;
resparam.res.hookLayout("com.appname.android", "layout", "stories", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
mainBack = (RelativeLayout) liparam.view.findViewById(liparam.res.getIdentifier("top_panel", "id", "com.appname.android"));
mainBack.setBackgroundColor(Color.BLACK);
}
});
}
}
<RelativeLayout android:background="[COLOR="red"]@android:color/white[/COLOR]" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/[COLOR="red"]top_panel[/COLOR]">
<View android:id="@id/stories_divider" android:background="@color/divider_grey" android:layout_width="fill_parent" android:layout_height="1.0dip" />
<com.appname.android.ui.ptr.AppnamePtrFrameLayout android:id="@id/[COLOR="Blue"]stories_ptrframe[/COLOR]" android:background="[COLOR="blue"]@android:color/white[/COLOR]" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/stories_divider">
<RelativeLayout android:background="#ffffffff" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
E/Xposed﹕ java.lang.ClassCastException: com.android.systemui.statusbar.policy.Clock cannot be cast to android.widget.TextView
Ive been following the tutorial, but I just cant seem to get it to work.
Im trying to get the Smiley Clock to work but I get this error in xposed log:
I am not sure why I get a casting error since the clock class extends TextView.
Also I am using Lollipop, can that be a possible cause?
It works the same way its just that specific exmaple is for KitKat and below
Could you point us in the right direction to learn xposed for lolipop 5.1 or 5.0?It works the same way its just that specific exmaple is for KitKat and below
Sent from my amazingly awesome OnePlus One using Tapatalk
Not too surePlease, advice how to use findandhookmethod for method with array in parameters list:
private void method(byte[] paramArrayOfByte, int paramInt) ?
findAndHookMethod(CLASS_NAME, lpparam.classLoader, "method", ?, Integer.class, new XC_MethodHook () { ...
<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" />
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 {
}
}
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
findAndHookMethod("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, "updateClock", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});
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;
TextView tv = (TextView) param.thisObject;
tv.setText(":)");
tv.appendText(":)");
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(":)");
}
});
}
}
XResources.setSystemWideReplacement("android", "bool", "config_unplugTurnsOnScreen", false);
String MODULE_PATH = startupParam.modulePath;
if (!resparam.packageName.equals("android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
36dp
XResources.setSystemWideReplacement("android", "dimen", "navigation_bar_height", modRes.fwd(R.dimen.navigationbarSize));
public void apply(){
EditText et = (EditText) findViewById(R.id.input);
String input = et.getText().toString();
}
SharedPreferences pref = getSharedPreferences("user_settings", MODE_WORLD_READABLE);
Editor editor = pref.edit();
editor.putString("user_text", input);
tv.setText(":)");
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
resparam.res.hookLayout("com.android.systemui", "layout", "navigation_bar", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
}
});
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
View navbar = (View) liparam.view.findViewById(
liparam.res.getIdentifier("nav_buttons", "id", "com.android.systemui"));
}
<?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>
navbar.setBackgroundColor(Color.BLUE);
findAndHookMethod("com.android.settings.Settings", lpparam.classLoader, "onCreate", new XC_MethodHook() {
});
findAndHookMethod("com.android.settings.Settings", lpparam.classLoader, "onCreate", [B]Bundle.class[/B], new XC_MethodHook() {
});
findAndHookMethod("com.android.settings.Settings", lpparam.classLoader, "onCreate", [B]"android.os.Bundle"[/B], new XC_MethodHook() {
});
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