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

Commit 079b33d2 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

New slide-out mechanism.

Instead of sliding the panel in from off-screen, the panel
is now stretched open (cropping the scrolling contents).

This is slower, so the layout has been dramatically
simplified to help performance.

Change-Id: I8343449c2b3fa4b4ee161f1de992d2242635d15e
parent c6d29fc0
Loading
Loading
Loading
Loading
+26 −45
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
    android:descendantFocusability="afterDescendants"
    >

    <LinearLayout
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
@@ -90,35 +90,18 @@
        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:layout_marginTop="52dp"
            android:background="@drawable/status_bar_hr"
            />
    
        <FrameLayout
            android:layout_width="match_parent" 
            android:layout_height="wrap_content"
            android:layout_weight="1"
            >
            <TextView android:id="@+id/noNotificationsTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="@android:style/TextAppearance.Large"
                android:padding="8dp"
                android:layout_gravity="top"
                android:gravity="left"
                android:text="@string/status_bar_no_notifications_title"
                />
    
        <ScrollView
            android:id="@+id/scroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fadingEdge="none"
            android:overScrollMode="ifContentScrolls"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
			android:layout_marginTop="54dp"
			android:layout_marginBottom="34dp"
            >
            <com.android.systemui.statusbar.policy.NotificationRowLayout
                android:id="@+id/latestItems"
@@ -126,27 +109,25 @@
                android:layout_height="wrap_content"
                systemui:rowHeight="@dimen/notification_height"
                />
    
                </LinearLayout>
        </ScrollView>
    
        <ImageView
            android:layout_width="match_parent"
                android:layout_height="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/title_bar_shadow"
			android:layout_marginTop="54dp"
            android:scaleType="fitXY"
        />
   
        </FrameLayout>

        <com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_height="34dp"
            android:layout_gravity="bottom"
            android:orientation="vertical"
            >
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_height="34dp"
                android:layout_gravity="bottom"
                android:scaleType="fitXY"
                android:src="@drawable/status_bar_close_on"
@@ -154,6 +135,6 @@
    
        </com.android.systemui.statusbar.phone.CloseDragHandle>
    
    </LinearLayout><!-- end of sliding panel -->
    </FrameLayout><!-- end of sliding panel -->

</FrameLayout><!-- end of window -->
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
    <color name="status_bar_recents_app_label_color">#ffffffff</color>
    <drawable name="status_bar_notification_row_background_color">#ff090909</drawable>
    <drawable name="notification_header_bg">#FF000000</drawable>
    <drawable name="notification_tracking_bg">#d8000000</drawable>
    <drawable name="notification_tracking_bg">#66000000</drawable>
    <color name="notification_list_shadow_top">#80000000</color>
    <drawable name="recents_callout_line">#99ffffff</drawable>
    <drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable>
