diff --git a/app/src/main/java/io/github/qauxv/dsl/FunctionEntryRouter.kt b/app/src/main/java/io/github/qauxv/dsl/FunctionEntryRouter.kt index a5c0b3d5a1..4fe99c1ad1 100644 --- a/app/src/main/java/io/github/qauxv/dsl/FunctionEntryRouter.kt +++ b/app/src/main/java/io/github/qauxv/dsl/FunctionEntryRouter.kt @@ -124,7 +124,6 @@ object FunctionEntryRouter { category("auxiliary-friend", "好友") category("auxiliary-profile", "资料卡") } - fragment("auxiliary-group", "群聊") fragment("auxiliary-notification", "通知设置") fragment("auxiliary-experimental", "实验性功能") fragment("entertainment-function", "娱乐功能") @@ -258,9 +257,6 @@ object FunctionEntryRouter { @JvmField val FRIEND_CATEGORY: Array = arrayOf(ANY_CAST_PREFIX, "auxiliary-friend") - @JvmField - val GROUP_CATEGORY: Array = arrayOf(ANY_CAST_PREFIX, "auxiliary-group") - @JvmField val PROFILE_CATEGORY: Array = arrayOf(ANY_CAST_PREFIX, "auxiliary-profile") diff --git a/app/src/main/java/top/linl/hook/OffRelationshipIdentification.java b/app/src/main/java/top/linl/hook/OffRelationshipIdentification.java index 550e3e8ba5..fcb133d730 100644 --- a/app/src/main/java/top/linl/hook/OffRelationshipIdentification.java +++ b/app/src/main/java/top/linl/hook/OffRelationshipIdentification.java @@ -11,8 +11,8 @@ import io.github.qauxv.hook.CommonSwitchFunctionHook; import io.github.qauxv.util.Initiator; import java.lang.reflect.Method; -import top.linl.util.reflect.FieIdUtils; -import top.linl.util.reflect.MethodTool; +import top.linl.util.FieIdUtils; +import top.linl.util.MethodTool; @FunctionHookEntry diff --git a/app/src/main/java/top/linl/hook/SortTroopSettingAppListView.java b/app/src/main/java/top/linl/hook/SortTroopSettingAppListView.java deleted file mode 100644 index 721a45f54f..0000000000 --- a/app/src/main/java/top/linl/hook/SortTroopSettingAppListView.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * QAuxiliary - An Xposed module for QQ/TIM - * Copyright (C) 2019-2023 QAuxiliary developers - * https://github.com/cinit/QAuxiliary - * - * This software is non-free but opensource software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation; either - * version 3 of the License, or any later version and our eula as published - * by QAuxiliary contributors. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * and eula along with this software. If not, see - * - * . - */ - -package top.linl.hook; - -import android.os.Bundle; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import cc.ioctl.util.HookUtils; -import de.robv.android.xposed.XC_MethodHook; -import io.github.qauxv.base.annotation.FunctionHookEntry; -import io.github.qauxv.base.annotation.UiItemAgentEntry; -import io.github.qauxv.dsl.FunctionEntryRouter; -import io.github.qauxv.hook.CommonSwitchFunctionHook; -import java.lang.reflect.Method; -import top.linl.util.ScreenParamUtils; -import top.linl.util.reflect.FieIdUtils; -import top.linl.util.reflect.MethodTool; - -@FunctionHookEntry -@UiItemAgentEntry -public class SortTroopSettingAppListView extends CommonSwitchFunctionHook { - - public static final SortTroopSettingAppListView INSTANCE = new SortTroopSettingAppListView(); - - @NonNull - @Override - public String[] getUiItemLocation() { - return FunctionEntryRouter.Locations.Auxiliary.GROUP_CATEGORY; - } - - @Nullable - @Override - public CharSequence getDescription() { - return "让群设置的群文件在上面而不是在下面"; - } - - @Override - protected boolean initOnce() throws Exception { - Method doOnCreateMethod = MethodTool.find("com.tencent.mobileqq.troop.troopsetting.activity.TroopSettingActivity") - .returnType(boolean.class) - .params(Bundle.class) - .name("doOnCreate") - .get(); - HookUtils.hookAfterIfEnabled(this, doOnCreateMethod, new HookUtils.AfterHookedMethod() { - @Override - public void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable { - LinearLayout rootView = FieIdUtils.getFirstField(param.thisObject, LinearLayout.class); - int troopInfoTextIndex = 0; - View troopAppListView = null; - for (int i = 0; i < rootView.getChildCount(); i++) { - View child = rootView.getChildAt(i); - if (child instanceof TextView) { - TextView textView = (TextView) child; - String text = textView.getText().toString(); - if (text.equals("群聊信息")) { - troopInfoTextIndex = i; - } - } - if (child instanceof LinearLayout) { - LinearLayout simpleFormItem = (LinearLayout) child; - if (simpleFormItem.getChildAt(0) instanceof RelativeLayout) { - RelativeLayout itemTitle = (RelativeLayout) simpleFormItem.getChildAt(0); - if (itemTitle.getChildAt(0) instanceof TextView) { - TextView titleTextView = (TextView) itemTitle.getChildAt(0); - String titleText = titleTextView.getText().toString(); - if (titleText.equals("群应用")) { - troopAppListView = child; - break; - } - } - } - } - } - if (troopAppListView != null && troopInfoTextIndex != 0) { - rootView.removeView(troopAppListView); - //顶部偏移 不然会和群聊成员卡片贴一起 (贴贴 - LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT); - layoutParams.topMargin += ScreenParamUtils.dpToPx(rootView.getContext(), 16); - rootView.addView(troopAppListView, troopInfoTextIndex, layoutParams); - } - } - }); - return true; - } - - @NonNull - @Override - public String getName() { - return "将群应用卡片(群文件)移动到正常位置"; - } -} diff --git a/app/src/main/java/top/linl/hook/TurnOffFriendInteractionLogoView.java b/app/src/main/java/top/linl/hook/TurnOffFriendInteractionLogoView.java index ba53ee0ece..5a59a6b28f 100644 --- a/app/src/main/java/top/linl/hook/TurnOffFriendInteractionLogoView.java +++ b/app/src/main/java/top/linl/hook/TurnOffFriendInteractionLogoView.java @@ -30,8 +30,8 @@ import io.github.qauxv.hook.CommonSwitchFunctionHook; import java.lang.reflect.Field; import java.lang.reflect.Method; -import top.linl.util.reflect.FieIdUtils; -import top.linl.util.reflect.MethodTool; +import top.linl.util.FieIdUtils; +import top.linl.util.MethodTool; @FunctionHookEntry @UiItemAgentEntry diff --git a/app/src/main/java/top/linl/util/reflect/CheckClassType.java b/app/src/main/java/top/linl/util/CheckClassType.java similarity index 57% rename from app/src/main/java/top/linl/util/reflect/CheckClassType.java rename to app/src/main/java/top/linl/util/CheckClassType.java index bf8ad76c36..5e2e4c4254 100644 --- a/app/src/main/java/top/linl/util/reflect/CheckClassType.java +++ b/app/src/main/java/top/linl/util/CheckClassType.java @@ -1,26 +1,4 @@ -/* - * QAuxiliary - An Xposed module for QQ/TIM - * Copyright (C) 2019-2023 QAuxiliary developers - * https://github.com/cinit/QAuxiliary - * - * This software is non-free but opensource software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation; either - * version 3 of the License, or any later version and our eula as published - * by QAuxiliary contributors. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * and eula along with this software. If not, see - * - * . - */ - -package top.linl.util.reflect; +package top.linl.util; public class CheckClassType { diff --git a/app/src/main/java/top/linl/util/reflect/FieIdUtils.java b/app/src/main/java/top/linl/util/FieIdUtils.java similarity index 89% rename from app/src/main/java/top/linl/util/reflect/FieIdUtils.java rename to app/src/main/java/top/linl/util/FieIdUtils.java index 3e5ab8d152..c445a84907 100644 --- a/app/src/main/java/top/linl/util/reflect/FieIdUtils.java +++ b/app/src/main/java/top/linl/util/FieIdUtils.java @@ -1,26 +1,4 @@ -/* - * QAuxiliary - An Xposed module for QQ/TIM - * Copyright (C) 2019-2023 QAuxiliary developers - * https://github.com/cinit/QAuxiliary - * - * This software is non-free but opensource software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation; either - * version 3 of the License, or any later version and our eula as published - * by QAuxiliary contributors. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * and eula along with this software. If not, see - * - * . - */ - -package top.linl.util.reflect; +package top.linl.util; import java.lang.reflect.Field; diff --git a/app/src/main/java/top/linl/util/reflect/MethodTool.java b/app/src/main/java/top/linl/util/MethodTool.java similarity index 82% rename from app/src/main/java/top/linl/util/reflect/MethodTool.java rename to app/src/main/java/top/linl/util/MethodTool.java index 5a1a1f6604..f11f098c82 100644 --- a/app/src/main/java/top/linl/util/reflect/MethodTool.java +++ b/app/src/main/java/top/linl/util/MethodTool.java @@ -1,26 +1,4 @@ -/* - * QAuxiliary - An Xposed module for QQ/TIM - * Copyright (C) 2019-2023 QAuxiliary developers - * https://github.com/cinit/QAuxiliary - * - * This software is non-free but opensource software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation; either - * version 3 of the License, or any later version and our eula as published - * by QAuxiliary contributors. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * and eula along with this software. If not, see - * - * . - */ - -package top.linl.util.reflect; +package top.linl.util; import io.github.qauxv.util.Initiator; import java.lang.reflect.Method; diff --git a/app/src/main/java/top/linl/util/ReflectException.java b/app/src/main/java/top/linl/util/ReflectException.java new file mode 100644 index 0000000000..9771a1ebe2 --- /dev/null +++ b/app/src/main/java/top/linl/util/ReflectException.java @@ -0,0 +1,27 @@ +package top.linl.util; + +public class ReflectException extends RuntimeException { + + private Exception otherExceptions; + + public ReflectException() { + super(); + } + + public ReflectException(String content) { + super(content); + } + + public ReflectException(String content, Exception e) { + super(content); + this.otherExceptions = e; + } + + public boolean hasOtherExceptions() { + return otherExceptions != null; + } + + public Exception getOtherExceptions() { + return this.otherExceptions; + } +} diff --git a/app/src/main/java/top/linl/util/ScreenParamUtils.java b/app/src/main/java/top/linl/util/ScreenParamUtils.java deleted file mode 100644 index 6fca7de341..0000000000 --- a/app/src/main/java/top/linl/util/ScreenParamUtils.java +++ /dev/null @@ -1,117 +0,0 @@ -package top.linl.util; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Context; -import android.content.res.Resources; -import android.graphics.Color; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; - -public class ScreenParamUtils { - - - /** - * sp转px - */ - public static int spToPx(Context context, float spValue) { - final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; - return (int) (spValue * fontScale + 0.5f); - } - - /** - * 获取手机像素宽度 - * - * @return 宽度px - */ - public static int getScreenWidth(Context context) { - return context.getResources().getDisplayMetrics().widthPixels; - } - - /** - * 获取手机像素高度(不包含虚拟导航栏和状态栏) - * - * @return 高度px - */ - public static int getScreenHeight(Context context) { - return context.getResources().getDisplayMetrics().heightPixels; - } - - - /** - * 获取导航栏高度 - * - * @return px - */ - public static int getNavigationBarHeight(Context context) { - int navigationBarHeight = -1; - Resources resources = context.getResources(); - @SuppressLint({"DiscouragedApi", "InternalInsetResource"}) int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); - if (resourceId > 0) { - navigationBarHeight = resources.getDimensionPixelSize(resourceId); - } - return navigationBarHeight; - } - - /** - * 获取状态栏高度 - * - * @return px - */ - public static int getStatusBarHeight(Context context) { - int height = 0; - @SuppressLint({"InternalInsetResource", "DiscouragedApi"}) - int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); - if (resourceId > 0) { - height = context.getResources().getDimensionPixelSize(resourceId); - } - return height; - } - - /** - * 根据手机的分辨率从 dp(相对大小) 的单位 转成为 px(像素) - */ - public static int dpToPx(Context context, float dpValue) { - // 获取屏幕密度 - final float scale = context.getResources().getDisplayMetrics().density; - // 结果+0.5是为了int取整时更接近 - return (int) (dpValue * scale + 0.5f); - } - - - /** - * 根据手机的分辨率从 px(像素) 的单位 转成为 dp(相对大小) - */ - public static int pxToDp(Context context, float pxValue) { - final float scale = context.getResources().getDisplayMetrics().density; - return (int) (pxValue / scale + 0.5f); - } - - /** - * px转sp - */ - public static int pxToSp(Context context, float pxValue) { - final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; - return (int) (pxValue / fontScale + 0.5f); - } - - /** - * 将当前活动设置为透明的状态栏 - * - * @param activity 当前Activity - */ - protected void requestTranslucentStatusBar(Activity activity) { - Window window = activity.getWindow(); - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS - | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); - window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - window.setStatusBarColor(Color.TRANSPARENT); - window.setNavigationBarColor(Color.TRANSPARENT); - } - - -} diff --git a/app/src/main/java/top/linl/util/reflect/ReflectException.java b/app/src/main/java/top/linl/util/reflect/ReflectException.java deleted file mode 100644 index 141ecbb0d3..0000000000 --- a/app/src/main/java/top/linl/util/reflect/ReflectException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * QAuxiliary - An Xposed module for QQ/TIM - * Copyright (C) 2019-2023 QAuxiliary developers - * https://github.com/cinit/QAuxiliary - * - * This software is non-free but opensource software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation; either - * version 3 of the License, or any later version and our eula as published - * by QAuxiliary contributors. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * and eula along with this software. If not, see - * - * . - */ - -package top.linl.util.reflect; - -public class ReflectException extends RuntimeException { - - private Exception otherExceptions; - - public ReflectException() { - super(); - } - - public ReflectException(String content) { - super(content); - } - - public ReflectException(String content, Exception e) { - super(content); - this.otherExceptions = e; - } - - public boolean hasOtherExceptions() { - return otherExceptions != null; - } - - public Exception getOtherExceptions() { - return this.otherExceptions; - } -}