diff options
Diffstat (limited to 'src/com/android/launcher3/shortcuts')
-rw-r--r-- | src/com/android/launcher3/shortcuts/DeepShortcutManager.java | 14 | ||||
-rw-r--r-- | src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutManager.java b/src/com/android/launcher3/shortcuts/DeepShortcutManager.java index c2c7c1772..41f1a47af 100644 --- a/src/com/android/launcher3/shortcuts/DeepShortcutManager.java +++ b/src/com/android/launcher3/shortcuts/DeepShortcutManager.java @@ -45,10 +45,22 @@ public class DeepShortcutManager { private static final int FLAG_GET_ALL = ShortcutQuery.FLAG_MATCH_DYNAMIC | ShortcutQuery.FLAG_MATCH_MANIFEST | ShortcutQuery.FLAG_MATCH_PINNED; + private static DeepShortcutManager sInstance; + private static final Object sInstanceLock = new Object(); + + public static DeepShortcutManager getInstance(Context context) { + synchronized (sInstanceLock) { + if (sInstance == null) { + sInstance = new DeepShortcutManager(context.getApplicationContext()); + } + return sInstance; + } + } + private final LauncherApps mLauncherApps; private boolean mWasLastCallSuccess; - public DeepShortcutManager(Context context, ShortcutCache shortcutCache) { + private DeepShortcutManager(Context context) { mLauncherApps = (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE); } diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java index 08ca2429f..314a8628b 100644 --- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java +++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java @@ -52,7 +52,6 @@ import com.android.launcher3.IconCache; import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; -import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherViewPropertyAnimator; @@ -103,7 +102,7 @@ public class DeepShortcutsContainer extends AbstractFloatingView public DeepShortcutsContainer(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mLauncher = Launcher.getLauncher(context); - mDeepShortcutsManager = LauncherAppState.getInstance().getShortcutManager(); + mDeepShortcutsManager = DeepShortcutManager.getInstance(context); mStartDragThreshold = getResources().getDimensionPixelSize( R.dimen.deep_shortcuts_start_drag_threshold); |