|
4 | 4 | import android.app.Activity; |
5 | 5 | import android.content.Intent; |
6 | 6 | import android.os.Bundle; |
7 | | -import android.text.TextUtils; |
8 | | -import android.view.Gravity; |
9 | 7 | import android.view.View; |
10 | 8 | import android.view.ViewGroup; |
11 | | -import android.view.ViewStub; |
12 | | -import android.widget.LinearLayout; |
13 | 9 | import android.widget.TextView; |
14 | 10 |
|
15 | 11 | import androidx.annotation.NonNull; |
|
18 | 14 | import com.wmods.wppenhacer.xposed.core.Feature; |
19 | 15 | import com.wmods.wppenhacer.xposed.core.WppCore; |
20 | 16 | import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator; |
21 | | -import com.wmods.wppenhacer.xposed.utils.DesignUtils; |
| 17 | +import com.wmods.wppenhacer.xposed.features.general.Others; |
22 | 18 | import com.wmods.wppenhacer.xposed.utils.ReflectionUtils; |
23 | 19 | import com.wmods.wppenhacer.xposed.utils.ResId; |
24 | 20 | import com.wmods.wppenhacer.xposed.utils.Utils; |
@@ -50,6 +46,8 @@ public void doHook() throws Exception { |
50 | 46 | var typeArchive = prefs.getString("typearchive", "0"); |
51 | 47 | var methodHook = new MethodHook(showName, showBio, typeArchive); |
52 | 48 | XposedHelpers.findAndHookMethod("com.whatsapp.HomeActivity", classLoader, "onCreate", Bundle.class, methodHook); |
| 49 | + Others.propsBoolean.put(6481, false); |
| 50 | + Others.propsBoolean.put(5353, true); |
53 | 51 | expirationAboutInfo(); |
54 | 52 | } |
55 | 53 |
|
@@ -133,84 +131,38 @@ public void onMultiClick(View v) { |
133 | 131 | } |
134 | 132 |
|
135 | 133 | if (!showBio && !showName) return; |
136 | | - var parent = (ViewGroup) logo.getParent(); |
137 | 134 |
|
138 | | - if (!(parent instanceof LinearLayout) && logo.getVisibility() == View.VISIBLE) { |
139 | | - var methods = Arrays.stream(actionbar.getClass().getDeclaredMethods()).filter(m -> m.getParameterCount() == 1 && m.getParameterTypes()[0] == CharSequence.class).toArray(Method[]::new); |
| 135 | + var methods = Arrays.stream(actionbar.getClass().getDeclaredMethods()).filter(m -> m.getParameterCount() == 1 && m.getParameterTypes()[0] == CharSequence.class).toArray(Method[]::new); |
140 | 136 |
|
141 | | - if (showName) { |
142 | | - methods[1].invoke(actionbar, name); |
143 | | - } |
| 137 | + if (showName) { |
| 138 | + methods[1].invoke(actionbar, name); |
| 139 | + } |
144 | 140 |
|
145 | | - if (showBio) { |
146 | | - methods[0].invoke(actionbar, bio); |
147 | | - } |
| 141 | + if (showBio) { |
| 142 | + methods[0].invoke(actionbar, bio); |
| 143 | + } |
148 | 144 |
|
149 | | - XposedBridge.hookMethod(methods[1], new XC_MethodHook() { |
150 | | - @Override |
151 | | - protected void beforeHookedMethod(MethodHookParam param) throws Throwable { |
152 | | - var name = WppCore.getMyName(); |
153 | | - var bio = WppCore.getMyBio(); |
154 | | - if (showBio && (param.args[0] == "" || param.args[0] == "WhatsApp")) { |
155 | | - ReflectionUtils.callMethod(methods[0], param.thisObject, bio); |
156 | | - } else { |
157 | | - ReflectionUtils.callMethod(methods[0], param.thisObject, ""); |
158 | | - } |
159 | | - if (showName && (param.args[0] == "" || param.args[0] == "WhatsApp")) { |
160 | | - param.args[0] = name; |
161 | | - } |
162 | | - if (logo instanceof ViewStub stub) { |
163 | | - var layoutParams = stub.getLayoutParams(); |
164 | | - layoutParams.width = 1; |
165 | | - layoutParams.height = 200; |
166 | | - stub.setLayoutParams(layoutParams); |
167 | | - } |
| 145 | + XposedBridge.hookMethod(methods[1], new XC_MethodHook() { |
| 146 | + @Override |
| 147 | + protected void beforeHookedMethod(MethodHookParam param) throws Throwable { |
| 148 | + var name = WppCore.getMyName(); |
| 149 | + var bio = WppCore.getMyBio(); |
| 150 | + if (showBio && (param.args[0] == "" || param.args[0] == "WhatsApp")) { |
| 151 | + ReflectionUtils.callMethod(methods[0], param.thisObject, bio); |
| 152 | + } else { |
| 153 | + ReflectionUtils.callMethod(methods[0], param.thisObject, ""); |
| 154 | + } |
| 155 | + if (showName && (param.args[0] == "" || param.args[0] == "WhatsApp")) { |
| 156 | + param.args[0] = name; |
168 | 157 | } |
169 | | - }); |
170 | 158 |
|
171 | | - return; |
172 | | - } |
173 | | - LinearLayout layout; |
174 | | - if (parent instanceof LinearLayout) { |
175 | | - layout = (LinearLayout) parent; |
176 | | - } else { |
177 | | - layout = new LinearLayout(homeActivity); |
178 | | - layout.setOrientation(LinearLayout.VERTICAL); |
179 | | - toolbar.removeAllViews(); |
180 | | - parent.addView(layout, 0); |
181 | | - var clazzWDS = XposedHelpers.findClass("com.whatsapp.wds.components.topbar.WDSToolbar", homeActivity.getClassLoader()); |
182 | | - if (clazzWDS.isInstance(toolbar)) { |
183 | | - XposedHelpers.callMethod(toolbar, "setTitle", (CharSequence) null); |
184 | | - XposedHelpers.findAndHookMethod(clazzWDS, "setTitle", CharSequence.class, new XC_MethodHook() { |
185 | | - @Override |
186 | | - protected void beforeHookedMethod(MethodHookParam param) throws Throwable { |
187 | | - if (param.thisObject != toolbar) return; |
188 | | - param.setResult(null); |
189 | | - } |
190 | | - }); |
| 159 | + var layoutParams = logo.getLayoutParams(); |
| 160 | + layoutParams.width = 1; |
| 161 | + layoutParams.height = 1; |
| 162 | + logo.setLayoutParams(layoutParams); |
| 163 | + |
191 | 164 | } |
192 | | - } |
193 | | - var mTitle = new TextView(homeActivity); |
194 | | - mTitle.setText(showName ? name : "WhatsApp"); |
195 | | - mTitle.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f)); |
196 | | - mTitle.setTextSize(18f); |
197 | | - mTitle.setTextColor(DesignUtils.getPrimaryTextColor()); |
198 | | - layout.addView(mTitle); |
199 | | - if (showBio) { |
200 | | - TextView mSubtitle = new TextView(homeActivity); |
201 | | - mSubtitle.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT)); |
202 | | - mSubtitle.setText(bio); |
203 | | - mSubtitle.setTextSize(12f); |
204 | | - mSubtitle.setTextColor(DesignUtils.getPrimaryTextColor()); |
205 | | - mSubtitle.setMarqueeRepeatLimit(-1); |
206 | | - mSubtitle.setEllipsize(TextUtils.TruncateAt.MARQUEE); |
207 | | - mSubtitle.setSingleLine(); |
208 | | - mSubtitle.setSelected(true); |
209 | | - layout.addView(mSubtitle); |
210 | | - } else { |
211 | | - mTitle.setGravity(Gravity.CENTER); |
212 | | - } |
213 | | - parent.removeView(logo); |
| 165 | + }); |
214 | 166 | } |
215 | 167 | } |
216 | 168 | } |
0 commit comments