Skip to content

Commit

Permalink
opt: ispad
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed May 5, 2024
1 parent 9301f6e commit dcddb20
Show file tree
Hide file tree
Showing 30 changed files with 70 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.app;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.base.HookExpand;
Expand All @@ -41,6 +41,6 @@ public void handleLoadPackage() {
initHook(new Taplus(), mPrefsMap.getBoolean("security_center_taplus"));
initHook(new LinkOpenMode(), true);
initHook(HorizontalContentExtension.INSTANCE, mPrefsMap.getBoolean("content_extension_unlock_taplus_horizontal"));
initHook(UnlockTaplus.INSTANCE, mPrefsMap.getBoolean("content_extension_unlock_taplus") && getIS_TABLET());
initHook(UnlockTaplus.INSTANCE, mPrefsMap.getBoolean("content_extension_unlock_taplus") && isPad());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.app.Home.Phone;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.base.HookExpand;
Expand Down Expand Up @@ -220,14 +220,14 @@ public void handleLoadPackage() {
initHook(RecentResource.INSTANCE, mPrefsMap.getInt("task_view_corners", 20) != 20 ||
mPrefsMap.getInt("task_view_header_height", 40) != 40);
initHook(RealMemory.INSTANCE, mPrefsMap.getBoolean("home_recent_show_real_memory"));
initHook(MemInfoShow.INSTANCE, mPrefsMap.getBoolean("home_recent_show_memory_info") && getIS_TABLET());
initHook(MemInfoShow.INSTANCE, mPrefsMap.getBoolean("home_recent_show_memory_info") && isPad());
initHook(AlwaysShowCleanUp.INSTANCE, mPrefsMap.getBoolean("always_show_clean_up"));
initHook(new BackgroundBlur(), mPrefsMap.getBoolean("home_recent_blur"));

// 图标
initHook(BigIconCorner.INSTANCE, mPrefsMap.getBoolean("home_title_big_icon_corner"));
initHook(new DownloadAnimation(), mPrefsMap.getBoolean("home_title_download_animation"));
initHook(DisableHideTheme.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_theme") && getIS_TABLET());
initHook(DisableHideTheme.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_theme") && isPad());
initHook(DisableHideFile.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_file"));
initHook(DisableHideGoogle.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_google"));
initHook(new FakeNonDefaultIcon(), mPrefsMap.getBoolean("fake_non_default_icon"));
Expand Down Expand Up @@ -267,7 +267,7 @@ public void handleLoadPackage() {
initHook(new HomeMode(), mPrefsMap.getStringAsInt("home_other_home_mode", 0) > 0);
initHook(AlwaysShowStatusClock.INSTANCE, mPrefsMap.getBoolean("home_other_show_clock"));
initHook(new InfiniteScroll(), mPrefsMap.getBoolean("home_other_infinite_scroll"));
if (getIS_TABLET()) {
if (isPad()) {
initHook(new FreeformShortcutMenu(), mPrefsMap.getBoolean("home_other_freeform_shortcut_menu"));
initHook(new TasksShortcutMenu(), mPrefsMap.getBoolean("home_other_tasks_shortcut_menu"));
} else {
Expand Down Expand Up @@ -305,7 +305,7 @@ public void handleLoadPackage() {
initHook(SetDeviceLevel.INSTANCE, mPrefsMap.getBoolean("home_other_high_models"));

// 小米/红米平板相关
if (getIS_TABLET()) {
if (isPad()) {
boolean mMoreSetting = mPrefsMap.getBoolean("home_other_mi_pad_enable_more_setting");
initHook(SetGestureNeedFingerNum.INSTANCE, mPrefsMap.getBoolean("mipad_input_need_finger_num"));
initHook(EnableMoreSetting.INSTANCE, mMoreSetting);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.app.SystemFramework.Phone;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;

import com.sevtinge.hyperceiler.module.base.BaseModule;
Expand Down Expand Up @@ -138,7 +138,7 @@ public void handleLoadPackage() {
// initHook(new LocationSimulation(), false);

// 小米/红米平板设置相关
if (getIS_TABLET()) {
if (isPad()) {
initHook(IgnoreStylusKeyGesture.INSTANCE, mPrefsMap.getBoolean("mipad_input_ingore_gesture"));
initHook(NoMagicPointer.INSTANCE, mPrefsMap.getBoolean("mipad_input_close_magic"));
initHook(RemoveStylusBluetoothRestriction.INSTANCE, mPrefsMap.getBoolean("mipad_input_disable_bluetooth"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ private boolean invokeHookInit(LoadPackageParam lpparam) {
if (mPkgName.equals(mPkg)) {
// 需要限制安卓版本和设备取消这些注释,并删除下面的invoke方法。
// if (!isAndroidVersion(android)) continue;
// if (getIS_TABLET() && isPad) {
// if (isPad() && isPad) {
// return invoke(lpparam, clzz);
// } else if (getIS_TABLET() && !isPad) {
// } else if (isPad() && !isPad) {
// continue;
// } else {
// return invoke(lpparam, clzz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.sevtinge.hyperceiler.module.hook.home;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.content.Context;
import android.database.ContentObserver;
import android.os.Handler;
Expand All @@ -30,8 +32,6 @@

import de.robv.android.xposed.XposedHelpers;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

/**
* @author 焕晨HChen
*/
Expand All @@ -42,7 +42,7 @@ public class LockApp extends BaseHook {

@Override
public void init() throws NoSuchMethodException {
if (getIS_TABLET()) {
if (isPad()) {
// 平板
findAndHookConstructor("com.miui.home.recents.GestureStubView",
Context.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.view.View;

Expand All @@ -30,7 +30,7 @@ public class UserPresentAnimation extends BaseHook {

@Override
public void init() {
mUserPresentAnimationCompatV12Phone = !getIS_TABLET() ?
mUserPresentAnimationCompatV12Phone = !isPad() ?
findClassIfExists("com.miui.home.launcher.compat.UserPresentAnimationCompatV12Phone") :
findClassIfExists("com.miui.home.launcher.compat.UserPresentAnimationCompatV12Spring");
findAndHookMethod(mUserPresentAnimationCompatV12Phone, "getSpringAnimator", View.class, int.class, float.class, float.class, float.class, float.class, new MethodHook() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home.folder;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.content.Context;
import android.os.Build;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void init() {
mDragView = findClassIfExists("com.miui.home.launcher.DragView");
mFolderIcon2x2 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon2x2");

if (getIS_TABLET()) {
if (isPad()) {
mFolderIcon2x2_4 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon4x4_16");
mFolderIcon2x2_9 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon3x3_9");
} else {
Expand Down Expand Up @@ -97,7 +97,7 @@ protected void after(MethodHookParam param) {
FrameLayout.LayoutParams lp1 = (FrameLayout.LayoutParams) mDockBlur.getLayoutParams();
lp1.gravity = Gravity.CENTER;

if(getIS_TABLET()){
if(isPad()){
lp1.width = mFolderWidth * 2;
lp1.height = mFolderHeight *2;
}else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home.folder;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.view.Gravity;
import android.view.View;
Expand All @@ -44,7 +44,7 @@ public class BigFolderIconBlur1x2 extends BaseHook {

@Override
public void init() {
if (getIS_TABLET()) {
if (isPad()) {
mFolderIcon1x2 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon2x2_4");
} else {
mFolderIcon1x2 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon1x2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home.folder;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.os.Build;
import android.view.Gravity;
Expand All @@ -45,7 +45,7 @@ public class BigFolderIconBlur2x1 extends BaseHook {

@Override
public void init() {
if (getIS_TABLET()) {
if (isPad()) {
mFolderIcon2x1 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon4x2_8");
} else {
mFolderIcon2x1 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon2x1");
Expand Down Expand Up @@ -77,7 +77,7 @@ protected void after(MethodHookParam param) {
mIconContainer.addView(mDockBlur, 0);
FrameLayout.LayoutParams lp1 = (FrameLayout.LayoutParams) mDockBlur.getLayoutParams();
lp1.gravity = Gravity.CENTER;
if (getIS_TABLET()) {
if (isPad()) {
lp1.width = mFolderWidth * 2;
lp1.height = mFolderHeight * 2;
}else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package com.sevtinge.hyperceiler.module.hook.home.other;

import static com.sevtinge.hyperceiler.module.base.tool.OtherTool.getModuleRes;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static de.robv.android.xposed.XposedHelpers.callMethod;

import android.annotation.SuppressLint;
Expand Down Expand Up @@ -61,7 +61,7 @@ public class FreeformShortcutMenu extends BaseHook {
@Override
public void init() {

if (getIS_TABLET()) {
if (isPad()) {
hookAllMethods("com.miui.home.launcher.shortcuts.SystemShortcutMenuItem$SmallWindowShortcutMenuItem", "isValid",
MethodHook.returnConstant(true));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.sevtinge.hyperceiler.utils.devicesdk.*
object AlwaysShowCleanUp: BaseHook() {
override fun init() {
loadClass(
when (IS_TABLET) {
when (isPad()) {
false -> "com.miui.home.recents.views.RecentsContainer"
true -> "com.miui.home.recents.views.RecentsDecorations"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object BlurLevel : BaseHook() {
it.result = false
}

if (IS_TABLET) {
if (isPad()) {
navStubViewClass.hookAfterAllMethods("onTouchEvent") {
val mLauncher = applicationClass.callStaticMethod("getLauncher") as Activity
blurClass.callStaticMethod("fastBlur", 1.0f, mLauncher.window, true, 500L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object RealMemory : BaseHook() {
fun Any.formatSize(): String = Formatter.formatFileSize(context, this as Long)

val recentContainerClass = loadClass(
when (IS_TABLET) {
when (isPad()) {
false -> "com.miui.home.recents.views.RecentsContainer"
true -> "com.miui.home.recents.views.RecentsDecorations"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemframework;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.content.Context;
import android.database.ContentObserver;
Expand Down Expand Up @@ -112,7 +112,7 @@ protected void before(MethodHookParam param) {
}
);

if (getIS_TABLET()) {
if (isPad()) {
findAndHookMethod("com.android.server.wm.MiuiCvwGestureController$GesturePointerEventListener",
"onPointerEvent", MotionEvent.class,
new MethodHook() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import static com.sevtinge.hyperceiler.utils.devicesdk.DisplayUtils.dp2px;
import static com.sevtinge.hyperceiler.utils.devicesdk.DisplayUtils.sp2px;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getBaseOs;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getRomAuthor;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;
Expand Down Expand Up @@ -154,7 +154,7 @@ public void initPrefs() {
mAod.setTitle(R.string.aod);
mMiLink.setTitle(R.string.milink);
mGuardProvider.setTitle(R.string.guard_provider);
if (getIS_TABLET()) {
if (isPad()) {
mSecurityCenter.setTitle(R.string.security_center_pad);
} else {
mSecurityCenter.setTitle(R.string.security_center);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.Manifest;
Expand Down Expand Up @@ -50,7 +50,7 @@ public int getContentResId() {

@Override
public View.OnClickListener addRestartListener() {
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!getIS_TABLET() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!isPad() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
return view -> ((BaseSettingsActivity)getActivity()).showRestartDialog(
mSecurity,
"com.miui.securitycenter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.view.View;
Expand All @@ -37,7 +37,7 @@ public int getContentResId() {

@Override
public View.OnClickListener addRestartListener() {
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!getIS_TABLET() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!isPad() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
return view -> ((BaseSettingsActivity)getActivity()).showRestartDialog(
mSecurity,
"com.miui.securitycenter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;
Expand Down Expand Up @@ -71,12 +71,12 @@ public void initPrefs() {
mNotice = findPreference("prefs_key_system_settings_more_notification_settings");
mUiMode = findPreference("prefs_key_system_settings_unlock_ui_mode");

mUiMode.setVisible(getIS_TABLET());
mUiMode.setVisible(isPad());
mHighMode.setVisible(!isAndroidVersion(30));
mAreaScreenshot.setVisible(isAndroidVersion(30));
mNewNfc.setVisible((isMoreMiuiVersion(14f) || isMoreHyperOSVersion(1f)) && isMoreAndroidVersion(33));
mNoveltyHaptic.setVisible((isMoreMiuiVersion(14f) || isMoreHyperOSVersion(1f)) && isMoreAndroidVersion(31));
mPad.setVisible(getIS_TABLET());
mPad.setVisible(isPad());

if (isMoreHyperOSVersion(1f)) {
mNotice.setSummary(R.string.system_settings_more_notification_settings_summary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.os.Handler;

Expand Down Expand Up @@ -57,7 +57,7 @@ public void initPrefs() {
mDefault = findPreference("prefs_key_various_super_clipboard_key");
mMipad = findPreference("prefs_key_various_mipad");
mClipboard = findPreference("prefs_key_sogou_xiaomi_clipboard");
mMipad.setVisible(getIS_TABLET());
mMipad.setVisible(isPad());
handler = new Handler();

mClipboard.setOnPreferenceChangeListener((preference, o) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment.home;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.view.View;

Expand Down Expand Up @@ -55,7 +55,7 @@ public View.OnClickListener addRestartListener() {
@Override
public void initPrefs() {
mDisableRecentIcon = findPreference("prefs_key_home_dock_disable_recents_icon");
mDisableRecentIcon.setVisible(getIS_TABLET());
mDisableRecentIcon.setVisible(isPad());
mDockBackgroundBlur = findPreference("prefs_key_home_dock_bg_custom");
mDockBackgroundColor = findPreference("prefs_key_home_dock_bg_color");
int mBlurMode = Integer.parseInt(PrefsUtils.getSharedStringPrefs(getContext(), "prefs_key_home_dock_add_blur", "0"));
Expand Down
Loading

0 comments on commit dcddb20

Please sign in to comment.