Skip to content

Commit

Permalink
opt: home - recents - Show launcher as background can change alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Jun 19, 2024
1 parent 89c21d8 commit 39bdcf0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ 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;
param.args[0] = (1.0f - (float) mPrefsMap.getInt("home_recent_show_launch_alpha", 100) / 100) * (float) param.args[0] + (float) mPrefsMap.getInt("home_recent_show_launch_alpha", 100) / 100;
}
});
findAndHookMethod("com.miui.home.recents.OverviewState", "getShortcutMenuLayerAlpha", new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult(1.0f);
param.setResult((1.0f - (float) mPrefsMap.getInt("home_recent_show_launch_alpha", 100) / 100) * (float) param.getResult() + (float) mPrefsMap.getInt("home_recent_show_launch_alpha", 100) / 100);
}
});
findAndHookMethod("com.miui.home.recents.OverviewState", "getShortcutMenuLayerScale", new MethodHook(){
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,7 @@
<string name="home_recent_blur">背景模糊</string>
<string name="home_recent_show_launch">最近任务视图不隐藏桌面</string>
<string name="home_recent_show_launch_size">桌面缩放大小</string>
<string name="home_recent_show_launch_alpha">桌面透明度</string>

<string name="home_widget">小部件</string>
<string name="home_widget_all_widget_animation">强制所有小部件使用动画</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@
<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_recent_show_launch_alpha">Launcher background alpha</string>

<string name="home_widget">Widget</string>
<string name="home_widget_all_widget_animation">Widget animation</string>
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/xml/home_recent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
app:displayDividerValue="100"
app:showSeekBarValue="true" />

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

<SwitchPreference
android:key="prefs_key_home_recent_show_memory_info"
Expand Down

0 comments on commit 39bdcf0

Please sign in to comment.