Search in sources :

Example 1 with ClassNotFoundError

use of de.robv.android.xposed.XposedHelpers.ClassNotFoundError in project Xposed-Tinted-Status-Bar by MohammadAG.

the class LGHooks method doImeHook.

public static void doImeHook() {
    if (!isLGKitKatDevice())
        return;
    try {
        Class<?> inputMethodMgrClss = findClass("com.android.server.InputMethodManagerService", null);
        findAndHookMethod(inputMethodMgrClss, "setImeWindowStatus", IBinder.class, int.class, int.class, new XC_MethodHook() {

            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                int vis = (Integer) param.args[1];
                Context mContext = (Context) getObjectField(param.thisObject, "mContext");
                boolean isKeyboardUp = (vis & IME_ACTIVE) != 0;
                if (isKeyboardUp != mWasKeyboardUp && mContext != null) {
                    Intent intent = new Intent(Common.INTENT_KEYBOARD_VISIBLITY_CHANGED);
                    intent.putExtra(Common.EXTRA_KEY_KEYBOARD_UP, isKeyboardUp);
                    mContext.sendBroadcast(intent);
                    mWasKeyboardUp = isKeyboardUp;
                }
            }
        });
    } catch (ClassNotFoundError e) {
    //DO NOTHING
    }
}
Also used : Context(android.content.Context) ClassNotFoundError(de.robv.android.xposed.XposedHelpers.ClassNotFoundError) XC_MethodHook(de.robv.android.xposed.XC_MethodHook) Intent(android.content.Intent)

Example 2 with ClassNotFoundError

use of de.robv.android.xposed.XposedHelpers.ClassNotFoundError in project Xposed-Tinted-Status-Bar by MohammadAG.

the class LGHooks method hookStatusBar.

private static void hookStatusBar(ClassLoader classLoader) {
    // REMOVE THE BACKGROUND ONLY
    try {
        Class<?> StatusBarBackGroundClss = findClass("com.lge.systemui.StatusBarBackground", classLoader);
        findAndHookMethod(StatusBarBackGroundClss, "applyMode", int.class, boolean.class, new XC_MethodHook() {

            @SuppressLint("NewApi")
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                int i = (Integer) param.args[0];
                if (i != 1 && i != 2) {
                    XposedHelpers.setIntField(param.thisObject, "mMode", i);
                    ImageView imageView = (ImageView) param.thisObject;
                    imageView.setBackground(null);
                    imageView.setVisibility(View.VISIBLE);
                    param.setResult(null);
                }
            }
        });
    } catch (ClassNotFoundError e) {
        XposedBridge.log("TintedStatusBar: LG StatusBarBackground has not been found...skipping");
    }
}
Also used : ClassNotFoundError(de.robv.android.xposed.XposedHelpers.ClassNotFoundError) XC_MethodHook(de.robv.android.xposed.XC_MethodHook) SuppressLint(android.annotation.SuppressLint) ImageView(android.widget.ImageView)

Example 3 with ClassNotFoundError

use of de.robv.android.xposed.XposedHelpers.ClassNotFoundError in project Xposed-Tinted-Status-Bar by MohammadAG.

the class SamsungHook method doHook.

public static void doHook(ColourChangerMod instance, ClassLoader loader) {
    if (!android.os.Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("samsung"))
        return;
    Class<?> PhoneStatusBar = null;
    try {
        PhoneStatusBar = findClass("com.android.systemui.statusbar.phone.PhoneStatusBar", loader);
    } catch (ClassNotFoundError e) {
    // Bigger problems to worry about if this isn't found.
    }
    try {
        if (PhoneStatusBar != null) {
            Method m = XposedHelpers.findMethodExact(PhoneStatusBar, "transparentizeStatusBar", int.class);
            XposedBridge.hookMethod(m, new SamsungHook(instance));
        }
    } catch (NoSuchMethodError e) {
    // Not an S4
    }
}
Also used : ClassNotFoundError(de.robv.android.xposed.XposedHelpers.ClassNotFoundError) Method(java.lang.reflect.Method)

Aggregations

ClassNotFoundError (de.robv.android.xposed.XposedHelpers.ClassNotFoundError)3 XC_MethodHook (de.robv.android.xposed.XC_MethodHook)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 Intent (android.content.Intent)1 ImageView (android.widget.ImageView)1 Method (java.lang.reflect.Method)1