summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2014-06-12 15:07:36 -0700
committerMatt Garnes <matt@cyngn.com>2014-06-17 19:02:28 -0700
commit8ca6c2a3d078aab3746a59a123b5a100bca6a2df (patch)
tree10649ceed0f93812ec7574af178aafb68c581d13 /src
parent56db21e5af4c17f9308ceb07b0f3ab651743b5cd (diff)
downloadandroid_packages_apps_Trebuchet-8ca6c2a3d078aab3746a59a123b5a100bca6a2df.tar.gz
android_packages_apps_Trebuchet-8ca6c2a3d078aab3746a59a123b5a100bca6a2df.tar.bz2
android_packages_apps_Trebuchet-8ca6c2a3d078aab3746a59a123b5a100bca6a2df.zip
Add a custom home screen to Trebuchet.
Scrolling to the left will now open a custom home screen that can be used to display information provided by the system or third parties via an API. Change-Id: I62991c0634b686ca875d04fa118695050731ba7e
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/GelIntegrationHelper.java4
-rw-r--r--src/com/android/launcher3/Workspace.java21
-rw-r--r--src/org/cyanogenmod/trebuchet/TrebuchetLauncher.java19
3 files changed, 28 insertions, 16 deletions
diff --git a/src/com/android/launcher3/GelIntegrationHelper.java b/src/com/android/launcher3/GelIntegrationHelper.java
index abda537a2..6dd9c0e32 100644
--- a/src/com/android/launcher3/GelIntegrationHelper.java
+++ b/src/com/android/launcher3/GelIntegrationHelper.java
@@ -63,10 +63,10 @@ public class GelIntegrationHelper {
if(GEL_ACTIVITY.equals(topActivityClassName)
&& GEL_PACKAGE_NAME.equals(topActivityPackageName)) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
- homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
homeIntent.addCategory(Intent.CATEGORY_HOME);
launcherActivity.startActivity(homeIntent);
- launcherActivity.overridePendingTransition(0, R.anim.exit_out_left);
+ launcherActivity.overridePendingTransition(0, 0);
dropEventsUntilLift();
}
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 008dc1527..c67ca9395 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1255,7 +1255,8 @@ public class Workspace extends SmoothPagedView
super.notifyPageSwitchListener();
Launcher.setScreen(getNextPage());
- if (hasCustomContent() && getNextPage() == 0 && !mCustomContentShowing) {
+ int ccIndex = getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID);
+ if (hasCustomContent() && getNextPage() == ccIndex && !mCustomContentShowing) {
mCustomContentShowing = true;
if (mCustomContentCallbacks != null) {
@@ -1263,7 +1264,7 @@ public class Workspace extends SmoothPagedView
mCustomContentShowTime = System.currentTimeMillis();
mLauncher.updateVoiceButtonProxyVisible(false);
}
- } else if (hasCustomContent() && mCustomContentShowing) {
+ } else if (hasCustomContent() && getNextPage() != ccIndex && mCustomContentShowing) {
mCustomContentShowing = false;
if (mCustomContentCallbacks != null) {
mCustomContentCallbacks.onHide();
@@ -1826,12 +1827,17 @@ public class Workspace extends SmoothPagedView
// them
mLastSetWallpaperOffsetSteps = 0f;
+ moveAwayFromCustomContentIfRequired();
+ }
+
+ public void moveAwayFromCustomContentIfRequired() {
// Never resume to the custom page if GEL integration is enabled.
int customPageIndex = getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID);
// mCustomContentShowing can be lost if the Activity is recreated,
// So make sure it is set to the right value.
mCustomContentShowing = mCustomContentShowing
- || (customPageIndex == getCurrentPage() && hasCustomContent());
+ || (customPageIndex == getCurrentPage()
+ && hasCustomContent());
if (mCustomContentShowing && mLauncher.isGelIntegrationEnabled()) {
moveToScreen((customPageIndex + 1), true);
}
@@ -1844,6 +1850,8 @@ public class Workspace extends SmoothPagedView
mWallpaperOffset.jumpToFinal();
}
super.onLayout(changed, left, top, right, bottom);
+
+ moveAwayFromCustomContentIfRequired();
}
@Override
@@ -4187,7 +4195,12 @@ public class Workspace extends SmoothPagedView
}
public int getCurrentPageOffsetFromCustomContent() {
- return getNextPage() - numCustomPages();
+ int numCustomPages = numCustomPages();
+ // Special case where the Gel Integration page must be counted below
+ if(mLauncher.isGelIntegrationEnabled() && mLauncher.isGelIntegrationSupported()) {
+ numCustomPages += 1;
+ }
+ return getNextPage() - numCustomPages;
}
/**
diff --git a/src/org/cyanogenmod/trebuchet/TrebuchetLauncher.java b/src/org/cyanogenmod/trebuchet/TrebuchetLauncher.java
index 12e04cb16..ec91e10d7 100644
--- a/src/org/cyanogenmod/trebuchet/TrebuchetLauncher.java
+++ b/src/org/cyanogenmod/trebuchet/TrebuchetLauncher.java
@@ -38,11 +38,16 @@ import com.android.launcher3.R;
import org.cyanogenmod.trebuchet.home.HomeUtils;
import org.cyanogenmod.trebuchet.home.HomeWrapper;
+import java.lang.Override;
+
public class TrebuchetLauncher extends Launcher {
private static final String TAG = "TrebuchetLauncher";
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
+ private static final float MIN_PROGRESS = 0;
+ private static final float MAX_PROGRESS = 1;
+
private static class HomeAppStub {
private final int mUid;
@@ -112,7 +117,6 @@ public class TrebuchetLauncher extends Launcher {
private CustomContentCallbacks mCustomContentCallbacks = new CustomContentCallbacks() {
@Override
public void onShow() {
- updateQsbBarColorState(0);
if (mCurrentHomeApp != null) {
mCurrentHomeApp.mInstance.onShow();
}
@@ -128,7 +132,6 @@ public class TrebuchetLauncher extends Launcher {
@Override
public void onHide() {
- updateQsbBarColorState(255);
if (mCurrentHomeApp != null) {
mCurrentHomeApp.mInstance.onHide();
}
@@ -153,7 +156,7 @@ public class TrebuchetLauncher extends Launcher {
mQsbInitialAlphaState = res.getInteger(R.integer.qsb_initial_alpha_state);
mQsbEndAlphaState = res.getInteger(R.integer.qsb_end_alpha_state);
mQsbButtonsEndColorFilter = res.getInteger(R.integer.qsb_buttons_end_colorfilter);
- updateQsbBarColorState(0);
+ updateQsbBarColorState(MIN_PROGRESS);
// Obtain the user-defined Home app or a valid one
obtainCurrentHomeAppStubLocked(true);
@@ -195,7 +198,7 @@ public class TrebuchetLauncher extends Launcher {
@Override
protected boolean hasCustomContentToLeft() {
- return mCurrentHomeApp != null;
+ return mCurrentHomeApp != null && super.hasCustomContentToLeft();
}
@Override
@@ -205,7 +208,7 @@ public class TrebuchetLauncher extends Launcher {
}
@Override
- protected void addCustomContentToLeft() {
+ protected void populateCustomContentContainer() {
if (mCurrentHomeApp != null) {
mQsbScroller = addToCustomContentPage(mCurrentHomeApp.mInstance.createCustomView(),
mCustomContentCallbacks, mCurrentHomeApp.mInstance.getName());
@@ -316,16 +319,12 @@ public class TrebuchetLauncher extends Launcher {
if (voiceButton != null) {
if (progress > 0) {
voiceButton.setColorFilter(color, PorterDuff.Mode.SRC_IN);
- } else {
- voiceButton.clearColorFilter();
}
}
ImageView searchButton = getQsbBarSearchButton();
if (searchButton != null) {
if (progress > 0) {
searchButton.setColorFilter(color, PorterDuff.Mode.SRC_IN);
- } else {
- searchButton.clearColorFilter();
}
}
}