diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-02-26 17:02:14 -0800 |
---|---|---|
committer | Raj Yengisetty <rajesh@cyngn.com> | 2015-03-06 15:37:44 -0800 |
commit | f4784dd14191cbc433becaa651b2a92fa5950f47 (patch) | |
tree | ee392e838b3c84146e30dc579c34c578975c1578 | |
parent | d9324529ed3b5dcd23f10f1c147b783725deedee (diff) | |
download | packages_apps_Trebuchet-f4784dd14191cbc433becaa651b2a92fa5950f47.tar.gz packages_apps_Trebuchet-f4784dd14191cbc433becaa651b2a92fa5950f47.tar.bz2 packages_apps_Trebuchet-f4784dd14191cbc433becaa651b2a92fa5950f47.zip |
Trebuchet: App Drawer - clean up open/close animations
Change-Id: Ia1bcaec9cf5bdcd9ca61137aa45f91819fb2e94d
-rw-r--r-- | res/drawable/empty_seek_bar.xml | 19 | ||||
-rw-r--r-- | res/drawable/scrubber_back.xml | 3 | ||||
-rw-r--r-- | res/drawable/seek_back.xml | 21 | ||||
-rw-r--r-- | res/layout/app_drawer_container.xml | 47 | ||||
-rw-r--r-- | res/layout/app_drawer_item.xml | 4 | ||||
-rw-r--r-- | res/layout/scrub_layout.xml | 86 | ||||
-rw-r--r-- | res/values/colors.xml | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/AppDrawerListAdapter.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/AppDrawerScrubber.java | 97 | ||||
-rw-r--r-- | src/com/android/launcher3/DragLayer.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 77 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 2 |
12 files changed, 232 insertions, 149 deletions
diff --git a/res/drawable/empty_seek_bar.xml b/res/drawable/empty_seek_bar.xml new file mode 100644 index 000000000..e3cf61d64 --- /dev/null +++ b/res/drawable/empty_seek_bar.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#00000000"/> +</shape>
\ No newline at end of file diff --git a/res/drawable/scrubber_back.xml b/res/drawable/scrubber_back.xml index 56cf5af73..c5022dec5 100644 --- a/res/drawable/scrubber_back.xml +++ b/res/drawable/scrubber_back.xml @@ -15,6 +15,5 @@ limitations under the License. --> <shape xmlns:android="http://schemas.android.com/apk/res/android"> - <solid android:color="#99333333"/> - <corners android:radius="5dip"/> + <solid android:color="@color/scrubber_background"/> </shape> diff --git a/res/drawable/seek_back.xml b/res/drawable/seek_back.xml index a49796c05..d97a870ea 100644 --- a/res/drawable/seek_back.xml +++ b/res/drawable/seek_back.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2014 The CyanogenMod Project + Copyright (C) 2015 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,8 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. --> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="line"> - <stroke android:width="4dp" android:color="#FFF"/> - <size android:height="2dp" /> -</shape> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="360dp" + android:height="48dp" + android:viewportWidth="360" + android:viewportHeight="48"> + + <path + android:strokeColor="#FFFFFF" + android:strokeWidth="2" + android:strokeMiterLimit="10" + android:strokeLineCap="round" + android:pathData="M16,24h328" /> +</vector>
\ No newline at end of file diff --git a/res/layout/app_drawer_container.xml b/res/layout/app_drawer_container.xml index c0eb97a99..3706e448d 100644 --- a/res/layout/app_drawer_container.xml +++ b/res/layout/app_drawer_container.xml @@ -31,4 +31,51 @@ android:visibility="invisible" android:clipToPadding="false" /> </FrameLayout> + <FrameLayout + android:id="@+id/app_drawer_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipChildren="false" + android:clipToPadding="false"> + <android.support.v7.widget.RecyclerView + android:id="@+id/app_drawer_recyclerview" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" + android:overScrollMode="never"/> + </FrameLayout> + + <RelativeLayout + android:id="@+id/scrubber_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:clipToPadding="false"> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_below="@+id/scrubberIndicator" + android:background="@drawable/scrubber_back" + android:clipToPadding="false"> + + <com.android.launcher3.AppDrawerScrubber + android:id="@+id/app_drawer_scrubber" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom"/> + </FrameLayout> + + <TextView + android:id="@+id/scrubberIndicator" + android:background="@drawable/letter_indicator" + android:layout_width="80dp" + android:textSize="30sp" + android:gravity="center" + android:textColor="@android:color/white" + android:clickable="false" + android:layout_marginBottom="-20dp" + android:visibility="invisible" + android:layout_height="100dp" /> + </RelativeLayout> </FrameLayout>
\ No newline at end of file diff --git a/res/layout/app_drawer_item.xml b/res/layout/app_drawer_item.xml index 37bdeea6a..e2d105f5a 100644 --- a/res/layout/app_drawer_item.xml +++ b/res/layout/app_drawer_item.xml @@ -34,7 +34,9 @@ android:gravity="start|top" android:singleLine="true" autofit:minTextSize="8sp" - android:textSize="35sp" + android:textSize="24sp" + android:layout_gravity="center" + android:fontFamily="sans-serif-light" android:textColor="@android:color/white"/> <LinearLayout android:id="@+id/drawer_item_flow" diff --git a/res/layout/scrub_layout.xml b/res/layout/scrub_layout.xml index e8761e306..4b10e45d7 100644 --- a/res/layout/scrub_layout.xml +++ b/res/layout/scrub_layout.xml @@ -15,86 +15,30 @@ limitations under the License. --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" + android:id="@+id/app_drawer_scrubber_container" android:layout_width="match_parent" - android:layout_marginRight="20dp" - android:layout_marginLeft="20dp" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:background="@drawable/seek_back" + android:layout_alignParentBottom="true"> <LinearLayout android:clickable="true" - android:layout_marginTop="-5dp" - android:layout_below="@+id/scrubberIndicator" android:orientation="horizontal" - android:background="@drawable/scrubber_back" android:layout_width="match_parent" - android:layout_height="50dp"> - - <Space - android:layout_weight="0.1" - android:layout_width="0dp" - android:layout_height="match_parent" /> - - <TextView - android:id="@+id/firstSection" - android:gravity="center" - android:textColor="@android:color/white" - android:paddingRight="10dp" - android:textStyle="bold" - style="?android:attr/textAppearanceLarge" - android:layout_width="wrap_content" - android:layout_height="match_parent" /> - - <LinearLayout - android:layout_weight="0.9" - android:layout_width="0dp" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" + android:layout_height="48dp"> + + <SeekBar + android:id="@+id/scrubber" + android:paddingLeft="0dp" + android:paddingRight="0dp" + android:thumb="@android:color/transparent" + android:progressDrawable="@drawable/empty_seek_bar" + android:layout_width="match_parent" android:layout_gravity="center" - android:orientation="vertical" - android:layout_height="match_parent"> - - <SeekBar - android:id="@+id/scrubber" - android:paddingLeft="0dp" - android:paddingRight="0dp" - android:layout_marginRight="-10dp" - android:layout_marginLeft="-10dp" - android:thumb="@android:color/transparent" - android:thumbOffset="-10dp" - android:progressDrawable="@drawable/seek_back" - android:layout_width="match_parent" - android:layout_gravity="center" - android:layout_height="match_parent" /> - - </LinearLayout> - - - <TextView - android:gravity="center" - android:id="@+id/lastSection" - android:paddingLeft="10dp" - android:textColor="@android:color/white" - android:textStyle="bold" - style="?android:attr/textAppearanceLarge" - android:layout_width="wrap_content" - android:layout_height="match_parent" /> - - <Space - android:layout_weight="0.1" - android:layout_width="0dp" android:layout_height="match_parent" /> </LinearLayout> - <TextView - android:id="@+id/scrubberIndicator" - android:background="@drawable/letter_indicator" - android:layout_width="80dp" - android:textSize="30sp" - android:gravity="center" - android:textColor="@android:color/white" - android:clickable="false" - android:layout_marginBottom="-20dp" - android:visibility="invisible" - android:layout_height="100dp" /> - </RelativeLayout> diff --git a/res/values/colors.xml b/res/values/colors.xml index 948801f5b..3cf7d39a6 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -49,4 +49,8 @@ <color name="dynamic_grid_preview_background">#FFFFFFFF</color> <color name="dynamic_grid_preview_foreground">#FF000000</color> + + <color name="app_drawer_background">#76000000</color> + + <color name="scrubber_background">#CC14191E</color> </resources> diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java index 891c32357..9c97642f6 100644 --- a/src/com/android/launcher3/AppDrawerListAdapter.java +++ b/src/com/android/launcher3/AppDrawerListAdapter.java @@ -296,6 +296,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap inflate(R.layout.app_drawer_item, parent, false); ViewHolder holder = new ViewHolder(v); holder.mSpacer.setLayoutParams(mSpacerParams); + holder.mTextView.setPadding(0, 0, 0, mDeviceProfile.iconTextSizePx + 10); for (int i = 0; i < mDeviceProfile.numColumnsBase; i++) { AppDrawerIconView icon = (AppDrawerIconView) mLayoutInflater.inflate( R.layout.drawer_icon, holder.mLayout, false); diff --git a/src/com/android/launcher3/AppDrawerScrubber.java b/src/com/android/launcher3/AppDrawerScrubber.java index 41c3199b5..dff02661a 100644 --- a/src/com/android/launcher3/AppDrawerScrubber.java +++ b/src/com/android/launcher3/AppDrawerScrubber.java @@ -19,50 +19,40 @@ package com.android.launcher3; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; -import android.util.AttributeSet; -import android.support.v7.widget.RecyclerView; import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.ListAdapter; -import android.widget.ListView; -import android.widget.SectionIndexer; import android.widget.SeekBar; import android.widget.TextView; -public class AppDrawerScrubber extends LinearLayout implements OnClickListener { +public class AppDrawerScrubber extends LinearLayout { private final int SCRUBBER_INDICATOR_DISPLAY_DURATION = 200; private final float SCRUBBER_INDICATOR_DISPLAY_TRANSLATIONY = 20f; private AppDrawerListAdapter mAdapter; private RecyclerView mListView; - private TextView mFirstIndicator, mLastIndicator; private TextView mScrubberIndicator; private SeekBar mSeekBar; private String[] mSections; private LinearLayoutManager mLayoutManager; + public AppDrawerScrubber(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + public AppDrawerScrubber(Context context) { super(context); - LayoutInflater.from(context).inflate(R.layout.scrub_layout, this); - mFirstIndicator = ((TextView) findViewById(R.id.firstSection)); - mFirstIndicator.setOnClickListener(this); - mLastIndicator = ((TextView) findViewById(R.id.lastSection)); - mLastIndicator.setOnClickListener(this); - mScrubberIndicator = (TextView) findViewById(R.id.scrubberIndicator); - mSeekBar = (SeekBar) findViewById(R.id.scrubber); - init(); + init(context); } public void updateSections() { mSections = (String[]) mAdapter.getSections(); mSeekBar.setMax(mSections.length - 1); - mFirstIndicator.setText(mSections[0]); - mLastIndicator.setText(mSections[mSections.length - 1]); } public void setSource(RecyclerView listView) { @@ -71,13 +61,20 @@ public class AppDrawerScrubber extends LinearLayout implements OnClickListener { mLayoutManager = (LinearLayoutManager) listView.getLayoutManager(); } + public void setScrubberIndicator(TextView scrubberIndicator) { + mScrubberIndicator = scrubberIndicator; + } + private boolean isReady() { return mListView != null && mAdapter != null && mSections != null; } - private void init() { + private void init(Context context) { + LayoutInflater.from(context).inflate(R.layout.scrub_layout, this); + mSeekBar = (SeekBar) findViewById(R.id.scrubber); + mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromUser) { @@ -85,57 +82,49 @@ public class AppDrawerScrubber extends LinearLayout implements OnClickListener { return; } resetScrubber(); - mScrubberIndicator.setTranslationX((progress * seekBar.getWidth()) / - mSections.length); + String section = String.valueOf(mSections[progress]); + + if (mScrubberIndicator != null) { + float translateX = (progress * seekBar.getWidth()) / mSections.length; + translateX -= (mScrubberIndicator.getWidth() / 6); // offset for alignment + mScrubberIndicator.setTranslationX(translateX); + mScrubberIndicator.setText(section); + } + mLayoutManager.scrollToPositionWithOffset( mAdapter.getPositionForSection(progress), 0); - mScrubberIndicator.setText(section); } @Override public void onStartTrackingTouch(SeekBar seekBar) { - if (!isReady()) { - return; - } resetScrubber(); - mScrubberIndicator.setAlpha(1f); - mScrubberIndicator.setVisibility(View.VISIBLE); + if (mScrubberIndicator != null) { + mScrubberIndicator.setAlpha(1f); + mScrubberIndicator.setVisibility(View.VISIBLE); + } } @Override public void onStopTrackingTouch(SeekBar seekBar) { - if (!isReady()) { - return; - } resetScrubber(); - mScrubberIndicator.animate() - .alpha(0f) - .translationYBy(SCRUBBER_INDICATOR_DISPLAY_TRANSLATIONY) - .setDuration(SCRUBBER_INDICATOR_DISPLAY_DURATION) - .setListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mScrubberIndicator.setVisibility(View.INVISIBLE); - } - }); + if (mScrubberIndicator != null) { + mScrubberIndicator.animate().alpha(0f).translationYBy(20f) + .setDuration(200).setListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mScrubberIndicator.setVisibility(View.INVISIBLE); + } + }); } + } private void resetScrubber() { - mScrubberIndicator.animate().cancel(); - mScrubberIndicator.setTranslationY(0f); + if (mScrubberIndicator != null) { + mScrubberIndicator.animate().cancel(); + mScrubberIndicator.setTranslationY(0f); + } } }); } - - @Override - public void onClick(View v) { - if (v == mFirstIndicator) { - int positionForFirstSection = mAdapter.getPositionForSection(0); - mLayoutManager.scrollToPositionWithOffset(positionForFirstSection, 0); - } else if (v == mLastIndicator) { - int positionForLastSection = mAdapter.getPositionForSection(mSections.length - 1); - mLayoutManager.scrollToPositionWithOffset(positionForLastSection, 0); - } - } }
\ No newline at end of file diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java index 691b09558..e28f00189 100644 --- a/src/com/android/launcher3/DragLayer.java +++ b/src/com/android/launcher3/DragLayer.java @@ -135,6 +135,10 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang lp.bottomMargin += insets.bottom - mInsets.bottom; layout.setLayoutParams(lp); continue; + } else if (child.getId() == R.id.app_drawer_container) { + setAppDrawerInsets(child, insets); + + continue; } setInsets(child, insets, mInsets); if (child.getId() == R.id.search_drop_target_bar) { @@ -145,6 +149,22 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang return true; // I'll take it from here } + private void setAppDrawerInsets(View child, Rect insets) { + // List view + View view = child.findViewById(R.id.app_drawer_recyclerview); + FrameLayout.LayoutParams lp = + (FrameLayout.LayoutParams) view.getLayoutParams(); + lp.bottomMargin += insets.bottom - mInsets.bottom; + lp.topMargin += insets.top - mInsets.top; + view.setLayoutParams(lp); + + // Scrubber + view = child.findViewById(R.id.app_drawer_scrubber_container); + LinearLayout.LayoutParams llp = (LinearLayout.LayoutParams) view.getLayoutParams(); + llp.bottomMargin += insets.bottom - mInsets.bottom; + view.setLayoutParams(llp); + } + Rect getInsets() { return mInsets; } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d2ba9d28e..56a757b60 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -100,6 +100,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; +import android.view.animation.OvershootInterpolator; import android.view.inputmethod.InputMethodManager; import android.widget.Advanceable; import android.widget.FrameLayout; @@ -168,6 +169,8 @@ public class Launcher extends Activity private static final int REQUEST_RECONFIGURE_APPWIDGET = 12; public static final int REQUEST_TRANSITION_EFFECTS = 14; + private static final float OVERSHOOT_TENSION = 1.4f; + static final int REQUEST_PICK_ICON = 13; private static final int REQUEST_LOCK_PATTERN = 14; @@ -603,12 +606,10 @@ public class Launcher extends Activity private void initializeScrubber() { if (mScrubber == null) { - mScrubber = new AppDrawerScrubber(this); - int scrubberPadding = getResources() - .getDimensionPixelSize(R.dimen.scrubber_bottom_padding); - mScrubber.setPadding(0, 0, 0, scrubberPadding); - mScrubber.setGravity(Gravity.BOTTOM); + FrameLayout view = (FrameLayout) findViewById(R.id.app_drawer_container); + mScrubber = (AppDrawerScrubber) view.findViewById(R.id.app_drawer_scrubber); mScrubber.setSource(mAppDrawer); + mScrubber.setScrubberIndicator((TextView) view.findViewById(R.id.scrubberIndicator)); } } @@ -1700,16 +1701,14 @@ public class Launcher extends Activity private void setupAppDrawer() { if (mAppDrawer == null) { FrameLayout view = (FrameLayout) findViewById(R.id.app_drawer_container); - mAppDrawer = new RecyclerView(this); + mAppDrawer = (RecyclerView) view.findViewById(R.id.app_drawer_recyclerview); mAppDrawer.setLayoutManager(new LinearLayoutManager(this)); if (mAppDrawerAdapter == null) { initializeAdapter(); } mAppDrawer.setHasFixedSize(true); mAppDrawer.setAdapter(mAppDrawerAdapter); - view.addView(mAppDrawer); initializeScrubber(); - view.addView(mScrubber); } } @@ -3641,7 +3640,7 @@ public class Launcher extends Activity final View toView; if (contentType == AppsCustomizePagedView.ContentType.Applications) { - toView = (FrameLayout) findViewById(R.id.app_drawer_container); + toView = findViewById(R.id.app_drawer_container); } else { toView = mAppsCustomizeTabHost; } @@ -3666,17 +3665,24 @@ public class Launcher extends Activity final AppsCustomizePagedView content = (AppsCustomizePagedView) toView.findViewById(R.id.apps_customize_pane_content); - final View page = content != null ? content.getPageAt(content.getCurrentPage()) : null; + final View page = content != null ? content.getPageAt(content.getCurrentPage()) + : toView.findViewById(R.id.app_drawer_view); final View revealView = toView.findViewById(R.id.fake_page); final float initialPanelAlpha = 1f; final boolean isWidgetTray = contentType == AppsCustomizePagedView.ContentType.Widgets; - revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark)); + if (isWidgetTray) { + revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark)); + } else { + revealView.setBackgroundColor(res.getColor(R.color.app_drawer_background)); + } // Hide the real page background, and swap in the fake one if (content != null) { content.setPageBackgroundsVisible(false); + } else { + toView.setBackgroundColor(Color.TRANSPARENT); } revealView.setVisibility(View.VISIBLE); // We need to hide this view as the animation start will be posted. @@ -3722,6 +3728,11 @@ public class Launcher extends Activity mStateAnimation.play(panelAlphaAndDrift); + final View drawerContent = content == null ? + toView.findViewById(R.id.app_drawer_recyclerview) : null; + final View drawerScrubber = content == null ? + toView.findViewById(R.id.scrubber_container) : null; + if (page != null) { page.setVisibility(View.VISIBLE); page.setLayerType(View.LAYER_TYPE_HARDWARE, null); @@ -3740,6 +3751,22 @@ public class Launcher extends Activity itemsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); itemsAlpha.setStartDelay(itemsAlphaStagger); mStateAnimation.play(itemsAlpha); + + if (drawerContent != null) { + drawerContent.setTranslationY(toView.getHeight()); + ObjectAnimator slideIn = ObjectAnimator.ofFloat(drawerContent, + "translationY", 1000, 0); + slideIn.setInterpolator(new OvershootInterpolator(OVERSHOOT_TENSION)); + slideIn.setStartDelay(revealDuration / 2); + mStateAnimation.play(slideIn); + } + if (drawerScrubber != null) { + drawerScrubber.setAlpha(0f); + ObjectAnimator fadeIn = ObjectAnimator.ofFloat(drawerScrubber, + "alpha", 0f, 1f); + fadeIn.setStartDelay(revealDuration / 2); + mStateAnimation.play(fadeIn); + } } View pageIndicators = toView.findViewById(R.id.apps_customize_page_indicator); @@ -3789,6 +3816,8 @@ public class Launcher extends Activity } if (content != null) { content.setPageBackgroundsVisible(true); + } else { + toView.setBackgroundColor(res.getColor(R.color.app_drawer_background)); } // Hide the search bar @@ -3872,7 +3901,7 @@ public class Launcher extends Activity } boolean material = Utilities.isLmpOrAbove(); - Resources res = getResources(); + final Resources res = getResources(); final int duration = res.getInteger(R.integer.config_appsCustomizeZoomOutTime); final int fadeOutDuration = res.getInteger(R.integer.config_appsCustomizeFadeOutTime); @@ -3915,7 +3944,8 @@ public class Launcher extends Activity final AppsCustomizePagedView content = (AppsCustomizePagedView) fromView.findViewById(R.id.apps_customize_pane_content); - final View page = content != null ? content.getPageAt(content.getNextPage()) : null; + final View page = content != null ? content.getPageAt(content.getNextPage()) + : fromView.findViewById(R.id.app_drawer_view); // We need to hide side pages of the Apps / Widget tray to avoid some ugly edge cases int count = content != null ? content.getChildCount() : 0; @@ -3936,7 +3966,12 @@ public class Launcher extends Activity final boolean isWidgetTray = contentType == AppsCustomizePagedView.ContentType.Widgets; - revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark)); + if (isWidgetTray) { + revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark)); + } else { + revealView.setBackgroundColor(res.getColor( + R.color.app_drawer_background)); + } int width = revealView.getMeasuredWidth(); int height = revealView.getMeasuredHeight(); @@ -3946,6 +3981,8 @@ public class Launcher extends Activity revealView.setVisibility(View.VISIBLE); if (content != null) { content.setPageBackgroundsVisible(false); + } else { + fromView.setBackgroundColor(Color.TRANSPARENT); } final View allAppsButton = getAllAppsButton(); @@ -3996,6 +4033,9 @@ public class Launcher extends Activity mStateAnimation.play(panelAlpha); } + final View drawerScrubber = content == null ? + fromView.findViewById(R.id.scrubber_container) : null; + if (page != null) { page.setLayerType(View.LAYER_TYPE_HARDWARE, null); @@ -4012,6 +4052,13 @@ public class Launcher extends Activity itemsAlpha.setDuration(100); itemsAlpha.setInterpolator(decelerateInterpolator); mStateAnimation.play(itemsAlpha); + + if (drawerScrubber != null) { + drawerScrubber.setAlpha(1f); + ObjectAnimator fadeOut = ObjectAnimator.ofFloat(drawerScrubber, + "alpha", 1f, 0f); + mStateAnimation.play(fadeOut); + } } View pageIndicators = fromView.findViewById(R.id.apps_customize_page_indicator); @@ -4073,6 +4120,8 @@ public class Launcher extends Activity } if (content != null) { content.setPageBackgroundsVisible(true); + } else { + fromView.setBackgroundColor(res.getColor(R.color.app_drawer_background)); } // Unhide side pages int count = content != null ? content.getChildCount() : 0; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index a93fff47b..ee812aa0e 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2567,7 +2567,7 @@ public class Workspace extends SmoothPagedView } mLauncher.updateVoiceButtonProxyVisible(false); - if (stateIsNormal) { + if (stateIsNormal || stateIsNormalHidden) { animateBackgroundGradient(0f, animated); } else { animateBackgroundGradient(getResources().getInteger( |