Merge "Widget picker two pane polish" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8e38e51495
@@ -41,6 +41,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_below="@id/collapse_handle"
|
||||
android:paddingHorizontal="@dimen/widget_list_horizontal_margin_large_screen"
|
||||
android:text="@string/widget_button_text"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
@@ -84,11 +85,10 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.67"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="24dp"
|
||||
android:layout_marginEnd="@dimen/widget_list_horizontal_margin_large_screen"
|
||||
android:paddingTop="@dimen/widget_list_horizontal_margin_large_screen"
|
||||
android:gravity="end"
|
||||
android:layout_gravity="end"
|
||||
android:paddingStart="8dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/no_widgets_text"
|
||||
@@ -100,18 +100,27 @@
|
||||
android:visibility="gone"
|
||||
tools:text="No widgets available" />
|
||||
<ScrollView
|
||||
android:id="@+id/right_pane_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/right_pane">
|
||||
<com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout
|
||||
android:id="@+id/recommended_widget_table"
|
||||
android:background="@drawable/widgets_surface_background"
|
||||
android:fillViewport="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal=
|
||||
"@dimen/widget_list_horizontal_margin_large_screen"
|
||||
android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
|
||||
android:visibility="gone" />
|
||||
android:gravity="center_vertical"
|
||||
android:clipToOutline="true"
|
||||
android:paddingBottom="36dp"
|
||||
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>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
<dimen name="widget_tabs_button_horizontal_padding">4dp</dimen>
|
||||
<dimen name="widget_tabs_horizontal_padding">16dp</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>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.widget;
|
||||
|
||||
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.graphics.Canvas;
|
||||
@@ -187,6 +188,10 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
|
||||
int widthUsed;
|
||||
if (deviceProfile.isTablet) {
|
||||
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));
|
||||
} else if (mInsets.bottom > 0) {
|
||||
widthUsed = mInsets.left + mInsets.right;
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.content.Context;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
@@ -42,6 +43,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
@@ -187,7 +189,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
private View mSearchBarContainer;
|
||||
private WidgetsSearchBar mSearchBar;
|
||||
private TextView mHeaderTitle;
|
||||
private FrameLayout mRightPane;
|
||||
private LinearLayout mRightPane;
|
||||
private FrameLayout mRightPaneScrollView;
|
||||
private WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
|
||||
private DeviceProfile mDeviceProfile;
|
||||
private final boolean mIsTwoPane;
|
||||
@@ -197,6 +200,21 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
|
||||
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) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mDeviceProfile = Launcher.getLauncher(context).getDeviceProfile();
|
||||
@@ -333,6 +351,12 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
? mContent.findViewById(R.id.title)
|
||||
: mSearchScrollView.findViewById(R.id.title);
|
||||
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 =
|
||||
new WidgetsListTableViewHolderBinder(mActivityContext, layoutInflater, this, this);
|
||||
onRecommendedWidgetsBound();
|
||||
@@ -760,15 +784,16 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
mNoIntercept = false;
|
||||
WidgetsRecyclerView recyclerView = getRecyclerView();
|
||||
RecyclerViewFastScroller scroller = recyclerView.getScrollbar();
|
||||
|
||||
if (scroller.getThumbOffsetY() >= 0
|
||||
&& getPopupContainer().isEventOverView(scroller, ev)) {
|
||||
mNoIntercept = true;
|
||||
} else if (getPopupContainer().isEventOverView(recyclerView, ev)) {
|
||||
mNoIntercept = !recyclerView.shouldContainerScroll(ev, getPopupContainer());
|
||||
} else if (mIsTwoPane && getPopupContainer().isEventOverView(mRightPane, ev)) {
|
||||
mNoIntercept = mRightPane.getScrollY() > 0;
|
||||
} else if (mIsTwoPane && mRightPaneScrollView != null
|
||||
&& getPopupContainer().isEventOverView(mRightPaneScrollView, ev)) {
|
||||
mNoIntercept = mRightPaneScrollView.canScrollVertically(-1);
|
||||
}
|
||||
|
||||
if (mSearchBar.isSearchBarFocused()
|
||||
&& !getPopupContainer().isEventOverView(mSearchBarContainer, ev)) {
|
||||
mSearchBar.clearSearchBarFocus();
|
||||
@@ -1002,10 +1027,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
Collections.EMPTY_LIST);
|
||||
widgetsRowViewHolder.mDataCallback = data -> {
|
||||
mWidgetsListTableViewHolderBinder.bindViewHolder(widgetsRowViewHolder,
|
||||
contentEntry,
|
||||
contentEntry.withMaxSpanSize(mMaxSpanPerRow),
|
||||
ViewHolderBinder.POSITION_FIRST | ViewHolderBinder.POSITION_LAST,
|
||||
Collections.singletonList(data));
|
||||
};
|
||||
|
||||
mRightPane.removeAllViews();
|
||||
mRightPane.addView(widgetsRowViewHolder.itemView);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user