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

Commit 4ee10f33 authored by Shamali Patwa's avatar Shamali Patwa Committed by Android (Google) Code Review
Browse files

Merge "Use same margins for widgets bottom sheet as all apps." into main

parents 0c338f30 50bf021b
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;
@@ -320,19 +318,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;
@@ -154,6 +155,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();