Merge "Widget picker two pane polish" into udc-dev am: 8e38e51495
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22163531 Change-Id: Ib074ca501fbaeb67195b2e503dac72449679e552 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_below="@id/collapse_handle"
|
||||||
android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
|
android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
|
||||||
android:text="@string/widget_button_text"
|
android:text="@string/widget_button_text"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
@@ -84,11 +85,10 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.67"
|
android:layout_weight="0.67"
|
||||||
android:paddingEnd="16dp"
|
android:layout_marginEnd="@dimen/widget_list_horizontal_margin_large_screen"
|
||||||
android:paddingTop="24dp"
|
android:paddingTop="@dimen/widget_list_horizontal_margin_large_screen"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/no_widgets_text"
|
android:id="@+id/no_widgets_text"
|
||||||
@@ -100,18 +100,27 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="No widgets available" />
|
tools:text="No widgets available" />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
android:id="@+id/right_pane_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/right_pane">
|
android:fillViewport="true">
|
||||||
<com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout
|
<LinearLayout
|
||||||
android:id="@+id/recommended_widget_table"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/widgets_surface_background"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal=
|
android:gravity="center_vertical"
|
||||||
"@dimen/widget_list_horizontal_margin_large_screen"
|
android:clipToOutline="true"
|
||||||
android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
|
android:paddingBottom="36dp"
|
||||||
android:visibility="gone" />
|
android:background="@drawable/widgets_surface_background"
|
||||||
|
android:id="@+id/right_pane">
|
||||||
|
<com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout
|
||||||
|
android:id="@+id/recommended_widget_table"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal=
|
||||||
|
"@dimen/widget_list_horizontal_margin_large_screen"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -178,6 +178,7 @@
|
|||||||
<dimen name="widget_tabs_button_horizontal_padding">4dp</dimen>
|
<dimen name="widget_tabs_button_horizontal_padding">4dp</dimen>
|
||||||
<dimen name="widget_tabs_horizontal_padding">16dp</dimen>
|
<dimen name="widget_tabs_horizontal_padding">16dp</dimen>
|
||||||
<dimen name="widget_apps_tabs_vertical_padding">6dp</dimen>
|
<dimen name="widget_apps_tabs_vertical_padding">6dp</dimen>
|
||||||
|
<dimen name="widget_picker_landscape_tablet_left_right_margin">117dp</dimen>
|
||||||
|
|
||||||
<dimen name="recommended_widgets_table_vertical_padding">8dp</dimen>
|
<dimen name="recommended_widgets_table_vertical_padding">8dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
package com.android.launcher3.widget;
|
package com.android.launcher3.widget;
|
||||||
|
|
||||||
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
|
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
|
||||||
|
import static com.android.launcher3.config.FeatureFlags.LARGE_SCREEN_WIDGET_PICKER;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -187,6 +188,10 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
|
|||||||
int widthUsed;
|
int widthUsed;
|
||||||
if (deviceProfile.isTablet) {
|
if (deviceProfile.isTablet) {
|
||||||
int margin = deviceProfile.allAppsLeftRightMargin;
|
int margin = deviceProfile.allAppsLeftRightMargin;
|
||||||
|
if (deviceProfile.isLandscape && LARGE_SCREEN_WIDGET_PICKER.get()) {
|
||||||
|
margin = getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.widget_picker_landscape_tablet_left_right_margin);
|
||||||
|
}
|
||||||
widthUsed = Math.max(2 * margin, 2 * (mInsets.left + mInsets.right));
|
widthUsed = Math.max(2 * margin, 2 * (mInsets.left + mInsets.right));
|
||||||
} else if (mInsets.bottom > 0) {
|
} else if (mInsets.bottom > 0) {
|
||||||
widthUsed = mInsets.left + mInsets.right;
|
widthUsed = mInsets.left + mInsets.right;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.LauncherApps;
|
import android.content.pm.LauncherApps;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Outline;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
@@ -42,6 +43,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewOutlineProvider;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
@@ -187,7 +189,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||||||
private View mSearchBarContainer;
|
private View mSearchBarContainer;
|
||||||
private WidgetsSearchBar mSearchBar;
|
private WidgetsSearchBar mSearchBar;
|
||||||
private TextView mHeaderTitle;
|
private TextView mHeaderTitle;
|
||||||
private FrameLayout mRightPane;
|
private LinearLayout mRightPane;
|
||||||
|
private FrameLayout mRightPaneScrollView;
|
||||||
private WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
|
private WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
|
||||||
private DeviceProfile mDeviceProfile;
|
private DeviceProfile mDeviceProfile;
|
||||||
private final boolean mIsTwoPane;
|
private final boolean mIsTwoPane;
|
||||||
@@ -197,6 +200,21 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||||||
|
|
||||||
private RecyclerViewFastScroller mFastScroller;
|
private RecyclerViewFastScroller mFastScroller;
|
||||||
|
|
||||||
|
private final ViewOutlineProvider mViewOutlineProviderRightPane = new ViewOutlineProvider() {
|
||||||
|
@Override
|
||||||
|
public void getOutline(View view, Outline outline) {
|
||||||
|
outline.setRoundRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
view.getMeasuredWidth(),
|
||||||
|
view.getMeasuredHeight() - getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.widget_list_horizontal_margin_large_screen),
|
||||||
|
view.getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.widget_list_top_bottom_corner_radius)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public WidgetsFullSheet(Context context, AttributeSet attrs, int defStyleAttr) {
|
public WidgetsFullSheet(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
mDeviceProfile = Launcher.getLauncher(context).getDeviceProfile();
|
mDeviceProfile = Launcher.getLauncher(context).getDeviceProfile();
|
||||||
@@ -333,6 +351,12 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||||||
? mContent.findViewById(R.id.title)
|
? mContent.findViewById(R.id.title)
|
||||||
: mSearchScrollView.findViewById(R.id.title);
|
: mSearchScrollView.findViewById(R.id.title);
|
||||||
mRightPane = mIsTwoPane ? mContent.findViewById(R.id.right_pane) : null;
|
mRightPane = mIsTwoPane ? mContent.findViewById(R.id.right_pane) : null;
|
||||||
|
if (mRightPane != null) {
|
||||||
|
mRightPane.setOutlineProvider(mViewOutlineProviderRightPane);
|
||||||
|
}
|
||||||
|
mRightPaneScrollView = mIsTwoPane
|
||||||
|
? mContent.findViewById(R.id.right_pane_scroll_view) : null;
|
||||||
|
|
||||||
mWidgetsListTableViewHolderBinder =
|
mWidgetsListTableViewHolderBinder =
|
||||||
new WidgetsListTableViewHolderBinder(mActivityContext, layoutInflater, this, this);
|
new WidgetsListTableViewHolderBinder(mActivityContext, layoutInflater, this, this);
|
||||||
onRecommendedWidgetsBound();
|
onRecommendedWidgetsBound();
|
||||||
@@ -760,15 +784,16 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||||||
mNoIntercept = false;
|
mNoIntercept = false;
|
||||||
WidgetsRecyclerView recyclerView = getRecyclerView();
|
WidgetsRecyclerView recyclerView = getRecyclerView();
|
||||||
RecyclerViewFastScroller scroller = recyclerView.getScrollbar();
|
RecyclerViewFastScroller scroller = recyclerView.getScrollbar();
|
||||||
|
|
||||||
if (scroller.getThumbOffsetY() >= 0
|
if (scroller.getThumbOffsetY() >= 0
|
||||||
&& getPopupContainer().isEventOverView(scroller, ev)) {
|
&& getPopupContainer().isEventOverView(scroller, ev)) {
|
||||||
mNoIntercept = true;
|
mNoIntercept = true;
|
||||||
} else if (getPopupContainer().isEventOverView(recyclerView, ev)) {
|
} else if (getPopupContainer().isEventOverView(recyclerView, ev)) {
|
||||||
mNoIntercept = !recyclerView.shouldContainerScroll(ev, getPopupContainer());
|
mNoIntercept = !recyclerView.shouldContainerScroll(ev, getPopupContainer());
|
||||||
} else if (mIsTwoPane && getPopupContainer().isEventOverView(mRightPane, ev)) {
|
} else if (mIsTwoPane && mRightPaneScrollView != null
|
||||||
mNoIntercept = mRightPane.getScrollY() > 0;
|
&& getPopupContainer().isEventOverView(mRightPaneScrollView, ev)) {
|
||||||
|
mNoIntercept = mRightPaneScrollView.canScrollVertically(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSearchBar.isSearchBarFocused()
|
if (mSearchBar.isSearchBarFocused()
|
||||||
&& !getPopupContainer().isEventOverView(mSearchBarContainer, ev)) {
|
&& !getPopupContainer().isEventOverView(mSearchBarContainer, ev)) {
|
||||||
mSearchBar.clearSearchBarFocus();
|
mSearchBar.clearSearchBarFocus();
|
||||||
@@ -1002,10 +1027,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||||||
Collections.EMPTY_LIST);
|
Collections.EMPTY_LIST);
|
||||||
widgetsRowViewHolder.mDataCallback = data -> {
|
widgetsRowViewHolder.mDataCallback = data -> {
|
||||||
mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
|
mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
|
||||||
contentEntry,
|
contentEntry.withMaxSpanSize(mMaxSpanPerRow),
|
||||||
ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
|
ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
|
||||||
Collections.singletonList(data));
|
Collections.singletonList(data));
|
||||||
};
|
};
|
||||||
|
|
||||||
mRightPane.removeAllViews();
|
mRightPane.removeAllViews();
|
||||||
mRightPane.addView(widgetsRowViewHolder.itemView);
|
mRightPane.addView(widgetsRowViewHolder.itemView);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user