Removing some usage of shared prefs

Bug: 301661768
Test: Presubmit
Flag: N/A
Change-Id: I158e9a5148d2c9404ea4d2e9e239696b29dbeb20
This commit is contained in:
Sunny Goyal
2023-10-06 11:28:25 -07:00
parent 447b09057a
commit 576f7a5e80
9 changed files with 31 additions and 80 deletions

View File

@@ -3,6 +3,7 @@ package com.android.launcher3;
import static com.android.launcher3.CellLayout.SPRING_LOADED_PROGRESS;
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_HEIGHT;
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_WIDTH;
import static com.android.launcher3.LauncherPrefs.RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RESIZE_COMPLETED;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RESIZE_STARTED;
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_X;
@@ -55,8 +56,6 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
private static final float RESIZE_THRESHOLD = 0.66f;
private static final int RESIZE_TRANSITION_DURATION_MS = 150;
private static final String KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN =
"launcher.reconfigurable_widget_education_tip_seen";
private static final Rect sTmpRect = new Rect();
private static final Rect sTmpRect2 = new Rect();
@@ -276,9 +275,8 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
if (!hasSeenReconfigurableWidgetEducationTip()) {
post(() -> {
if (showReconfigurableWidgetEducationTip() != null) {
mLauncher.getSharedPrefs().edit()
.putBoolean(KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN,
true).apply();
LauncherPrefs.get(getContext()).put(
RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN, true);
}
});
}
@@ -872,8 +870,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
}
private boolean hasSeenReconfigurableWidgetEducationTip() {
return mLauncher.getSharedPrefs()
.getBoolean(KEY_RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN, false)
return LauncherPrefs.get(getContext()).get(RECONFIGURABLE_WIDGET_EDUCATION_TIP_SEEN)
|| Utilities.isRunningInTestHarness();
}
}