Friday, May 27, 2016

Hook long press notification

How can you guys capture long press notification?

I found this method on SystemUI:

Code:
Code:

protected SwipeHelper.LongPressListener getNotificatioLongnClicker() {
        return new SwipeHelper.LongPressListener() {
 @override
            public boolean onLongPress(View v, int x, int y) {...

But I can't do afterHookedMethod or beforeHookedMethod.

Code:
Code:

public class Tutorial implements IXposedHookLoadPackage {
    public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
        XposedBridge.log("Loaded app: " + lpparam.packageName);
        if (!lpparam.packageName.equals("com.android.systemui"))
            return;
            findAndHookMethod("com.android.systemui.statusbar.BaseStatusBar", lpparam.classLoader, "getNotificationLongClicker", new XC_MethodHook() {
 @override
            protected void afterHookedMethod (MethodHookParam param) throws Throwable {
                // this will be called before the clock was updated by the original method
                return new View.OnLongClickListener() {
 @override
                    public boolean onLongClick(final View v) {
                        XposedBridge.log("long press notification action");
                        return true;
                    }
                }
            });
        }
    }
}

How I can call the method from another class "SwipeHelper" and access "LongPressListener" public interface and "onLongPress" method which return boolean value?

I tried with object and method "View.OnLongClickListener" without success. Anyway, if I can't do it there is another way because I see system long press notification working on xNotification module.

PS.: I'm noobie: http://ift.tt/1UhMjI6

@pixeltech.dev


from xda-developers http://ift.tt/1UhLFuq
via IFTTT

No comments:

Post a Comment