Loading libs/WindowManager/Shell/res/layout/bubble_overflow_container.xml +10 −8 Original line number Diff line number Diff line Loading @@ -27,24 +27,26 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/bubble_overflow_recycler" android:layout_gravity="center_horizontal" android:nestedScrollingEnabled="false" android:layout_width="wrap_content" android:layout_height="wrap_content"/> android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:gravity="center"/> <LinearLayout android:id="@+id/bubble_overflow_empty_state" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/bubble_overflow_empty_state_padding" android:paddingRight="@dimen/bubble_overflow_empty_state_padding" android:orientation="vertical" android:gravity="center"> <ImageView android:id="@+id/bubble_overflow_empty_state_image" android:layout_width="@dimen/bubble_empty_overflow_image_height" android:layout_height="@dimen/bubble_empty_overflow_image_height" android:id="@+id/bubble_overflow_empty_state_image" android:scaleType="fitCenter" android:layout_gravity="center"/> Loading @@ -60,12 +62,12 @@ <TextView android:id="@+id/bubble_overflow_empty_subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="@*android:string/config_bodyFontFamily" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2" android:textColor="?android:attr/textColorSecondary" android:text="@string/bubble_overflow_empty_subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/bubble_empty_overflow_subtitle_padding" android:gravity="center"/> </LinearLayout> Loading libs/WindowManager/Shell/res/layout/bubble_overflow_view.xml +3 −1 Original line number Diff line number Diff line Loading @@ -32,12 +32,14 @@ android:id="@+id/bubble_view_name" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" android:textSize="13sp" android:layout_width="fill_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="1" android:lines="2" android:ellipsize="end" android:layout_gravity="center" android:paddingTop="@dimen/bubble_overflow_text_padding" android:paddingEnd="@dimen/bubble_overflow_text_padding" android:paddingStart="@dimen/bubble_overflow_text_padding" android:gravity="center"/> </LinearLayout> libs/WindowManager/Shell/res/values/dimen.xml +3 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,9 @@ <dimen name="bubble_expanded_view_slop">8dp</dimen> <!-- Default (and minimum) height of the expanded view shown when the bubble is expanded --> <dimen name="bubble_expanded_default_height">180dp</dimen> <!-- Default height of bubble overflow --> <!-- On large screens the width of the expanded view is restricted to this size. --> <dimen name="bubble_expanded_view_tablet_width">412dp</dimen> <!-- Default (and minimum) height of bubble overflow --> <dimen name="bubble_overflow_height">480dp</dimen> <!-- Bubble overflow padding when there are no bubbles --> <dimen name="bubble_overflow_empty_state_padding">16dp</dimen> Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +8 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPANDED_VIEW; Loading Loading @@ -335,7 +336,10 @@ public class BubbleExpandedView extends LinearLayout { mOverflowView = (BubbleOverflowContainerView) LayoutInflater.from(getContext()).inflate( R.layout.bubble_overflow_container, null /* root */); mOverflowView.setBubbleController(mController); mExpandedViewContainer.addView(mOverflowView); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); mExpandedViewContainer.addView(mOverflowView, lp); mExpandedViewContainer.setLayoutParams( new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)); bringChildToFront(mOverflowView); mSettingsIcon.setVisibility(GONE); } else { Loading Loading @@ -600,9 +604,9 @@ public class BubbleExpandedView extends LinearLayout { return; } if (mBubble != null || mIsOverflow) { if ((mBubble != null && mTaskView != null) || mIsOverflow) { float desiredHeight = mIsOverflow ? mOverflowHeight ? mPositioner.isLargeScreen() ? getMaxExpandedHeight() : mOverflowHeight : mBubble.getDesiredHeight(mContext); desiredHeight = Math.max(desiredHeight, mMinHeight); float height = Math.min(desiredHeight, getMaxExpandedHeight()); Loading Loading @@ -657,10 +661,10 @@ public class BubbleExpandedView extends LinearLayout { + getBubbleKey()); } mExpandedViewContainerLocation = containerLocationOnScreen; updateHeight(); if (mTaskView != null && mTaskView.getVisibility() == VISIBLE && mTaskView.isAttachedToWindow()) { updateHeight(); mTaskView.onLocationChanged(); } if (mIsOverflow) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowContainerView.java +14 −49 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.View; Loading @@ -51,8 +50,6 @@ import java.util.function.Consumer; * Container view for showing aged out bubbles. */ public class BubbleOverflowContainerView extends LinearLayout { static final String EXTRA_BUBBLE_CONTROLLER = "bubble_controller"; private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleOverflowActivity" : TAG_BUBBLES; private LinearLayout mEmptyState; Loading @@ -64,18 +61,16 @@ public class BubbleOverflowContainerView extends LinearLayout { private RecyclerView mRecyclerView; private List<Bubble> mOverflowBubbles = new ArrayList<>(); private class NoScrollGridLayoutManager extends GridLayoutManager { NoScrollGridLayoutManager(Context context, int columns) { private class OverflowGridLayoutManager extends GridLayoutManager { OverflowGridLayoutManager(Context context, int columns) { super(context, columns); } @Override public boolean canScrollVertically() { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { return super.canScrollVertically(); } return false; } // @Override // public boolean canScrollVertically() { // // TODO (b/162006693): this should be based on items in the list & available height // return true; // } @Override public int getColumnCountForAccessibility(RecyclerView.Recycler recycler, Loading Loading @@ -137,47 +132,24 @@ public class BubbleOverflowContainerView extends LinearLayout { Resources res = getResources(); final int columns = res.getInteger(R.integer.bubbles_overflow_columns); mRecyclerView.setLayoutManager( new NoScrollGridLayoutManager(getContext(), columns)); DisplayMetrics displayMetrics = new DisplayMetrics(); getContext().getDisplay().getMetrics(displayMetrics); final int overflowPadding = res.getDimensionPixelSize(R.dimen.bubble_overflow_padding); final int recyclerViewWidth = displayMetrics.widthPixels - (overflowPadding * 2); final int viewWidth = recyclerViewWidth / columns; final int maxOverflowBubbles = res.getInteger(R.integer.bubbles_max_overflow); final int rows = (int) Math.ceil((double) maxOverflowBubbles / columns); final int recyclerViewHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height) - res.getDimensionPixelSize(R.dimen.bubble_overflow_padding); final int viewHeight = recyclerViewHeight / rows; new OverflowGridLayoutManager(getContext(), columns)); mAdapter = new BubbleOverflowAdapter(getContext(), mOverflowBubbles, mController::promoteBubbleFromOverflow, mController.getPositioner(), viewWidth, viewHeight); mController.getPositioner()); mRecyclerView.setAdapter(mAdapter); mOverflowBubbles.clear(); mOverflowBubbles.addAll(mController.getOverflowBubbles()); mAdapter.notifyDataSetChanged(); // Currently BubbleExpandedView.mExpandedViewContainer is WRAP_CONTENT so use the same // width we would use for the recycler view LayoutParams lp = (LayoutParams) mEmptyState.getLayoutParams(); lp.width = recyclerViewWidth; updateEmptyStateVisibility(); mController.setOverflowListener(mDataListener); updateEmptyStateVisibility(); updateTheme(); } void updateEmptyStateVisibility() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); } mEmptyState.setVisibility(mOverflowBubbles.isEmpty() ? View.VISIBLE : View.GONE); mRecyclerView.setVisibility(mOverflowBubbles.isEmpty() ? View.GONE : View.VISIBLE); } /** Loading Loading @@ -258,20 +230,15 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V private Consumer<Bubble> mPromoteBubbleFromOverflow; private BubblePositioner mPositioner; private List<Bubble> mBubbles; private int mWidth; private int mHeight; BubbleOverflowAdapter(Context context, List<Bubble> list, Consumer<Bubble> promoteBubble, BubblePositioner positioner, int width, int height) { BubblePositioner positioner) { mContext = context; mBubbles = list; mPromoteBubbleFromOverflow = promoteBubble; mPositioner = positioner; mWidth = width; mHeight = height; } @Override Loading @@ -284,8 +251,6 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.width = mWidth; params.height = mHeight; overflowView.setLayoutParams(params); // Ensure name has enough contrast. Loading Loading
libs/WindowManager/Shell/res/layout/bubble_overflow_container.xml +10 −8 Original line number Diff line number Diff line Loading @@ -27,24 +27,26 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/bubble_overflow_recycler" android:layout_gravity="center_horizontal" android:nestedScrollingEnabled="false" android:layout_width="wrap_content" android:layout_height="wrap_content"/> android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:gravity="center"/> <LinearLayout android:id="@+id/bubble_overflow_empty_state" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/bubble_overflow_empty_state_padding" android:paddingRight="@dimen/bubble_overflow_empty_state_padding" android:orientation="vertical" android:gravity="center"> <ImageView android:id="@+id/bubble_overflow_empty_state_image" android:layout_width="@dimen/bubble_empty_overflow_image_height" android:layout_height="@dimen/bubble_empty_overflow_image_height" android:id="@+id/bubble_overflow_empty_state_image" android:scaleType="fitCenter" android:layout_gravity="center"/> Loading @@ -60,12 +62,12 @@ <TextView android:id="@+id/bubble_overflow_empty_subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="@*android:string/config_bodyFontFamily" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2" android:textColor="?android:attr/textColorSecondary" android:text="@string/bubble_overflow_empty_subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/bubble_empty_overflow_subtitle_padding" android:gravity="center"/> </LinearLayout> Loading
libs/WindowManager/Shell/res/layout/bubble_overflow_view.xml +3 −1 Original line number Diff line number Diff line Loading @@ -32,12 +32,14 @@ android:id="@+id/bubble_view_name" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem" android:textSize="13sp" android:layout_width="fill_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="1" android:lines="2" android:ellipsize="end" android:layout_gravity="center" android:paddingTop="@dimen/bubble_overflow_text_padding" android:paddingEnd="@dimen/bubble_overflow_text_padding" android:paddingStart="@dimen/bubble_overflow_text_padding" android:gravity="center"/> </LinearLayout>
libs/WindowManager/Shell/res/values/dimen.xml +3 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,9 @@ <dimen name="bubble_expanded_view_slop">8dp</dimen> <!-- Default (and minimum) height of the expanded view shown when the bubble is expanded --> <dimen name="bubble_expanded_default_height">180dp</dimen> <!-- Default height of bubble overflow --> <!-- On large screens the width of the expanded view is restricted to this size. --> <dimen name="bubble_expanded_view_tablet_width">412dp</dimen> <!-- Default (and minimum) height of bubble overflow --> <dimen name="bubble_overflow_height">480dp</dimen> <!-- Bubble overflow padding when there are no bubbles --> <dimen name="bubble_overflow_empty_state_padding">16dp</dimen> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +8 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPANDED_VIEW; Loading Loading @@ -335,7 +336,10 @@ public class BubbleExpandedView extends LinearLayout { mOverflowView = (BubbleOverflowContainerView) LayoutInflater.from(getContext()).inflate( R.layout.bubble_overflow_container, null /* root */); mOverflowView.setBubbleController(mController); mExpandedViewContainer.addView(mOverflowView); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); mExpandedViewContainer.addView(mOverflowView, lp); mExpandedViewContainer.setLayoutParams( new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)); bringChildToFront(mOverflowView); mSettingsIcon.setVisibility(GONE); } else { Loading Loading @@ -600,9 +604,9 @@ public class BubbleExpandedView extends LinearLayout { return; } if (mBubble != null || mIsOverflow) { if ((mBubble != null && mTaskView != null) || mIsOverflow) { float desiredHeight = mIsOverflow ? mOverflowHeight ? mPositioner.isLargeScreen() ? getMaxExpandedHeight() : mOverflowHeight : mBubble.getDesiredHeight(mContext); desiredHeight = Math.max(desiredHeight, mMinHeight); float height = Math.min(desiredHeight, getMaxExpandedHeight()); Loading Loading @@ -657,10 +661,10 @@ public class BubbleExpandedView extends LinearLayout { + getBubbleKey()); } mExpandedViewContainerLocation = containerLocationOnScreen; updateHeight(); if (mTaskView != null && mTaskView.getVisibility() == VISIBLE && mTaskView.isAttachedToWindow()) { updateHeight(); mTaskView.onLocationChanged(); } if (mIsOverflow) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowContainerView.java +14 −49 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.View; Loading @@ -51,8 +50,6 @@ import java.util.function.Consumer; * Container view for showing aged out bubbles. */ public class BubbleOverflowContainerView extends LinearLayout { static final String EXTRA_BUBBLE_CONTROLLER = "bubble_controller"; private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleOverflowActivity" : TAG_BUBBLES; private LinearLayout mEmptyState; Loading @@ -64,18 +61,16 @@ public class BubbleOverflowContainerView extends LinearLayout { private RecyclerView mRecyclerView; private List<Bubble> mOverflowBubbles = new ArrayList<>(); private class NoScrollGridLayoutManager extends GridLayoutManager { NoScrollGridLayoutManager(Context context, int columns) { private class OverflowGridLayoutManager extends GridLayoutManager { OverflowGridLayoutManager(Context context, int columns) { super(context, columns); } @Override public boolean canScrollVertically() { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { return super.canScrollVertically(); } return false; } // @Override // public boolean canScrollVertically() { // // TODO (b/162006693): this should be based on items in the list & available height // return true; // } @Override public int getColumnCountForAccessibility(RecyclerView.Recycler recycler, Loading Loading @@ -137,47 +132,24 @@ public class BubbleOverflowContainerView extends LinearLayout { Resources res = getResources(); final int columns = res.getInteger(R.integer.bubbles_overflow_columns); mRecyclerView.setLayoutManager( new NoScrollGridLayoutManager(getContext(), columns)); DisplayMetrics displayMetrics = new DisplayMetrics(); getContext().getDisplay().getMetrics(displayMetrics); final int overflowPadding = res.getDimensionPixelSize(R.dimen.bubble_overflow_padding); final int recyclerViewWidth = displayMetrics.widthPixels - (overflowPadding * 2); final int viewWidth = recyclerViewWidth / columns; final int maxOverflowBubbles = res.getInteger(R.integer.bubbles_max_overflow); final int rows = (int) Math.ceil((double) maxOverflowBubbles / columns); final int recyclerViewHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height) - res.getDimensionPixelSize(R.dimen.bubble_overflow_padding); final int viewHeight = recyclerViewHeight / rows; new OverflowGridLayoutManager(getContext(), columns)); mAdapter = new BubbleOverflowAdapter(getContext(), mOverflowBubbles, mController::promoteBubbleFromOverflow, mController.getPositioner(), viewWidth, viewHeight); mController.getPositioner()); mRecyclerView.setAdapter(mAdapter); mOverflowBubbles.clear(); mOverflowBubbles.addAll(mController.getOverflowBubbles()); mAdapter.notifyDataSetChanged(); // Currently BubbleExpandedView.mExpandedViewContainer is WRAP_CONTENT so use the same // width we would use for the recycler view LayoutParams lp = (LayoutParams) mEmptyState.getLayoutParams(); lp.width = recyclerViewWidth; updateEmptyStateVisibility(); mController.setOverflowListener(mDataListener); updateEmptyStateVisibility(); updateTheme(); } void updateEmptyStateVisibility() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); } mEmptyState.setVisibility(mOverflowBubbles.isEmpty() ? View.VISIBLE : View.GONE); mRecyclerView.setVisibility(mOverflowBubbles.isEmpty() ? View.GONE : View.VISIBLE); } /** Loading Loading @@ -258,20 +230,15 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V private Consumer<Bubble> mPromoteBubbleFromOverflow; private BubblePositioner mPositioner; private List<Bubble> mBubbles; private int mWidth; private int mHeight; BubbleOverflowAdapter(Context context, List<Bubble> list, Consumer<Bubble> promoteBubble, BubblePositioner positioner, int width, int height) { BubblePositioner positioner) { mContext = context; mBubbles = list; mPromoteBubbleFromOverflow = promoteBubble; mPositioner = positioner; mWidth = width; mHeight = height; } @Override Loading @@ -284,8 +251,6 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.width = mWidth; params.height = mHeight; overflowView.setLayoutParams(params); // Ensure name has enough contrast. Loading