Merge "Maintaining separate alpha for x and y translations" into ub-launcher3-calgary
diff --git a/res/drawable-ldrtl/container_fastscroll_popup_bg.xml b/res/drawable-ldrtl/container_fastscroll_popup_bg.xml
index d790968..2bbf5cd 100644
--- a/res/drawable-ldrtl/container_fastscroll_popup_bg.xml
+++ b/res/drawable-ldrtl/container_fastscroll_popup_bg.xml
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="@color/container_fastscroll_thumb_active_color" />
+ <solid android:color="?android:attr/colorAccent" />
<size
android:width="64dp"
android:height="64dp" />
diff --git a/res/drawable/container_fastscroll_popup_bg.xml b/res/drawable/container_fastscroll_popup_bg.xml
index 2ef07ab..3dc7680 100644
--- a/res/drawable/container_fastscroll_popup_bg.xml
+++ b/res/drawable/container_fastscroll_popup_bg.xml
@@ -16,7 +16,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="@color/container_fastscroll_thumb_active_color" />
+ <solid android:color="?android:attr/colorAccent" />
<size
android:width="64dp"
android:height="64dp" />
diff --git a/res/layout/all_apps_search_market.xml b/res/layout/all_apps_search_market.xml
index 4bdca99..741c96a 100644
--- a/res/layout/all_apps_search_market.xml
+++ b/res/layout/all_apps_search_market.xml
@@ -23,7 +23,7 @@
android:paddingRight="16dp"
android:fontFamily="sans-serif-medium"
android:textSize="14sp"
- android:textColor="@color/launcher_accent_color"
+ android:textColor="?android:attr/colorAccent"
android:text="@string/all_apps_search_market_message"
android:textAllCaps="true"
android:focusable="true"
diff --git a/res/layout/widget_cell.xml b/res/layout/widget_cell.xml
index 7fefeba..15f369f 100644
--- a/res/layout/widget_cell.xml
+++ b/res/layout/widget_cell.xml
@@ -21,7 +21,7 @@
android:layout_weight="1"
android:orientation="vertical"
android:focusable="true"
- android:background="@color/widgets_cell_color"
+ android:background="?android:attr/colorPrimary"
android:gravity="center_horizontal">
<LinearLayout
diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml
index b7f76a6..c0219b9 100644
--- a/res/layout/widgets_list_row_view.xml
+++ b/res/layout/widgets_list_row_view.xml
@@ -19,7 +19,7 @@
android:id="@+id/widgets_cell_list_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/widgets_cell_color"
+ android:background="?android:attr/colorPrimary"
android:orientation="vertical"
android:focusable="true"
android:descendantFocusability="afterDescendants">
diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml
index 0503466..e9bbd37 100644
--- a/res/layout/widgets_view.xml
+++ b/res/layout/widgets_view.xml
@@ -25,7 +25,8 @@
android:paddingTop="@dimen/container_bounds_inset"
android:paddingBottom="@dimen/container_bounds_inset"
android:descendantFocusability="afterDescendants"
- launcher:revealBackground="@drawable/quantum_panel_shape_dark">
+ launcher:revealBackground="@drawable/quantum_panel_shape_dark"
+ android:theme="@android:style/Theme.DeviceDefault.Settings">
<View
android:id="@+id/reveal_view"
diff --git a/res/values-v21/styles.xml b/res/values-v21/styles.xml
index aa5d0a6..8d3de01 100644
--- a/res/values-v21/styles.xml
+++ b/res/values-v21/styles.xml
@@ -24,8 +24,5 @@
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#00000000</item>
<item name="android:navigationBarColor">#00000000</item>
- <item name="android:colorControlActivated">@color/launcher_accent_color</item>
- <item name="android:colorAccent">@color/launcher_accent_color</item>
- <item name="android:colorPrimary">@color/launcher_accent_color</item>
</style>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 1329535..44e77e2 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -22,7 +22,6 @@
over the delete target or the info target -->
<color name="delete_target_hover_tint">#FFC1C1C1</color>
<color name="uninstall_target_hover_tint">#FFF0592B</color>
- <color name="info_target_hover_tint">#FF009688</color>
<color name="cling_scrim_background">#80000000</color>
<color name="focused_background">#80c6c5c5</color>
@@ -38,20 +37,11 @@
<color name="quantum_panel_bg_color_dark">#FF374248</color>
<color name="outline_color">#FFFFFFFF</color>
- <color name="launcher_accent_color">#ff009688</color>
<color name="spring_loaded_panel_color">#40FFFFFF</color>
<color name="spring_loaded_highlighted_panel_border_color">#FFF</color>
- <!-- Containers -->
- <color name="container_fastscroll_thumb_inactive_color">#009688</color>
- <color name="container_fastscroll_thumb_active_color">#009688</color>
-
- <!-- All Apps -->
- <color name="all_apps_grid_section_text_color">#009688</color>
-
<!-- Widgets view -->
<color name="widgets_view_section_text_color">#FFFFFF</color>
<color name="widgets_view_item_text_color">#C4C4C4</color>
- <color name="widgets_cell_color">#263238</color>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1b7072d..0bfd0a0 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -31,7 +31,7 @@
<style name="Theme" parent="@style/LauncherTheme"></style>
<!-- Overscroll effect -->
- <style name="CustomOverscroll.Light" parent="@android:style/Theme.DeviceDefault">
+ <style name="CustomOverscroll.Light" parent="@android:style/Theme.DeviceDefault.Light">
<item name="android:colorEdgeEffect">@color/folder_edge_effect_color</item>
</style>
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index 7c7cb0b..d7dec6e 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -50,10 +50,10 @@
public BaseContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- int width = ((Launcher) context).getDeviceProfile().availableWidthPx;
+ Launcher launcher = Launcher.getLauncher(context);
+ int width = launcher.getDeviceProfile().availableWidthPx;
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
- this instanceof AllAppsContainerView &&
- !((Launcher) context).getDeviceProfile().isLandscape) {
+ this instanceof AllAppsContainerView && launcher.getDeviceProfile().isLandscape) {
mHorizontalPadding = 0;
} else {
mHorizontalPadding = DeviceProfile.getContainerPadding(context, width);
@@ -89,4 +89,4 @@
public final View getRevealView() {
return mRevealView;
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
index fd0045e..4ab0ea3 100644
--- a/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
+++ b/src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java
@@ -81,9 +81,7 @@
mTrackPaint = new Paint();
mTrackPaint.setColor(rv.getFastScrollerTrackColor(Color.BLACK));
mTrackPaint.setAlpha(MAX_TRACK_ALPHA);
- mThumbInactiveColor = rv.getFastScrollerThumbInactiveColor(
- res.getColor(R.color.container_fastscroll_thumb_inactive_color));
- mThumbActiveColor = res.getColor(R.color.container_fastscroll_thumb_active_color);
+ mThumbActiveColor = mThumbInactiveColor = Utilities.getColorAccent(rv.getContext());
mThumbPaint = new Paint();
mThumbPaint.setAntiAlias(true);
mThumbPaint.setColor(mThumbInactiveColor);
diff --git a/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java b/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java
index ebaba18..baf96fe 100644
--- a/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java
+++ b/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java
@@ -53,7 +53,7 @@
mRes = res;
mRv = rv;
mBgOriginalSize = res.getDimensionPixelSize(R.dimen.container_fastscroll_popup_size);
- mBg = res.getDrawable(R.drawable.container_fastscroll_popup_bg);
+ mBg = rv.getContext().getDrawable(R.drawable.container_fastscroll_popup_bg);
mBg.setBounds(0, 0, mBgOriginalSize, mBgOriginalSize);
mTextPaint = new Paint();
mTextPaint.setColor(Color.WHITE);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index be00aec..3287015 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -103,7 +103,7 @@
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mLauncher = (Launcher) context;
+ mLauncher = Launcher.getLauncher(context);
DeviceProfile grid = mLauncher.getDeviceProfile();
TypedArray a = context.obtainStyledAttributes(attrs,
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 9f86a0b..5245509 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -218,4 +218,13 @@
mBackgroundColor = color;
}
}
+
+ public void setBackgroundTransparent(boolean enable) {
+ // This causes re-layout. Should replace the logic with simply setting the background alpha
+ if (enable) {
+ setBackground(null);
+ } else {
+ setBackground(mBackground);
+ }
+ }
}
diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java
index 259370c..e136bcd 100644
--- a/src/com/android/launcher3/InfoDropTarget.java
+++ b/src/com/android/launcher3/InfoDropTarget.java
@@ -43,7 +43,7 @@
protected void onFinishInflate() {
super.onFinishInflate();
// Get the hover color
- mHoverColor = getResources().getColor(R.color.info_target_hover_tint);
+ mHoverColor = Utilities.getColorAccent(getContext());
setDrawable(R.drawable.ic_info_launcher);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 156c1b0..271c69b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -38,6 +38,7 @@
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
+import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
@@ -63,6 +64,7 @@
import android.os.Message;
import android.os.StrictMode;
import android.os.SystemClock;
+import android.os.Trace;
import android.os.UserHandle;
import android.text.Selection;
import android.text.SpannableStringBuilder;
@@ -145,7 +147,6 @@
public static final String TAG = "Launcher";
static final boolean LOGD = false;
- static final boolean PROFILE_STARTUP = false;
static final boolean DEBUG_WIDGETS = false;
static final boolean DEBUG_STRICT_MODE = false;
static final boolean DEBUG_RESUME_TIME = false;
@@ -397,6 +398,9 @@
.penaltyDeath()
.build());
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Launcher-onCreate");
+ }
if (mLauncherCallbacks != null) {
mLauncherCallbacks.preOnCreate();
@@ -432,11 +436,6 @@
// LauncherModel load.
mPaused = false;
- if (PROFILE_STARTUP) {
- android.os.Debug.startMethodTracing(
- Environment.getExternalStorageDirectory() + "/launcher");
- }
-
setContentView(R.layout.launcher);
setupViews();
@@ -452,8 +451,8 @@
mSavedState = savedInstanceState;
restoreState(mSavedState);
- if (PROFILE_STARTUP) {
- android.os.Debug.stopMethodTracing();
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
}
if (!mRestoring) {
@@ -1395,6 +1394,8 @@
mDragController.addDropTarget(mWorkspace);
mDropTargetBar.setup(mDragController);
+ mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace);
+
if (TestingUtils.MEMORY_DUMP_ENABLED) {
TestingUtils.addWeightWatcher(this);
}
@@ -3584,6 +3585,9 @@
* Implementation of the method from LauncherModel.Callbacks.
*/
public void startBinding() {
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Starting page bind");
+ }
setWorkspaceLoading(true);
// Clear the workspace because it's going to be rebound
@@ -3594,6 +3598,9 @@
if (mHotseat != null) {
mHotseat.resetLayout();
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
+ }
}
@Override
@@ -3959,6 +3966,9 @@
if (waitUntilResume(r)) {
return;
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Page bind completed");
+ }
if (mSavedState != null) {
if (!mWorkspace.hasFocus()) {
mWorkspace.getChildAt(mWorkspace.getCurrentPage()).requestFocus();
@@ -3993,6 +4003,9 @@
if (mLauncherCallbacks != null) {
mLauncherCallbacks.finishBindingItems(false);
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
+ }
}
private boolean canRunNewAppsAnimation() {
@@ -4523,6 +4536,13 @@
}
}
+ public static Launcher getLauncher(Context context) {
+ if (context instanceof Launcher) {
+ return (Launcher) context;
+ }
+ return ((Launcher) ((ContextWrapper) context).getBaseContext());
+ }
+
private class RotationPrefChangeHandler implements OnSharedPreferenceChangeListener, Runnable {
@Override
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index c2e7f1a..fe65b31 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -25,6 +25,7 @@
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.UserManagerCompat;
+import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.util.ConfigMonitor;
@@ -35,6 +36,8 @@
public class LauncherAppState {
+ public static final boolean PROFILE_STARTUP = ProviderConfig.IS_DOGFOOD_BUILD;
+
private final AppFilter mAppFilter;
@Thunk final LauncherModel mModel;
private final IconCache mIconCache;
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index a5e703e..68a9c7e 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -37,6 +37,7 @@
import android.os.Parcelable;
import android.os.Process;
import android.os.SystemClock;
+import android.os.Trace;
import android.provider.BaseColumns;
import android.text.TextUtils;
import android.util.Log;
@@ -1542,6 +1543,9 @@
}
private void loadWorkspace() {
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Loading Workspace");
+ }
final long t = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;
final Context context = mContext;
@@ -2157,6 +2161,9 @@
}
}
}
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
+ }
}
/**
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 4e7d57b..f5b32ed 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -44,6 +44,7 @@
import android.os.Handler;
import android.os.Message;
import android.os.Process;
+import android.os.Trace;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;
@@ -86,6 +87,9 @@
@Override
public boolean onCreate() {
+ if (ProviderConfig.IS_DOGFOOD_BUILD) {
+ Log.d(TAG, "Launcher process started");
+ }
mListenerHandler = new Handler(mListenerWrapper);
LauncherAppState.setLauncherProvider(this);
@@ -115,6 +119,9 @@
*/
protected synchronized void createDbIfNotExists() {
if (mOpenHelper == null) {
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.beginSection("Opening workspace DB");
+ }
mOpenHelper = new DatabaseHelper(getContext(), mListenerHandler);
if (RestoreDbTask.isPending(getContext())) {
@@ -125,6 +132,10 @@
// executed again.
RestoreDbTask.setPending(getContext(), false);
}
+
+ if (LauncherAppState.PROFILE_STARTUP) {
+ Trace.endSection();
+ }
}
}
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 3511375..0306d57 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -30,6 +30,7 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -839,4 +840,11 @@
return getBitmap().getWidth();
}
}
+
+ public static int getColorAccent(Context context) {
+ TypedArray ta = context.obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
+ int colorAccent = ta.getColor(0, 0);
+ ta.recycle();
+ return colorAccent;
+ }
}
diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java
index d9bd782..45e65b5 100644
--- a/src/com/android/launcher3/WidgetPreviewLoader.java
+++ b/src/com/android/launcher3/WidgetPreviewLoader.java
@@ -584,7 +584,7 @@
// which would gets re-written next time.
mVersions = getPackageVersion(mKey.componentName.getPackageName());
- Launcher launcher = (Launcher) mCaller.getContext();
+ Launcher launcher = Launcher.getLauncher(mCaller.getContext());
// it's not in the db... we need to generate it
preview = generatePreview(launcher, mInfo, unusedBitmap, mPreviewWidth, mPreviewHeight);
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index d59058b..bd71808 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -164,7 +164,7 @@
workspaceToAllApps = (oldStateIsNormal && stateIsNormalHidden);
overviewToWorkspace = (oldStateIsOverview && stateIsNormal);
overviewToAllApps = (oldStateIsOverview && stateIsOverviewHidden);
- allAppsToWorkspace = (stateIsNormalHidden && stateIsNormal);
+ allAppsToWorkspace = (oldStateIsNormalHidden && stateIsNormal);
}
}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index b5dc0c0..cd7d3e3 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -178,7 +178,7 @@
super(context, attrs, defStyleAttr);
Resources res = context.getResources();
- mLauncher = (Launcher) context;
+ mLauncher = Launcher.getLauncher(context);
mSectionNamesMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
mApps = new AlphabeticalAppsList(context);
mAdapter = new AllAppsGridAdapter(mLauncher, mApps, this, mLauncher, this);
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index c68356e..ca2556e 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -378,7 +378,7 @@
mSectionTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mSectionTextPaint.setTextSize(res.getDimensionPixelSize(
R.dimen.all_apps_grid_section_text_size));
- mSectionTextPaint.setColor(res.getColor(R.color.all_apps_grid_section_text_color));
+ mSectionTextPaint.setColor(Utilities.getColorAccent(launcher));
mPredictedAppsDividerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPredictedAppsDividerPaint.setStrokeWidth(Utilities.pxFromDp(1f, res.getDisplayMetrics()));
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 5f34c1a..f30e08e 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -4,11 +4,9 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
-import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
-import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
@@ -40,7 +38,6 @@
private final Interpolator mAccelInterpolator = new AccelerateInterpolator(2f);
private final Interpolator mDecelInterpolator = new DecelerateInterpolator(1f);
- private final Interpolator mAccelDecelInterpolator = new AccelerateDecelerateInterpolator();
private static final float ANIMATION_DURATION = 2000;
public static final float ALL_APPS_FINAL_ALPHA = .8f;
@@ -50,8 +47,8 @@
private AllAppsContainerView mAppsView;
private Workspace mWorkspace;
private Hotseat mHotseat;
- private Drawable mHotseatBackground;
- private float mHotseatAlpha;
+ private float mHotseatBackgroundAlpha;
+
private float mStatusBarHeight;
private final Launcher mLauncher;
@@ -88,7 +85,6 @@
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
- init();
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = false;
if (mLauncher.getWorkspace().isInOverviewMode() || mLauncher.isWidgetsViewVisible()) {
@@ -139,45 +135,32 @@
return mProgressTransY / mTranslation > 1 - RECATCH_REJECTION_FRACTION;
}
- private void init() {
- if (mAppsView != null) {
- return;
- }
- mAppsView = mLauncher.getAppsView();
- mHotseat = mLauncher.getHotseat();
- mWorkspace = mLauncher.getWorkspace();
-
- mStatusBarHeight = mLauncher.getDragLayer().getInsets().height();
- if (mHotseatBackground == null) {
- mHotseatBackground = mHotseat.getBackground();
- mHotseatAlpha = mHotseatBackground.getAlpha() / 255f;
- }
- }
-
@Override
public void onScrollStart(boolean start) {
- init();
cancelAnimation();
mCurrentAnimation = LauncherAnimUtils.createAnimatorSet();
preparePull(start);
- mCurY = mAppsView.getTranslationY();
}
/**
* @param start {@code true} if start of new drag.
*/
public void preparePull(boolean start) {
+ // Initialize values that should not change until #onScrollEnd
+ mCurY = mAppsView.getTranslationY();
+ mStatusBarHeight = mLauncher.getDragLayer().getInsets().top;
mHotseat.setVisibility(View.VISIBLE);
mHotseat.bringToFront();
if (start) {
if (!mLauncher.isAllAppsVisible()) {
mLauncher.tryAndUpdatePredictedApps();
- mHotseat.setBackground(null);
+ mHotseatBackgroundAlpha = mHotseat.getBackground().getAlpha() / 255f;
+ mHotseat.setBackgroundTransparent(true /* transparent */);
mAppsView.setVisibility(View.VISIBLE);
mAppsView.getContentView().setVisibility(View.VISIBLE);
mAppsView.getContentView().setBackground(null);
mAppsView.getRevealView().setVisibility(View.VISIBLE);
- mAppsView.getRevealView().setAlpha(mHotseatAlpha);
+ mAppsView.getRevealView().setAlpha(mHotseatBackgroundAlpha);
DeviceProfile grid= mLauncher.getDeviceProfile();
if (!grid.isLandscape) {
@@ -236,7 +219,7 @@
float alpha = calcAlphaAllApps(progress);
float workspaceHotseatAlpha = 1 - alpha;
- mAppsView.getRevealView().setAlpha(Math.min(ALL_APPS_FINAL_ALPHA, Math.max(mHotseatAlpha,
+ mAppsView.getRevealView().setAlpha(Math.min(ALL_APPS_FINAL_ALPHA, Math.max(mHotseatBackgroundAlpha,
mDecelInterpolator.getInterpolation(alpha))));
mAppsView.getContentView().setAlpha(alpha);
mAppsView.setTranslationY(progress);
@@ -293,7 +276,7 @@
}
public void animateToAllApps(AnimatorSet animationOut, long duration) {
- if ((mAppsView = mLauncher.getAppsView()) == null || animationOut == null){
+ if (animationOut == null){
return;
}
if (mDetector.isRestingState()) {
@@ -331,7 +314,7 @@
}
public void animateToWorkspace(AnimatorSet animationOut, long duration) {
- if ((mAppsView = mLauncher.getAppsView()) == null || animationOut == null){
+ if (animationOut == null){
return;
}
if(mDetector.isRestingState()) {
@@ -383,7 +366,7 @@
return;
}
mAppsView.setVisibility(View.INVISIBLE);
- mHotseat.setBackground(mHotseatBackground);
+ mHotseat.setBackgroundTransparent(false /* transparent */);
mHotseat.setVisibility(View.VISIBLE);
setProgress(mTranslation);
if (!mStateAlreadyChanged) {
@@ -402,4 +385,10 @@
private void cleanUpAnimation() {
mCurrentAnimation = null;
}
+
+ public void setupViews(AllAppsContainerView appsView, Hotseat hotseat, Workspace workspace) {
+ mAppsView = appsView;
+ mHotseat = hotseat;
+ mWorkspace = workspace;
+ }
}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index 99af93b..747c21b 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -123,7 +123,7 @@
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
setOutlineProvider(new MyOutlineProver());
- mActiveColor = getResources().getColor(R.color.launcher_accent_color);
+ mActiveColor = Utilities.getColorAccent(context);
mInActiveColor = getResources().getColor(R.color.page_indicator_dot_color);
mIsRtl = Utilities.isRtl(getResources());
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index ad32f92..97877fd 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -88,7 +88,7 @@
super(context, attrs, defStyle);
final Resources r = context.getResources();
- mLauncher = (Launcher) context;
+ mLauncher = Launcher.getLauncher(context);
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
setContainerWidth();
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index a76f0af..8a58d34 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -82,9 +82,9 @@
public WidgetsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mLauncher = (Launcher) context;
+ mLauncher = Launcher.getLauncher(context);
mDragController = mLauncher.getDragController();
- mAdapter = new WidgetsListAdapter(this, this, mLauncher);
+ mAdapter = new WidgetsListAdapter(this, this, context);
mIconCache = (LauncherAppState.getInstance()).getIconCache();
if (LOGD) {
Log.d(TAG, "WidgetsContainerView constructor");
diff --git a/src/com/android/launcher3/widget/WidgetsListAdapter.java b/src/com/android/launcher3/widget/WidgetsListAdapter.java
index e68450d..6b8ea49 100644
--- a/src/com/android/launcher3/widget/WidgetsListAdapter.java
+++ b/src/com/android/launcher3/widget/WidgetsListAdapter.java
@@ -16,6 +16,7 @@
package com.android.launcher3.widget;
import android.annotation.TargetApi;
+import android.content.Context;
import android.os.Build;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
@@ -27,7 +28,6 @@
import android.widget.LinearLayout;
import com.android.launcher3.BubbleTextView;
-import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -63,13 +63,13 @@
public WidgetsListAdapter(View.OnClickListener iconClickListener,
View.OnLongClickListener iconLongClickListener,
- Launcher launcher) {
- mLayoutInflater = launcher.getLayoutInflater();
+ Context context) {
+ mLayoutInflater = LayoutInflater.from(context);
mWidgetPreviewLoader = LauncherAppState.getInstance().getWidgetCache();
mIconClickListener = iconClickListener;
mIconLongClickListener = iconLongClickListener;
- mIndent = launcher.getResources().getDimensionPixelSize(R.dimen.widget_section_indent);
+ mIndent = context.getResources().getDimensionPixelSize(R.dimen.widget_section_indent);
}
public void setWidgetsModel(WidgetsModel w) {