diff options
author | Matt Garnes <matt@cyngn.com> | 2014-06-20 13:39:50 -0700 |
---|---|---|
committer | Raj Yengisetty <rajesh@cyngn.com> | 2015-07-24 19:30:15 -0700 |
commit | 9431c89974fb4c119da5e53bcdef5c5f8b390652 (patch) | |
tree | 121ed40c244f545f571c0220bacb867c0352ca95 /src/com/android/launcher3/Launcher.java | |
parent | 0c5f6f6dc6c5e6948ff5683fa8ed38ed956f457c (diff) | |
download | packages_apps_Trebuchet-9431c89974fb4c119da5e53bcdef5c5f8b390652.tar.gz packages_apps_Trebuchet-9431c89974fb4c119da5e53bcdef5c5f8b390652.tar.bz2 packages_apps_Trebuchet-9431c89974fb4c119da5e53bcdef5c5f8b390652.zip |
Add support for CMHome (1/2)
Add permission for DashClock extensions.
Change Trebuchet to allow viewing additional screen.
Add setting that to configure Google Now / CMHome.
Change-Id: I63286a2cce87455ed411bd4c77680200eec89be7
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 78 |
1 files changed, 73 insertions, 5 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 45e56f4be..6ad36a21a 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -61,7 +61,6 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Point; import android.graphics.PorterDuff; -import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -421,6 +420,34 @@ public class Launcher extends Activity AppWidgetProviderInfo mSearchWidgetInfo; AppWidgetHostView mSearchViewHost; + public enum CustomContentMode { + DISABLED(0), + GEL(1), + CUSTOM_HOME(2); + + private final int mValue; + private CustomContentMode(int value) { + mValue = value; + } + + public int getValue() { + return mValue; + } + + public static CustomContentMode getModeForValue(int value) { + switch (value) { + case 0: + return DISABLED; + case 1: + return GEL; + default : + return CUSTOM_HOME; + } + } + } + + private CustomContentMode mCustomContentMode = CustomContentMode.CUSTOM_HOME; + // Preferences private boolean mHideIconLabels; private AppDrawerListAdapter.DrawerType mDrawerType; @@ -550,6 +577,8 @@ public class Launcher extends Activity mSavedState = savedInstanceState; restoreState(mSavedState); + restoreCustomContentMode(); + if (PROFILE_STARTUP) { android.os.Debug.stopMethodTracing(); } @@ -593,6 +622,13 @@ public class Launcher extends Activity @Override public void onLauncherProviderChange() { } + public void restoreCustomContentMode() { + mCustomContentMode = CustomContentMode.getModeForValue( + SettingsProvider.getIntCustomDefault(this, + SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH_PANEL_LEFT, + CustomContentMode.DISABLED.getValue())); + } + private void initializeDynamicGrid(boolean updateGrid) { if (!updateGrid) { LauncherAppState.setApplicationContext(getApplicationContext()); @@ -607,6 +643,8 @@ public class Launcher extends Activity SettingsProvider.SETTINGS_UI_DRAWER_TYPE, R.integer.preferences_interface_drawer_type_default)); + restoreCustomContentMode(); + // Determine the dynamic grid properties Point smallestSize = new Point(); Point largestSize = new Point(); @@ -640,7 +678,23 @@ public class Launcher extends Activity /** To be overriden by subclasses to hint to Launcher that we have custom content */ protected boolean hasCustomContentToLeft() { - return isGelIntegrationSupported() && isGelIntegrationEnabled(); + switch(getCustomContentMode()) { + case GEL: + return isGelIntegrationSupported(); + case CUSTOM_HOME: + return isCustomHomeActive(); + default: + return false; + } + } + + /** + * Returns true if the custom home application is initialized and ready + * for the user to scroll to it. To be implemented by subclasses. + * @return True if the custom home view is initialized. + */ + protected boolean isCustomHomeActive() { + return false; } public boolean isGelIntegrationSupported() { @@ -653,12 +707,16 @@ public class Launcher extends Activity return globalSearchActivity != null && isCM(); } - public boolean isGelIntegrationEnabled() { - return mGelIntegrationEnabled; + public CustomContentMode getCustomContentMode() { + return mCustomContentMode; + } + + public void setCustomContentMode(CustomContentMode customContentMode) { + mCustomContentMode = customContentMode; } public void onCustomContentLaunch() { - if(isGelIntegrationEnabled() && isGelIntegrationSupported()) { + if(isCustomContentModeGel() && isGelIntegrationSupported()) { GelIntegrationHelper.getInstance().registerSwipeBackGestureListenerAndStartGel(this, mWorkspace.isLayoutRtl()); } } @@ -1181,6 +1239,12 @@ public class Launcher extends Activity } super.onResume(); + updateGridIfNeeded(); + + if(isCustomContentModeGel() && isGelIntegrationSupported()) { + GelIntegrationHelper.getInstance().handleGelResume(); + } + // Restore the previous launcher state if (mOnResumeState == State.WORKSPACE) { showWorkspace(false); @@ -1334,6 +1398,10 @@ public class Launcher extends Activity } } + protected boolean isCustomContentModeGel() { + return mCustomContentMode == CustomContentMode.GEL; + } + public interface CustomContentCallbacks { // Custom content is completely shown. {@code fromResume} indicates whether this was caused // by a onResume or by scrolling otherwise. |