@@ -28,61 +28,62 @@ public Stickers(@NonNull ClassLoader classLoader, @NonNull XSharedPreferences pr
2828 @ Override
2929 public void doHook () throws Throwable {
3030 if (!prefs .getBoolean ("alertsticker" , false )) return ;
31- var sendStickerMethod = Unobfuscator .loadSendStickerMethod (classLoader );
32- XposedBridge .hookMethod (sendStickerMethod , new XC_MethodHook () {
33- private Unhook unhooked ;
31+ var sendStickerMethods = Unobfuscator .loadSendStickerMethods (classLoader );
32+ for (var method : sendStickerMethods ) {
33+ XposedBridge .hookMethod (method , new XC_MethodHook () {
34+ private Unhook unhooked ;
3435
35- @ Override
36- protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
37- unhooked = XposedHelpers .findAndHookMethod (View .class , "setOnClickListener" , View .OnClickListener .class , new XC_MethodHook () {
38- @ Override
39- protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
40- View .OnClickListener mCaptureOnClickListener = (View .OnClickListener ) param .args [0 ];
41- if (mCaptureOnClickListener == null ) return ;
42- if (!(param .thisObject instanceof ViewGroup )) return ;
43- var view = (View ) param .thisObject ;
44- if (view .findViewById (Utils .getID ("sticker" , "id" )) == null ) return ;
36+ @ Override
37+ protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
38+ unhooked = XposedHelpers .findAndHookMethod (View .class , "setOnClickListener" , View .OnClickListener .class , new XC_MethodHook () {
39+ @ Override
40+ protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
41+ View .OnClickListener mCaptureOnClickListener = (View .OnClickListener ) param .args [0 ];
42+ if (mCaptureOnClickListener == null ) return ;
43+ if (!(param .thisObject instanceof ViewGroup )) return ;
44+ var view = (View ) param .thisObject ;
45+ if (view .findViewById (Utils .getID ("sticker" , "id" )) == null ) return ;
4546
46- param .args [0 ] = (View .OnClickListener ) v -> {
47- var context = view .getContext ();
48- var dialog = new AlertDialogWpp (view .getContext ());
49- dialog .setTitle (context .getString (ResId .string .send_sticker ));
47+ param .args [0 ] = (View .OnClickListener ) v -> {
48+ var context = view .getContext ();
49+ var dialog = new AlertDialogWpp (view .getContext ());
50+ dialog .setTitle (context .getString (ResId .string .send_sticker ));
5051
51- var stickerView = (ImageView ) view .findViewById (Utils .getID ("sticker" , "id" ));
52- LinearLayout linearLayout = new LinearLayout (context );
53- linearLayout .setOrientation (LinearLayout .VERTICAL );
54- linearLayout .setGravity (Gravity .CENTER_HORIZONTAL );
55- var padding = Utils .dipToPixels (16 );
56- linearLayout .setPadding (padding , padding , padding , padding );
57- var image = new ImageView (context );
58- var size = Utils .dipToPixels (72 );
59- var params = new LinearLayout .LayoutParams (size , size );
60- params .bottomMargin = padding ;
61- image .setLayoutParams (params );
62- image .setImageDrawable (stickerView .getDrawable ());
63- linearLayout .addView (image );
52+ var stickerView = (ImageView ) view .findViewById (Utils .getID ("sticker" , "id" ));
53+ LinearLayout linearLayout = new LinearLayout (context );
54+ linearLayout .setOrientation (LinearLayout .VERTICAL );
55+ linearLayout .setGravity (Gravity .CENTER_HORIZONTAL );
56+ var padding = Utils .dipToPixels (16 );
57+ linearLayout .setPadding (padding , padding , padding , padding );
58+ var image = new ImageView (context );
59+ var size = Utils .dipToPixels (72 );
60+ var params = new LinearLayout .LayoutParams (size , size );
61+ params .bottomMargin = padding ;
62+ image .setLayoutParams (params );
63+ image .setImageDrawable (stickerView .getDrawable ());
64+ linearLayout .addView (image );
6465
65- TextView text = new TextView (context );
66- text .setText (context .getString (ResId .string .do_you_want_to_send_sticker ));
67- text .setTextAlignment (View .TEXT_ALIGNMENT_CENTER );
68- linearLayout .addView (text );
66+ TextView text = new TextView (context );
67+ text .setText (context .getString (ResId .string .do_you_want_to_send_sticker ));
68+ text .setTextAlignment (View .TEXT_ALIGNMENT_CENTER );
69+ linearLayout .addView (text );
6970
7071
71- dialog .setView (linearLayout );
72- dialog .setPositiveButton (context .getString (ResId .string .send ), (dialog1 , which ) -> mCaptureOnClickListener .onClick (view ));
73- dialog .setNegativeButton (context .getString (ResId .string .cancel ), null );
74- dialog .show ();
75- };
76- }
77- });
78- }
72+ dialog .setView (linearLayout );
73+ dialog .setPositiveButton (context .getString (ResId .string .send ), (dialog1 , which ) -> mCaptureOnClickListener .onClick (view ));
74+ dialog .setNegativeButton (context .getString (ResId .string .cancel ), null );
75+ dialog .show ();
76+ };
77+ }
78+ });
79+ }
7980
80- @ Override
81- protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
82- unhooked .unhook ();
83- }
84-
85- });
81+ @ Override
82+ protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
83+ unhooked .unhook ();
84+ }
85+ });
86+ }
8687 }
8788
8889 @ NonNull
0 commit comments