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

Commit 50bf021b authored by Shamali P's avatar Shamali P Committed by Shamali Patwa
Browse files

Use same margins for widgets bottom sheet as all apps.

* Per UX discussion with jane and david, the full width looks too large
for the app info -> long press -> widgets bottom sheet.
* Earlier during POR, we decided to match them all, but after trying it out, we think smaller is better for the app specific bottom sheet.

* http://screencast/cast/NTg1Njk1MDUxOTU5NTAwOHxiMDU0YWJhMi04MQ
* http://screencast/cast/NjU0NjQyODgwMDI3MDMzNnw4NDNhMGVjMy0yMg


Bug: 328812171
Test: screencast
Flag: N/A
Change-Id: I9b0a996f80bac2639bcadf85480468ac886c7093
parent 8fc5e593
Loading
Loading
Loading
Loading
+2 −15
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@
package com.android.launcher3.widget;

import static com.android.app.animation.Interpolators.EMPHASIZED;
import static com.android.launcher3.Flags.enableCategorizedWidgetSuggestions;
import static com.android.launcher3.Flags.enableUnfoldedTwoPanePicker;
import static com.android.launcher3.Flags.enableWidgetTapToAdd;
import static com.android.launcher3.LauncherPrefs.WIDGETS_EDUCATION_TIP_SEEN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP;
@@ -272,19 +270,8 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
                MeasureSpec.getSize(heightMeasureSpec));
    }

    private int getTabletHorizontalMargin(DeviceProfile deviceProfile) {
        // All bottom-sheets showing widgets will be full-width across all devices.
        if (enableCategorizedWidgetSuggestions()) {
            return 0;
        }
        if (deviceProfile.isLandscape && !deviceProfile.isTwoPanels) {
            return getResources().getDimensionPixelSize(
                    R.dimen.widget_picker_landscape_tablet_left_right_margin);
        }
        if (deviceProfile.isTwoPanels && enableUnfoldedTwoPanePicker()) {
            return getResources().getDimensionPixelSize(
                    R.dimen.widget_picker_two_panels_left_right_margin);
        }
    /** Returns the horizontal margins to be applied to the widget sheet. **/
    protected int getTabletHorizontalMargin(DeviceProfile deviceProfile) {
        return deviceProfile.allAppsLeftRightMargin;
    }

+21 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.widget.ScrollView;
import androidx.annotation.NonNull;
import androidx.annotation.Px;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.model.data.PackageItemInfo;
@@ -153,6 +154,26 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet {
        mFastScroller.setVisibility(GONE);
    }

    @Override
    protected int getTabletHorizontalMargin(DeviceProfile deviceProfile) {
        if (enableCategorizedWidgetSuggestions()) {
            // two pane picker is full width for fold as well as tablet.
            return getResources().getDimensionPixelSize(
                    R.dimen.widget_picker_two_panels_left_right_margin);
        }
        if (deviceProfile.isTwoPanels && enableUnfoldedTwoPanePicker()) {
            // enableUnfoldedTwoPanePicker made two pane picker full-width for fold only.
            return getResources().getDimensionPixelSize(
                    R.dimen.widget_picker_two_panels_left_right_margin);
        }
        if (deviceProfile.isLandscape && !deviceProfile.isTwoPanels) {
            // non-fold tablet landscape margins (ag/22163531)
            return getResources().getDimensionPixelSize(
                    R.dimen.widget_picker_landscape_tablet_left_right_margin);
        }
        return deviceProfile.allAppsLeftRightMargin;
    }

    @Override
    protected void onUserSwipeToDismissProgressChanged() {
        super.onUserSwipeToDismissProgressChanged();