Add option to disable wallpaper scrolling (#2197)
Signed-off-by: Till Kottmann <me@deletescape.ch> Co-authored-by: Till Kottmann <me@deletescape.ch>
This commit is contained in:
@@ -108,5 +108,6 @@
|
||||
<string name="custom">Custom</string>
|
||||
<string name="custom_color">Custom Color</string>
|
||||
<string name="quickstep_description">Clear All Button, Corner Radius</string>
|
||||
<string name="wallpaper_scrolling_label">Wallpaper scrolling</string>
|
||||
<string name="show_sys_ui_scrim">Show Top Shadow</string>
|
||||
</resources>
|
||||
|
||||
@@ -88,6 +88,7 @@ class PreferenceManager private constructor(private val context: Context) : Base
|
||||
val autoLaunchRoot = BoolPref("pref_autoLaunchRoot", false)
|
||||
val useSystemAccent = BoolPref("pref_useSystemAccent", Utilities.ATLEAST_S, recreate)
|
||||
val accentColor = IntPref("pref_accentColor", LAWNCHAIR_BLUE.toInt(), recreate)
|
||||
val wallpaperScrolling = BoolPref("pref_wallpaperScrolling", true)
|
||||
val showSysUiScrim = BoolPref("pref_showSysUiScrim", true)
|
||||
|
||||
init {
|
||||
|
||||
@@ -58,6 +58,10 @@ fun HomeScreenPreferences() {
|
||||
prefs.smartSpaceEnable.getAdapter(),
|
||||
label = stringResource(id = R.string.smart_space_enable),
|
||||
)
|
||||
SwitchPreference(
|
||||
prefs.wallpaperScrolling.getAdapter(),
|
||||
label = stringResource(id = R.string.wallpaper_scrolling_label),
|
||||
)
|
||||
SwitchPreference(
|
||||
prefs.workspaceDt2s.getAdapter(),
|
||||
label = stringResource(id = R.string.workspace_dt2s),
|
||||
|
||||
@@ -14,6 +14,8 @@ import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import app.lawnchair.preferences.PreferenceManager;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
@@ -41,10 +43,13 @@ public class WallpaperOffsetInterpolator extends BroadcastReceiver {
|
||||
private boolean mLockedToDefaultPage;
|
||||
private int mNumScreens;
|
||||
|
||||
private PreferenceManager prefs;
|
||||
|
||||
public WallpaperOffsetInterpolator(Workspace workspace) {
|
||||
mWorkspace = workspace;
|
||||
mIsRtl = Utilities.isRtl(workspace.getResources());
|
||||
mHandler = new OffsetHandler(workspace.getContext());
|
||||
prefs = PreferenceManager.getInstance(workspace.getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +73,7 @@ public class WallpaperOffsetInterpolator extends BroadcastReceiver {
|
||||
|
||||
// To match the default wallpaper behavior in the system, we default to either the left
|
||||
// or right edge on initialization
|
||||
if (mLockedToDefaultPage || numScrollingPages <= 1) {
|
||||
if (!prefs.getWallpaperScrolling().get() || mLockedToDefaultPage || numScrollingPages <= 1) {
|
||||
out[0] = mIsRtl ? 1 : 0;
|
||||
return;
|
||||
}
|
||||
@@ -273,4 +278,4 @@ public class WallpaperOffsetInterpolator extends BroadcastReceiver {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user