summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2014-01-23 08:56:37 -0800
committerAbhisek Devkota <ciwrl@cyanogenmod.com>2014-06-12 16:33:16 -0700
commit44d180199b36f1ff17edbc7c0c68c0a0298f78f4 (patch)
treee57c09184ef03b8df8a571e247af8a0ba54adf4e /src/com/android/launcher3/Launcher.java
parent9d9a1c05734ba45d117748b28de366c4c345d858 (diff)
downloadandroid_packages_apps_Trebuchet-44d180199b36f1ff17edbc7c0c68c0a0298f78f4.tar.gz
android_packages_apps_Trebuchet-44d180199b36f1ff17edbc7c0c68c0a0298f78f4.tar.bz2
android_packages_apps_Trebuchet-44d180199b36f1ff17edbc7c0c68c0a0298f78f4.zip
GEL Integration (2/2)
Launch search from extra panel to mimic Google Launcher. Changed Trebuchet to build against CM instead of the AOSP SDK. Added support to swipe left from the home screen to enter Google Now, if it is installed. A right swipe will return the user to the home screen. Change-Id: Ia1a77fedea7e67bcd54a6b6d66099f8366d6b1dc
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java50
1 files changed, 47 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1209355ea..d30cde45b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -241,6 +241,8 @@ public class Launcher extends Activity
private static int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 5;
private static int NEW_APPS_ANIMATION_DELAY = 500;
+ private boolean mGelIntegrationEnabled = false;
+
private final BroadcastReceiver mCloseSystemDialogsReceiver
= new CloseSystemDialogsIntentReceiver();
private final ContentObserver mWidgetObserver = new AppWidgetResetObserver();
@@ -484,6 +486,8 @@ public class Launcher extends Activity
mSavedState = savedInstanceState;
restoreState(mSavedState);
+ restoreGelSetting();
+
if (PROFILE_STARTUP) {
android.os.Debug.stopMethodTracing();
}
@@ -531,6 +535,12 @@ public class Launcher extends Activity
"cyanogenmod.permission.PROTECTED_APP", null);
}
+ public void restoreGelSetting() {
+ mGelIntegrationEnabled = SettingsProvider.getBoolean(this,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH_SCREEN_LEFT,
+ R.bool.preferences_interface_homescreen_search_screen_left_default);
+ }
+
private void initializeDynamicGrid() {
LauncherAppState.setApplicationContext(getApplicationContext());
LauncherAppState app = LauncherAppState.getInstance();
@@ -539,6 +549,8 @@ public class Launcher extends Activity
SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
R.bool.preferences_interface_homescreen_hide_icon_labels_default);
+ restoreGelSetting();
+
// Determine the dynamic grid properties
Point smallestSize = new Point();
Point largestSize = new Point();
@@ -565,13 +577,41 @@ public class Launcher extends Activity
sPausedFromUserAction = true;
}
- /** To be overriden by subclasses to hint to Launcher that we have custom content */
+ /** To be overridden by subclasses to hint to Launcher that we have custom content */
protected boolean hasCustomContentToLeft() {
- return false;
+ return isGelIntegrationSupported() && isGelIntegrationEnabled();
+ }
+
+ public boolean isGelIntegrationSupported() {
+ final SearchManager searchManager =
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
+
+ // Currently the only custom content available is the GEL launcher integration,
+ // only supported on CyanogenMod.
+ return globalSearchActivity != null && isCM();
+ }
+
+ public boolean isGelIntegrationEnabled() {
+ return mGelIntegrationEnabled;
+ }
+
+ public void onCustomContentLaunch() {
+ if(isGelIntegrationEnabled() && isGelIntegrationSupported()) {
+ GelIntegrationHelper.getInstance().registerSwipeBackGestureListenerAndStartGel(this);
+ }
}
/**
- * To be overridden by subclasses to populate the custom content container and call
+ * Check if the device running this application is running CyanogenMod.
+ * @return true if this device is running CM.
+ */
+ protected boolean isCM() {
+ return getPackageManager().hasSystemFeature("com.cyanogenmod.android");
+ }
+
+ /**
+ * To be overridden by subclasses to create the custom content and call
* {@link #addToCustomContentPage}. This will only be invoked if
* {@link #hasCustomContentToLeft()} is {@code true}.
*/
@@ -1001,6 +1041,10 @@ public class Launcher extends Activity
}
super.onResume();
+ if(isGelIntegrationEnabled() && isGelIntegrationSupported()) {
+ GelIntegrationHelper.getInstance().handleGelResume();
+ }
+
// Restore the previous launcher state
if (mOnResumeState == State.WORKSPACE) {
showWorkspace(false);