Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53d68438 authored by Joey's avatar Joey Committed by Michael Bestas
Browse files

Trebuchet: allow disabling workspace edit



Change-Id: I503e19cbc512eac0e4a8c8bccc16a6ccc0e805da
Signed-off-by: default avatarJoey <joey@lineageos.org>
parent 03bf6c0e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,14 @@
    <!-- Application name -->
    <string name="lineageos_app_name" translatable="false">Trebuchet</string>

    <!-- Settings -->

    <!-- Edit workspace -->
    <string name="settings_edit_allow_title">Allow edit</string>
    <string name="settings_edit_allow_summary_on">Icons and widgets can be added, removed and moved on the homescreen</string>
    <string name="settings_edit_allow_summary_off">Icons and widgets can\'t be added, removed and moved on the homescreen</string>
    <string name="settings_edit_widgets_error">It\'s not possible to add widgets to the home screen</string>

    <!-- Folder titles -->
    <string name="google_folder_title" translatable="false">Google</string>

+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,14 @@
<androidx.preference.PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android">

    <SwitchPreference
        android:defaultValue="true"
        android:key="pref_workspace_edit"
        android:persistent="true"
        android:title="@string/settings_edit_allow_title"
        android:summaryOn="@string/settings_edit_allow_summary_on"
        android:summaryOff="@string/settings_edit_allow_summary_off" />

    <com.android.launcher3.settings.NotificationDotsPreference
        android:key="pref_icon_badging"
        android:title="@string/notification_dots_title"
+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
    public static final String KEY_SHOW_DESKTOP_LABELS = "pref_desktop_show_labels";
    public static final String KEY_SHOW_DRAWER_LABELS = "pref_drawer_show_labels";
    public static final String KEY_ICON_PATH_REF = "pref_icon_shape_path";
    public static final String KEY_WORKSPACE_EDIT = "pref_workspace_edit";

    // Constants that affects the interpolation curve between statically defined device profile
    // buckets.
+5 −0
Original line number Diff line number Diff line
@@ -690,4 +690,9 @@ public final class Utilities {
            return mSize;
        }
    }

    public static boolean isWorkspaceEditAllowed(Context context) {
        SharedPreferences prefs = getPrefs(context.getApplicationContext());
        return prefs.getBoolean(InvariantDeviceProfile.KEY_WORKSPACE_EDIT, true);
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -406,6 +407,11 @@ public class DragController implements DragDriver.EventListener, TouchController
            return false;
        }

        if (!Utilities.isWorkspaceEditAllowed(mLauncher.getApplicationContext())) {
            cancelDrag();
            return false;
        }

        Point dragLayerPos = getClampedDragLayerPos(ev.getX(), ev.getY());
        mLastTouch.set(dragLayerPos.x,  dragLayerPos.y);
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
Loading