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

Commit b8d4c9ff authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

Merge into jb-mr1-dev

Change-Id: Iaee05ce2bc5103c46fe9a148ad166f694c246c2f
parents 7e886bc3 5a8aefa6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -40,4 +40,8 @@
    <!-- Size of application thumbnail -->
    <dimen name="status_bar_recents_thumbnail_width">200dp</dimen>
    <dimen name="status_bar_recents_thumbnail_height">177dp</dimen>

    <!-- On tablet-sized devices, we allocate the rightmost third(ish) of the draggable status bar
         to quick settings. -->
    <item type="dimen" name="settings_panel_dragzone_fraction">35%</item>
</resources>
+7 −2
Original line number Diff line number Diff line
@@ -166,8 +166,13 @@
    <integer name="notification_panel_layout_gravity">0x37</integer>
    <integer name="settings_panel_layout_gravity">0x37</integer>

    <!-- Quick settings panels minimum fling open target width. -->
    <dimen name="settings_panel_fling_gutter">90dp</dimen>
    <!-- Fraction of the status bar that, when dragged, will produce the quick settings panel
         instead of the notification panel. See also @dimen/settings_panel_dragzone_min.
         If zero, the settings panel will not be directly draggable from the status bar. -->
    <item type="dimen" name="settings_panel_dragzone_fraction">0%</item>

    <!-- Quick settings dragzone, if used, should be at least this big (may be zero). -->
    <dimen name="settings_panel_dragzone_min">100dp</dimen>

    <!-- Height of the carrier/wifi name label -->
    <dimen name="carrier_label_height">24dp</dimen>
+31 −17
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.StatusBarManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
@@ -46,8 +47,9 @@ public class PhoneStatusBarView extends PanelBar {

    PhoneStatusBar mBar;
    int mScrimColor;
    float mMinFlingGutter;
    float mNotificationWidth;
    float mSettingsPanelDragzoneFrac;
    float mSettingsPanelDragzoneMin;

    boolean mFullWidthNotifications;
    PanelView mFadingPanel = null;
    PanelView mNotificationPanel, mSettingsPanel;
@@ -64,13 +66,14 @@ public class PhoneStatusBarView extends PanelBar {
    public void onAttachedToWindow() {
        Resources res = getContext().getResources();
        mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
        mMinFlingGutter = res.getDimension(R.dimen.settings_panel_fling_gutter);
        mFullWidthNotifications = false;
        mSettingsPanelDragzoneMin = res.getDimension(R.dimen.settings_panel_dragzone_min);
        try {
            mNotificationWidth = res.getDimension(R.dimen.notification_panel_width);
        } catch (Resources.NotFoundException ex) {
            mFullWidthNotifications = true;
            mSettingsPanelDragzoneFrac = res.getFraction(R.dimen.settings_panel_dragzone_fraction, 1, 1);
        } catch (NotFoundException ex) {
            mSettingsPanelDragzoneFrac = 0f;
        }

        mFullWidthNotifications = mSettingsPanelDragzoneFrac <= 0f;
    }

    @Override
@@ -105,19 +108,30 @@ public class PhoneStatusBarView extends PanelBar {

    @Override
    public PanelView selectPanelForTouchX(float x) {
        if (mFullWidthNotifications) {
            if (DEBUG) {
                Slog.v(TAG, "notif frac=" + mNotificationPanel.getExpandedFraction());
            }
            return (mNotificationPanel.getExpandedFraction() == 1.0f)
                ? mSettingsPanel : mNotificationPanel;
        }

        // We split the status bar into thirds: the left 2/3 are for notifications, and the
        // right 1/3 for quick settings. If you pull the status bar down a second time you'll
        // toggle panels no matter where you pull it down.

        final float w = (float) getMeasuredWidth();
        final float gutter = w - mNotificationWidth;
        final boolean useGutter = !mFullWidthNotifications && gutter > mMinFlingGutter;
        final float threshold = 1.0f - (gutter / w);
        final float f = x / w;
        if ((useGutter && f > threshold && mSettingsPanel.getExpandedFraction() != 1.0f) ||
            mNotificationPanel.getExpandedFraction() == 1.0f) {
            return mSettingsPanel;
        }
        return mNotificationPanel;
        float region = (w * mSettingsPanelDragzoneFrac);

        if (DEBUG) {
            Slog.v(TAG, String.format(
                "w=%.1f frac=%.3f region=%.1f min=%.1f x=%.1f w-x=%.1f",
                w, mSettingsPanelDragzoneFrac, region, mSettingsPanelDragzoneMin, x, (w-x)));
        }

        if (region < mSettingsPanelDragzoneMin) region = mSettingsPanelDragzoneMin;

        return (w - x < region) ? mSettingsPanel : mNotificationPanel;
    }

    @Override