Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f7eb1f2 authored by Shamali P's avatar Shamali P Committed by Shamali Patwa
Browse files

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
parent 8fc5e593
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+33 −26
Original line number Diff line number Diff line
@@ -94,12 +94,15 @@
            </FrameLayout>

            <FrameLayout
                android:id="@+id/right_pane_container"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.67"
                android:layout_weight="0.67">
                <FrameLayout
                    android:id="@+id/right_pane_container"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginVertical="@dimen/widget_picker_vertical_margin_right_pane"
                    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">
@@ -107,6 +110,9 @@
                        android:id="@+id/right_pane_scroll_view"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@drawable/widgets_surface_background"
                        android:scrollbarThumbVertical="@drawable/widget_picker_preview_pane_scroll_thumb"
                        android:clipToOutline="true"
                        android:fillViewport="true">
                        <LinearLayout
                            android:orientation="vertical"
@@ -131,6 +137,7 @@
                        </LinearLayout>
                    </ScrollView>
                </FrameLayout>
            </FrameLayout>
        </LinearLayout>
    </com.android.launcher3.views.SpringRelativeLayout>
</com.android.launcher3.widget.picker.WidgetsTwoPaneSheet>
+1 −0
Original line number Diff line number Diff line
@@ -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>
+0 −20
Original line number Diff line number Diff line
@@ -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);