+23 −31
Original line number Diff line number Diff line
@@ -162,11 +162,10 @@ public class PhoneStatusBar extends BaseStatusBar {
    Dialog mExpandedDialog;
    WindowManager.LayoutParams mExpandedParams;
    View mExpandedWindowView;
    View mNotificationPanel; // the sliding panel within the notification window
    View mNotificationPanel; // the sliding/resizing panel within the notification window
    ScrollView mScrollView;
    View mExpandedContents;
    // top bar
    TextView mNoNotificationsTitle;
    View mClearButton;
    View mSettingsButton;

@@ -328,8 +327,6 @@ public class PhoneStatusBar extends BaseStatusBar {
        mExpandedDialog = new ExpandedDialog(context);
        mPile = (NotificationRowLayout)expanded.findViewById(R.id.latestItems);
        mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
        mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
        mNoNotificationsTitle.setVisibility(View.GONE); // disabling for now

        mClearButton = expanded.findViewById(R.id.clear_all_button);
        mClearButton.setOnClickListener(mClearButtonListener);
@@ -339,6 +336,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        mSettingsButton = expanded.findViewById(R.id.settings_button);
        mSettingsButton.setOnClickListener(mSettingsButtonListener);
        mScrollView = (ScrollView)expanded.findViewById(R.id.scroll);
        mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns

        mTicker = new MyTicker(context, sb);

@@ -971,19 +969,6 @@ public class PhoneStatusBar extends BaseStatusBar {
        }
        mClearButton.setEnabled(clearable);

        /*
        if (mNoNotificationsTitle.isShown()) {
            if (any != (mNoNotificationsTitle.getAlpha() == 0.0f)) {
                ObjectAnimator a = ObjectAnimator.ofFloat(mNoNotificationsTitle, "alpha",
                            (any ? 0.0f : 0.75f));
                a.setDuration(any ? 0 : 500);
                a.setStartDelay(any ? 250 : 1000);
                a.start();
            }
        } else {
            mNoNotificationsTitle.setAlpha(any ? 0.0f : 0.75f);
        }
        */
    }

    public void showClock(boolean show) {
@@ -1266,6 +1251,7 @@ public class PhoneStatusBar extends BaseStatusBar {

    void stopTracking() {
        mTracking = false;
        mPile.setLayerType(View.LAYER_TYPE_NONE, null);
        mVelocityTracker.recycle();
        mVelocityTracker = null;
    }
@@ -1309,6 +1295,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        updateExpandedSize();

        mTracking = true;
        mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        mVelocityTracker = VelocityTracker.obtain();
        if (opening) {
            mAnimAccel = mExpandAccelPx;
@@ -1735,7 +1722,6 @@ public class PhoneStatusBar extends BaseStatusBar {
            pw.println("  mExpandedView: " + viewInfo(mExpandedWindowView));
            pw.println("  mExpandedDialog: " + mExpandedDialog);
            pw.println("  mPile: " + viewInfo(mPile));
            pw.println("  mNoNotificationsTitle: " + viewInfo(mNoNotificationsTitle));
            pw.println("  mCloseView: " + viewInfo(mCloseView));
            pw.println("  mTickerView: " + viewInfo(mTickerView));
            pw.println("  mScrollView: " + viewInfo(mScrollView)
@@ -1889,8 +1875,8 @@ public class PhoneStatusBar extends BaseStatusBar {
                    + " mTrackingPosition=" + mTrackingPosition);
        }

        int h = 0;
        int disph = mDisplayMetrics.heightPixels;
        int panelh = 0;
        final int disph = mDisplayMetrics.heightPixels;

        // If the expanded view is not visible, make sure they're still off screen.
        // Maybe the view was resized.
@@ -1902,25 +1888,33 @@ public class PhoneStatusBar extends BaseStatusBar {
        // tracking view...
        int pos;
        if (expandedPosition == EXPANDED_FULL_OPEN) {
            pos = h;
            panelh = disph;
        }
        else if (expandedPosition == EXPANDED_LEAVE_ALONE) {
            pos = mTrackingPosition;
            panelh = mTrackingPosition;
        }
        else {
            if (expandedPosition <= disph) {
                pos = expandedPosition;
                panelh = expandedPosition;
            } else {
                pos = disph;
                panelh = disph;
            }
            pos -= disph-h;
        }
        mTrackingPosition = pos;
        
        // catch orientation changes and other peculiar cases
        if (panelh > disph || (panelh < disph && !mTracking && !mAnimating))
            panelh = disph;
        
        mTrackingPosition = panelh;
        // XXX: this is all very WIP
        mNotificationPanel.setY(pos);
        //mNotificationPanel.setY(panelh);
        final View cropView = mNotificationPanel;
        ViewGroup.LayoutParams lp = cropView.getLayoutParams();
        lp.height = panelh;
        cropView.setLayoutParams(lp);
        // woo, special effects
        final float frac = 1.0f + (float)pos / mDisplayMetrics.heightPixels;
        final int color = ((int)(0xCC * frac * frac)) << 24;
        final float frac = (float)panelh / disph;
        final int color = ((int)(0xB0 * frac * frac)) << 24;
        mExpandedWindowView.setBackgroundColor(color);
        
//        Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color));
@@ -2205,8 +2199,6 @@ public class PhoneStatusBar extends BaseStatusBar {
        if (mClearButton instanceof TextView) {
            ((TextView)mClearButton).setText(context.getText(R.string.status_bar_clear_all_button));
        }
        mNoNotificationsTitle.setText(context.getText(R.string.status_bar_no_notifications_title));

        loadDimens();
    }

+5 −4
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class TabletStatusBar extends BaseStatusBar implements
    }
    
    private void addStatusBarWindow() {
        final View sb = makeStatusBarView();
        final int height = getStatusBarHeight();

        final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@@ -235,7 +236,7 @@ public class TabletStatusBar extends BaseStatusBar implements
        lp.setTitle("StatusBar");
        lp.packageName = mContext.getPackageName();
        lp.windowAnimations = R.style.Animation_StatusBar;
        WindowManagerImpl.getDefault().addView(makeStatusBarView(), lp);
        WindowManagerImpl.getDefault().addView(sb, lp);
    }

    protected void addPanelWindows() {
@@ -1833,9 +1834,9 @@ public class TabletStatusBar extends BaseStatusBar implements
                Context.LAYOUT_INFLATER_SERVICE);
        View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
        workAroundBadLayerDrawableOpacity(row);
//        View vetoButton = updateNotificationVetoButton(row, entry.notification);
//        vetoButton.setContentDescription(mContext.getString(
//                R.string.accessibility_remove_notification));
        View vetoButton = updateNotificationVetoButton(row, entry.notification);
        vetoButton.setContentDescription(mContext.getString(
                R.string.accessibility_remove_notification));

        // the large icon
        ImageView largeIcon = (ImageView)row.findViewById(R.id.large_icon);