Skip to content

Commit

Permalink
feat: home - recents - Show launcher as background
Browse files Browse the repository at this point in the history
from XiaomiHelper by HowieHChen
  • Loading branch information
Sevtinge committed Jun 19, 2024
1 parent 5f95af7 commit 89c21d8
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
import com.sevtinge.hyperceiler.module.hook.home.recent.RemoveCardAnim;
import com.sevtinge.hyperceiler.module.hook.home.recent.RemoveIcon;
import com.sevtinge.hyperceiler.module.hook.home.recent.RemoveLeftShare;
import com.sevtinge.hyperceiler.module.hook.home.recent.ShowLaunch;
import com.sevtinge.hyperceiler.module.hook.home.recent.TaskViewHorizontal;
import com.sevtinge.hyperceiler.module.hook.home.recent.TaskViewVertical;
import com.sevtinge.hyperceiler.module.hook.home.recent.UnlockPin;
Expand Down Expand Up @@ -224,6 +225,7 @@ public void handleLoadPackage() {
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(new ShowLaunch(), mPrefsMap.getBoolean("home_recent_show_launch"));

// 图标
initHook(BigIconCorner.INSTANCE, mPrefsMap.getBoolean("home_title_big_icon_corner"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of HyperCeiler.
* HyperCeiler is free 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.
* This program 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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.module.hook.home.recent;

import com.sevtinge.hyperceiler.module.base.BaseHook;

public class ShowLaunch extends BaseHook {
//from XiaomiHelper by HowieHChen
@Override
public void init() throws NoSuchMethodException {
findAndHookMethod("com.miui.home.recents.NavStubView", "changeAlphaScaleForFsGesture", float.class, float.class, new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
param.args[0] = 1.0f;
}
});
findAndHookMethod("com.miui.home.recents.OverviewState", "getShortcutMenuLayerAlpha", new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult(1.0f);
}
});
findAndHookMethod("com.miui.home.recents.OverviewState", "getShortcutMenuLayerScale", new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult((float) mPrefsMap.getInt("home_recent_show_launch_size", 95) / 100);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of HyperCeiler.
* HyperCeiler is free 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.
* This program 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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.module.hook.home.title

import android.app.*
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,8 @@
<string name="home_recent_show_memory_info">展示内存信息</string>
<string name="home_recent_always_show_clean_up">无卡片时不隐藏清理图标</string>
<string name="home_recent_blur">背景模糊</string>
<string name="home_recent_show_launch">最近任务视图不隐藏桌面</string>
<string name="home_recent_show_launch_size">桌面缩放大小</string>

<string name="home_widget">小部件</string>
<string name="home_widget_all_widget_animation">强制所有小部件使用动画</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,8 @@
<string name="home_recent_show_memory_info">Show memory info</string>
<string name="home_recent_always_show_clean_up">Prohibit hiding the cleanup icon when there is no card</string>
<string name="home_recent_blur">Background blur</string>
<string name="home_recent_show_launch">Show launcher as background</string>
<string name="home_recent_show_launch_size">Launcher background size</string>

<string name="home_widget">Widget</string>
<string name="home_widget_all_widget_animation">Widget animation</string>
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/xml/home_recent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@
android:title="@string/home_recent_blur"
android:defaultValue="false" />

<SwitchPreference
android:key="prefs_key_home_recent_show_launch"
android:title="@string/home_recent_show_launch"
android:defaultValue="false" />

<SeekBarPreferenceEx
android:defaultValue="95"
android:dependency="prefs_key_home_recent_show_launch"
android:key="prefs_key_home_recent_show_launch_size"
android:title="@string/home_recent_show_launch_size"
app:defaultValueText="@string/array_default"
app:format="%s f"
app:maxValue="100"
app:minValue="20"
app:stepValue="1"
app:displayDividerValue="100"
app:showSeekBarValue="true" />


<SwitchPreference
android:key="prefs_key_home_recent_show_memory_info"
android:title="@string/home_recent_show_memory_info"
Expand Down

0 comments on commit 89c21d8

Please sign in to comment.