summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2014-06-27 16:56:22 -0700
committerRaj Yengisetty <rajesh@cyngn.com>2015-07-24 19:25:17 -0700
commit0c5f6f6dc6c5e6948ff5683fa8ed38ed956f457c (patch)
tree4c92e2b14ea9fbcd4b7bc1403fa568ec92fed5dd
parentcfad40b9e4e47cd10898786effdc8b7fdcc6cbf1 (diff)
downloadandroid_packages_apps_Trebuchet-0c5f6f6dc6c5e6948ff5683fa8ed38ed956f457c.tar.gz
android_packages_apps_Trebuchet-0c5f6f6dc6c5e6948ff5683fa8ed38ed956f457c.tar.bz2
android_packages_apps_Trebuchet-0c5f6f6dc6c5e6948ff5683fa8ed38ed956f457c.zip
Fix GEL integration for RTL mode.
In RTL mode, the Google Now activity starts to the right, so to return to Trebuchet, the left edge must be swiped. Change-Id: Ib8869570307b6186e7e9ea19520ed21418a175fb
-rw-r--r--src/com/android/launcher3/GelIntegrationHelper.java6
-rw-r--r--src/com/android/launcher3/Launcher.java30
2 files changed, 33 insertions, 3 deletions
diff --git a/src/com/android/launcher3/GelIntegrationHelper.java b/src/com/android/launcher3/GelIntegrationHelper.java
index 6dd9c0e32..f43e7e6a0 100644
--- a/src/com/android/launcher3/GelIntegrationHelper.java
+++ b/src/com/android/launcher3/GelIntegrationHelper.java
@@ -22,6 +22,7 @@ public class GelIntegrationHelper {
private static final String GEL_PACKAGE_NAME = "com.google.android.googlequicksearchbox";
private static final int EDGE_GESTURE_SERVICE_RIGHT_EDGE = 4;
+ private static final int EDGE_GESTURE_SERVICE_LEFT_EDGE = 1;
private static final int EDGE_GESTURE_SERVICE_NO_EDGE = -1;
private EdgeGestureManager.EdgeGestureActivationListener mEdgeGestureActivationListener = null;
@@ -42,7 +43,7 @@ public class GelIntegrationHelper {
* 2. Starts the Google Now Activity with an exit_out_right transition animation so that
* the new Activity appears to slide in as another screen (similar to GEL).
*/
- public void registerSwipeBackGestureListenerAndStartGel(final Activity launcherActivity) {
+ public void registerSwipeBackGestureListenerAndStartGel(final Activity launcherActivity, boolean isLayoutRtl) {
EdgeGestureManager edgeGestureManager = EdgeGestureManager.getInstance();
if(mEdgeGestureActivationListener == null) {
mEdgeGestureActivationListener = new EdgeGestureManager.EdgeGestureActivationListener() {
@@ -74,8 +75,9 @@ public class GelIntegrationHelper {
edgeGestureManager.setEdgeGestureActivationListener(mEdgeGestureActivationListener);
}
mEdgeGestureActivationListener.restoreListenerState();
+ int edge = isLayoutRtl ? EDGE_GESTURE_SERVICE_LEFT_EDGE : EDGE_GESTURE_SERVICE_RIGHT_EDGE;
edgeGestureManager.updateEdgeGestureActivationListener(mEdgeGestureActivationListener,
- EDGE_GESTURE_SERVICE_RIGHT_EDGE);
+ edge);
// Start the Google Now Activity
Intent i = new Intent(INTENT_ACTION_ASSIST);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c2e0dc9d9..45e56f4be 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -640,7 +640,35 @@ public class Launcher extends Activity
/** To be overriden 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, mWorkspace.isLayoutRtl());
+ }
+ }
+
+ /**
+ * 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");
}
/**