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

Commit 4281087e authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

feat: Move SharedPreferences code to its own class.

parent ef80b1a3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.Utilities;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Launcher;
@@ -103,7 +103,7 @@ public class LauncherAppMonitor extends LauncherApps.Callback
    }

    public void onUserUnlocked(Context context) {
        Utilities.getPrefs(context).registerOnSharedPreferenceChangeListener(this);
        LauncherPrefs.getPrefs(context).registerOnSharedPreferenceChangeListener(this);
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -11,8 +11,8 @@ import android.content.Context
import android.content.SharedPreferences
import android.content.res.Resources
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.LauncherPrefs
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.model.data.AppInfo
import com.android.launcher3.util.Executors.MODEL_EXECUTOR
import foundation.e.bliss.BaseController
@@ -69,7 +69,7 @@ class MultiModeController(val context: Context, val monitor: LauncherAppMonitor)
        }

    init {
        sharedPreferences = Utilities.getPrefs(context.createDeviceProtectedStorageContext())
        sharedPreferences = LauncherPrefs.getPrefs(context.createDeviceProtectedStorageContext())
        resources = context.resources
        monitor.registerCallback(mAppMonitorCallback)
    }
+6 −3
Original line number Diff line number Diff line
@@ -32,9 +32,9 @@ import android.widget.RelativeLayout
import android.widget.Toast
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.Launcher
import com.android.launcher3.LauncherPrefs
import com.android.launcher3.PendingAddItemInfo
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.config.FeatureFlags
import com.android.launcher3.graphics.FragmentWithPreview
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo
@@ -184,10 +184,13 @@ class WidgetContainer(context: Context, attrs: AttributeSet?) : FrameLayout(cont

        private var initialWidgetsAdded: Boolean
            set(value) {
                Utilities.getPrefs(context).edit().putBoolean(defaultWidgetsAdded, value).apply()
                LauncherPrefs.getPrefs(context)
                    .edit()
                    .putBoolean(defaultWidgetsAdded, value)
                    .apply()
            }
            get() {
                return Utilities.getPrefs(context).getBoolean(defaultWidgetsAdded, false)
                return LauncherPrefs.getPrefs(context).getBoolean(defaultWidgetsAdded, false)
            }

        private val isQsbEnabled: Boolean
+2 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.pm.ShortcutInfo;
import android.os.UserHandle;

import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.Utilities;
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.QuickstepModelDelegate.PredictorState;
@@ -57,7 +58,7 @@ public class PredictionUpdateTask extends BaseModelUpdateTask {
        Context context = app.getContext();

        // TODO: remove this
        Utilities.getDevicePrefs(context).edit()
        LauncherPrefs.getDevicePrefs(context).edit()
                .putBoolean(LAST_PREDICTION_ENABLED_STATE, !mTargets.isEmpty()).apply();

        FixedContainerItems fci = mPredictorState.items;
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICT
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
import static com.android.launcher3.Utilities.getDevicePrefs;
import static com.android.launcher3.LauncherPrefs.getDevicePrefs;
import static com.android.launcher3.hybridhotseat.HotseatPredictionModel.convertDataModelToAppTargetBundle;
import static com.android.launcher3.model.PredictionHelper.getAppTargetFromItemInfo;
import static com.android.launcher3.model.PredictionHelper.wrapAppTargetWithItemLocation;
Loading