mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Keep rounded corners while scrolling in right pane & fix scrollbar size.
[demo](http://screencast/api/gif/NDU4MTQ5ODE3Mzc4NDA2NHxhYmUzMDcxNy04MA/image) Bug: 333734241 Test: screencast Flag: N/A Change-Id: Ifb522ca2c0a1092bf41c630e336b19c81d504c26
This commit is contained in:
31
res/drawable/widget_picker_preview_pane_scroll_thumb.xml
Normal file
31
res/drawable/widget_picker_preview_pane_scroll_thumb.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2024 The Android Open Source 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.
|
||||
-->
|
||||
<!--
|
||||
A variation of material's scrollbar_handle_material.xml that has paddings to make it smaller.
|
||||
ScrollView's "insideInsets" / "insideOverlay" styles don't consider corner radius applied to scroll
|
||||
views, so we apply matching padding to the thumb to align it.
|
||||
-->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:bottom="@dimen/widget_list_top_bottom_corner_radius"
|
||||
android:top="@dimen/widget_list_top_bottom_corner_radius">
|
||||
<shape
|
||||
android:shape="rectangle"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<solid android:color="#84ffffff" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -94,42 +94,49 @@
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/right_pane_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.67"
|
||||
android:layout_marginEnd="@dimen/widget_list_horizontal_margin_two_pane"
|
||||
android:paddingTop="@dimen/widget_list_horizontal_margin_two_pane"
|
||||
android:gravity="end"
|
||||
android:layout_gravity="end"
|
||||
android:orientation="horizontal">
|
||||
<ScrollView
|
||||
android:id="@+id/right_pane_scroll_view"
|
||||
android:layout_weight="0.67">
|
||||
<FrameLayout
|
||||
android:id="@+id/right_pane_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_marginVertical="@dimen/widget_picker_vertical_margin_right_pane"
|
||||
android:layout_marginEnd="@dimen/widget_list_horizontal_margin_two_pane"
|
||||
android:gravity="end"
|
||||
android:layout_gravity="end"
|
||||
android:orientation="horizontal">
|
||||
<ScrollView
|
||||
android:id="@+id/right_pane_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:clipToOutline="true"
|
||||
android:paddingBottom="36dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/widgets_surface_background"
|
||||
android:importantForAccessibility="yes"
|
||||
android:id="@+id/right_pane">
|
||||
<!-- Shown when there are recommendations to display -->
|
||||
android:scrollbarThumbVertical="@drawable/widget_picker_preview_pane_scroll_thumb"
|
||||
android:clipToOutline="true"
|
||||
android:fillViewport="true">
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_recommendations_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/widgets_surface_background"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
<include layout="@layout/widget_recommendations" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:clipToOutline="true"
|
||||
android:paddingBottom="36dp"
|
||||
android:background="@drawable/widgets_surface_background"
|
||||
android:importantForAccessibility="yes"
|
||||
android:id="@+id/right_pane">
|
||||
<!-- Shown when there are recommendations to display -->
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_recommendations_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/widgets_surface_background"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
<include layout="@layout/widget_recommendations" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</com.android.launcher3.views.SpringRelativeLayout>
|
||||
|
||||
@@ -205,6 +205,7 @@
|
||||
<!-- Margin applied to the recycler view with search bar & the list of widget apps below it. -->
|
||||
<dimen name="widget_list_left_pane_horizontal_margin">0dp</dimen>
|
||||
<dimen name="widget_list_horizontal_margin_two_pane">24dp</dimen>
|
||||
<dimen name="widget_picker_vertical_margin_right_pane">24dp</dimen>
|
||||
|
||||
<dimen name="widget_preview_shadow_blur">0.5dp</dimen>
|
||||
<dimen name="widget_preview_key_shadow_distance">1dp</dimen>
|
||||
|
||||
@@ -23,14 +23,12 @@ import static com.android.launcher3.UtilitiesKt.modifyAttributesOnViewTree;
|
||||
import static com.android.launcher3.UtilitiesKt.restoreAttributesOnViewTree;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Process;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -78,21 +76,6 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet {
|
||||
private int mActivePage = -1;
|
||||
private PackageUserKey mSelectedHeader;
|
||||
|
||||
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_two_pane),
|
||||
view.getResources().getDimensionPixelSize(
|
||||
R.dimen.widget_list_top_bottom_corner_radius)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
public WidgetsTwoPaneSheet(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
@@ -136,11 +119,8 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet {
|
||||
|
||||
mHeaderTitle = mContent.findViewById(R.id.title);
|
||||
mRightPane = mContent.findViewById(R.id.right_pane);
|
||||
mRightPane.setOutlineProvider(mViewOutlineProviderRightPane);
|
||||
mRightPaneScrollView = mContent.findViewById(R.id.right_pane_scroll_view);
|
||||
mRightPaneScrollView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
mRightPaneScrollView.setOutlineProvider(mViewOutlineProvider);
|
||||
mRightPaneScrollView.setClipToOutline(true);
|
||||
|
||||
mPrimaryWidgetListView = findViewById(R.id.primary_widgets_list_view);
|
||||
mPrimaryWidgetListView.setOutlineProvider(mViewOutlineProvider);
|
||||
|
||||
Reference in New Issue
Block a user