11package com .omarea .xposed ;
22
3+ import android .app .Activity ;
34import android .content .Context ;
45import android .content .res .Configuration ;
56import android .content .res .Resources ;
7+ import android .os .IBinder ;
8+ import android .util .DisplayMetrics ;
69import android .view .View ;
710import android .view .ViewConfiguration ;
11+ import android .view .Window ;
12+ import android .view .WindowManager ;
13+ import android .widget .ListView ;
14+ import android .widget .Toast ;
15+
16+ import androidx .recyclerview .widget .LinearLayoutManager ;
17+ import androidx .recyclerview .widget .LinearSmoothScroller ;
18+ import androidx .recyclerview .widget .RecyclerView ;
19+
20+ import com .omarea .library .calculator .Flags ;
821
922import de .robv .android .xposed .XC_MethodHook ;
1023import de .robv .android .xposed .XposedBridge ;
24+ import de .robv .android .xposed .XposedHelpers ;
1125import de .robv .android .xposed .callbacks .XC_LoadPackage ;
1226
27+ import static de .robv .android .xposed .XposedHelpers .callMethod ;
28+ import static de .robv .android .xposed .XposedHelpers .setObjectField ;
29+
1330/**
1431 * Created by Hello on 2018/03/02.
1532 */
@@ -18,8 +35,8 @@ public class ViewConfig {
1835 static final float MULTIPLIER_SCROLL_FRICTION = 10000f ;
1936 static float mDensity = -1 ;
2037
21- private static void hookViewConfiguration (final Class <?> clazz ) {
22- XposedBridge .hookAllConstructors (clazz , new XC_MethodHook () {
38+ private void hookViewConfiguration () {
39+ XposedBridge .hookAllConstructors (ViewConfiguration . class , new XC_MethodHook () {
2340 @ Override
2441 protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
2542 if (param .args == null ) return ;
@@ -37,22 +54,22 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
3754 });
3855 }
3956
40- private static void hookMaxFlingVelocity (final Class <?> clazz ) {
41- XposedBridge .hookAllMethods (clazz , "getMaximumFlingVelocity" , new XC_MethodHook () {
57+ private void hookMaxFlingVelocity () {
58+ XposedBridge .hookAllMethods (ViewConfiguration . class , "getMaximumFlingVelocity" , new XC_MethodHook () {
4259 @ Override
4360 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
4461 if (!isEnabled ()) return ;
4562 param .setResult (Common .DEFAULT_SCROLLING_VELOCITY );
4663 }
4764 });
4865
49- XposedBridge .hookAllMethods (clazz , "getScaledMinimumFlingVelocity" , new XC_MethodHook () {
66+ XposedBridge .hookAllMethods (ViewConfiguration . class , "getScaledMinimumFlingVelocity" , new XC_MethodHook () {
5067 @ Override
5168 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
5269 param .setResult (5 );
5370 }
5471 });
55- XposedBridge .hookAllMethods (clazz , "getScaledMaximumFlingVelocity" , new XC_MethodHook () {
72+ XposedBridge .hookAllMethods (ViewConfiguration . class , "getScaledMaximumFlingVelocity" , new XC_MethodHook () {
5673 @ Override
5774 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
5875 if (!isEnabled ()) return ;
@@ -67,8 +84,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
6784 });
6885 }
6986
70- private static void hookScrollFriction (final Class <?> clazz ) {
71- XposedBridge .hookAllMethods (clazz , "getScrollFriction" , new XC_MethodHook () {
87+ private void hookScrollFriction () {
88+ XposedBridge .hookAllMethods (ViewConfiguration . class , "getScrollFriction" , new XC_MethodHook () {
7289 @ Override
7390 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
7491 if (!isEnabled ()) return ;
@@ -79,8 +96,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
7996 });
8097 }
8198
82- private static void hookOverscrollDistance (final Class <?> clazz ) {
83- XposedBridge .hookAllMethods (clazz , "getScaledOverscrollDistance" , new XC_MethodHook () {
99+ private void hookOverscrollDistance () {
100+ XposedBridge .hookAllMethods (ViewConfiguration . class , "getScaledOverscrollDistance" , new XC_MethodHook () {
84101 @ Override
85102 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
86103 if (!isEnabled ()) return ;
@@ -95,8 +112,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
95112 });
96113 }
97114
98- private static void hookOverflingDistance (final Class <?> clazz ) {
99- XposedBridge .hookAllMethods (clazz , "getScaledOverflingDistance" , new XC_MethodHook () {
115+ private void hookOverflingDistance () {
116+ XposedBridge .hookAllMethods (ViewConfiguration . class , "getScaledOverflingDistance" , new XC_MethodHook () {
100117 @ Override
101118 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
102119 if (!isEnabled ()) return ;
@@ -111,46 +128,48 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
111128 });
112129 }
113130
114- private static void hookLongPressTimeout (final Class <?> clazz ) {
115- XposedBridge .hookAllMethods (View .class , "getLongPressTimeout" , new XC_MethodHook () {
131+ private void hookLongPressTimeout () {
132+ XposedBridge .hookAllMethods (ViewConfiguration .class , "getLongPressTimeout" , new XC_MethodHook () {
116133 @ Override
117134 protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
118135 param .setResult (200 );
119136 }
120137 });
121138 }
122139
123- private static void hookTapTimeout (final Class <?> clazz ) {
124- XposedBridge .hookAllMethods (View .class , "getTapTimeout" , new XC_MethodHook () {
140+ private void hookTapTimeout () {
141+ XposedBridge .hookAllMethods (ViewConfiguration .class , "getTapTimeout" , new XC_MethodHook () {
125142 @ Override
126143 protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
127144 param .setResult (100 );
128145 }
129146 });
130147 }
131148
132- private static void hookScaledTouchSlop (final Class <?> clazz ) {
133- XposedBridge .hookAllMethods (View .class , "getScaledTouchSlop" , new XC_MethodHook () {
149+ private void hookScaledTouchSlop () {
150+ XposedBridge .hookAllMethods (ViewConfiguration .class , "getScaledTouchSlop" , new XC_MethodHook () {
134151 @ Override
135152 protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
136153 param .setResult (4 );
137154 }
138155 });
139156 }
140157
141- private static boolean isEnabled () {
158+ private boolean isEnabled () {
142159 return Common .DEFAULT_SCROLLING_ENABLE ;
143160 }
144161
145162 public void handleLoadPackage (final XC_LoadPackage .LoadPackageParam loadPackageParam ) {
146- hookViewConfiguration (ViewConfiguration .class );
147- hookOverscrollDistance (ViewConfiguration .class );
148- hookOverflingDistance (ViewConfiguration .class );
149- hookMaxFlingVelocity (ViewConfiguration .class );
150- hookScrollFriction (ViewConfiguration .class );
151- hookLongPressTimeout (ViewConfiguration .class );
152- hookTapTimeout (ViewConfiguration .class );
153- hookScaledTouchSlop (ViewConfiguration .class );
163+ hookViewConfiguration ();
164+ hookOverscrollDistance ();
165+ hookOverflingDistance ();
166+ hookMaxFlingVelocity ();
167+ hookScrollFriction ();
168+ hookLongPressTimeout ();
169+ hookTapTimeout ();
170+ hookScaledTouchSlop ();
171+ // hookRecyclerViewScroll2();
172+ // hookRecyclerViewScroll();
154173
155174 /*
156175 XposedBridge.hookAllMethods(ViewConfiguration.class, "getScaledMaximumDrawingCacheSize",
0 commit comments