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

Commit 18d08469 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

resolved conflicts for merge of 93160828 to master-lockscreen-dev

Change-Id: Ief6d6b8b8cc9ae2eb38442a3ba9ecae4637b75d6
parents a66a735d 93160828
Loading
Loading
Loading
Loading
+1 −24
Original line number Original line Diff line number Diff line
@@ -24,19 +24,10 @@
    android:id="@+id/notification_panel"
    android:id="@+id/notification_panel"
    android:layout_width="0dp"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/notification_panel_bg"
    android:paddingTop="@dimen/notification_panel_padding_top"
    android:paddingTop="@dimen/notification_panel_padding_top"
    android:layout_marginStart="@dimen/notification_panel_margin_left"
    android:layout_marginStart="@dimen/notification_panel_margin_left"
    >
    >


    <View
        android:id="@+id/handle"
        android:layout_width="match_parent"
        android:layout_height="@dimen/close_handle_height"
        android:background="@drawable/status_bar_close"
        android:visibility="invisible"
        />

    <include
    <include
        layout="@layout/carrier_label"
        layout="@layout/carrier_label"
        android:layout_height="@dimen/carrier_label_height"
        android:layout_height="@dimen/carrier_label_height"
@@ -69,6 +60,7 @@
            />
            />


        <FrameLayout
        <FrameLayout
            android:id="@+id/notification_container_parent"
            android:layout_width="match_parent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_height="wrap_content"
            >
            >
@@ -78,21 +70,6 @@
                android:layout_height="wrap_content"
                android:layout_height="wrap_content"
                />
                />


            <ScrollView
                android:id="@+id/scroll"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fadingEdge="none"
                android:overScrollMode="ifContentScrolls"
                >
                <com.android.systemui.statusbar.policy.NotificationRowLayout
                    android:id="@+id/latestItems"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    systemui:rowHeight="@dimen/notification_row_min_height"
                    />
            </ScrollView>

            <com.android.systemui.statusbar.stack.NotificationStackScrollLayout
            <com.android.systemui.statusbar.stack.NotificationStackScrollLayout
                    android:id="@+id/notification_stack_scroller"
                    android:id="@+id/notification_stack_scroller"
                    android:layout_width="match_parent"
                    android:layout_width="match_parent"
+2 −14
Original line number Original line Diff line number Diff line
@@ -34,6 +34,8 @@ import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewGroup;


import com.android.systemui.statusbar.policy.ScrollAdapter;

public class ExpandHelper implements Gefingerpoken, OnClickListener {
public class ExpandHelper implements Gefingerpoken, OnClickListener {
    public interface Callback {
    public interface Callback {
        View getChildAtRawPosition(float x, float y);
        View getChildAtRawPosition(float x, float y);
@@ -609,19 +611,5 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
        }
        }
        mVibrator.vibrate(duration, AudioManager.STREAM_SYSTEM);
        mVibrator.vibrate(duration, AudioManager.STREAM_SYSTEM);
    }
    }

    public interface ScrollAdapter {

        /**
         * @return Whether the view returned by {@link #getHostView()} is scrolled to the top
         * and can therefore be expanded by a single finger drag
         */
        public boolean isScrolledToTop();

        /**
         * @return The view in which the scrolling is performed
         */
        public View getHostView();
    }
}
}
+3 −5
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings;
@@ -78,6 +77,7 @@ import com.android.systemui.RecentsComponent;
import com.android.systemui.SearchPanelView;
import com.android.systemui.SearchPanelView;
import com.android.systemui.SystemUI;
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.phone.KeyguardTouchDelegate;
import com.android.systemui.statusbar.phone.KeyguardTouchDelegate;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Locale;
@@ -98,8 +98,6 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected static final int MSG_HIDE_HEADS_UP = 1027;
    protected static final int MSG_HIDE_HEADS_UP = 1027;
    protected static final int MSG_ESCALATE_HEADS_UP = 1028;
    protected static final int MSG_ESCALATE_HEADS_UP = 1028;


    public static final boolean ENABLE_NOTIFICATION_STACK = SystemProperties
            .getBoolean("persist.notifications.use_stack", false);
    protected static final boolean ENABLE_HEADS_UP = true;
    protected static final boolean ENABLE_HEADS_UP = true;
    // scores above this threshold should be displayed in heads up mode.
    // scores above this threshold should be displayed in heads up mode.
    protected static final int INTERRUPTION_THRESHOLD = 10;
    protected static final int INTERRUPTION_THRESHOLD = 10;
@@ -120,7 +118,7 @@ public abstract class BaseStatusBar extends SystemUI implements


    // all notifications
    // all notifications
    protected NotificationData mNotificationData = new NotificationData();
    protected NotificationData mNotificationData = new NotificationData();
    protected ViewGroup mPile;
    protected NotificationStackScrollLayout mStackScroller;


    protected NotificationData.Entry mInterruptingNotificationEntry;
    protected NotificationData.Entry mInterruptingNotificationEntry;
    protected long mInterruptingNotificationTime;
    protected long mInterruptingNotificationTime;
@@ -1029,7 +1027,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        }
        }
        // Construct the expanded view.
        // Construct the expanded view.
        NotificationData.Entry entry = new NotificationData.Entry(key, notification, iconView);
        NotificationData.Entry entry = new NotificationData.Entry(key, notification, iconView);
        if (!inflateViews(entry, mPile)) {
        if (!inflateViews(entry, mStackScroller)) {
            handleNotificationError(key, notification, "Couldn't expand RemoteViews for: "
            handleNotificationError(key, notification, "Couldn't expand RemoteViews for: "
                    + notification);
                    + notification);
            return null;
            return null;
+92 −61
Original line number Original line Diff line number Diff line
@@ -17,45 +17,51 @@
package com.android.systemui.statusbar.phone;
package com.android.systemui.statusbar.phone;


import android.content.Context;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.EventLog;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityEvent;


import com.android.systemui.EventLogTags;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;


public class NotificationPanelView extends PanelView {
public class NotificationPanelView extends PanelView {
    public static final boolean DEBUG_GESTURES = true;
    public static final boolean DEBUG_GESTURES = true;


    Drawable mHandleBar;
    int mHandleBarHeight;
    View mHandleView;
    int mFingers;
    PhoneStatusBar mStatusBar;
    PhoneStatusBar mStatusBar;
    boolean mOkToFlip;
    private NotificationStackScrollLayout mNotificationStackScroller;
    private int[] mTempLocation = new int[2];
    private int[] mTempChildLocation = new int[2];
    private View mNotificationParent;



    public NotificationPanelView(Context context, AttributeSet attrs) {
    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
    }
    }


    public void setStatusBar(PhoneStatusBar bar) {
    public void setStatusBar(PhoneStatusBar bar) {
        if (mStatusBar != null) {
            mStatusBar.setOnFlipRunnable(null);
        }
        mStatusBar = bar;
        mStatusBar = bar;
        if (bar != null) {
            mStatusBar.setOnFlipRunnable(new Runnable() {
                @Override
                public void run() {
                    requestPanelHeightUpdate();
                }
            });
        }
    }
    }


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


        Resources resources = getContext().getResources();
        mNotificationStackScroller = (NotificationStackScrollLayout)
        mHandleBar = resources.getDrawable(R.drawable.status_bar_close);
                findViewById(R.id.notification_stack_scroller);
        mHandleBarHeight = resources.getDimensionPixelSize(R.dimen.close_handle_height);
        mNotificationParent = findViewById(R.id.notification_container_parent);
        mHandleView = findViewById(R.id.handle);
    }
    }


    @Override
    @Override
@@ -80,61 +86,86 @@ public class NotificationPanelView extends PanelView {
        return super.dispatchPopulateAccessibilityEvent(event);
        return super.dispatchPopulateAccessibilityEvent(event);
    }
    }


    // We draw the handle ourselves so that it's always glued to the bottom of the window.
    /**
    @Override
     * Gets the relative position of a view on the screen in regard to this view.
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
     *
        super.onLayout(changed, left, top, right, bottom);
     * @param requestedView the view we want to find the relative position for
        if (changed) {
     * @return
            final int pl = getPaddingLeft();
     */
            final int pr = getPaddingRight();
    private int getRelativeTop(View requestedView) {
            mHandleBar.setBounds(pl, 0, getWidth() - pr, (int) mHandleBarHeight);
        getLocationOnScreen(mTempLocation);
        requestedView.getLocationOnScreen(mTempChildLocation);
        return mTempChildLocation[1] - mTempLocation[1];
    }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        // TODO: Handle doublefinger swipe to notifications again. Look at history for a reference
        // implementation.
        return super.onTouchEvent(event);
    }
    }


    @Override
    @Override
    public void draw(Canvas canvas) {
    protected boolean isScrolledToBottom() {
        super.draw(canvas);
        if (!isInSettings()) {
        final int off = (int) (getHeight() - mHandleBarHeight - getPaddingBottom());
            return mNotificationStackScroller.isScrolledToBottom();
        canvas.translate(0, off);
        }
        mHandleBar.setState(mHandleView.getDrawableState());
        return super.isScrolledToBottom();
        mHandleBar.draw(canvas);
        canvas.translate(0, -off);
    }
    }


    @Override
    @Override
    public boolean onTouchEvent(MotionEvent event) {
    protected int getMaxPanelHeight() {
        if (DEBUG_GESTURES) {
        if (!isInSettings()) {
            if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
            int maxPanelHeight = super.getMaxPanelHeight();
                EventLog.writeEvent(EventLogTags.SYSUI_NOTIFICATIONPANEL_TOUCH,
            int emptyBottomMargin = mNotificationStackScroller.getEmptyBottomMargin();
                       event.getActionMasked(), (int) event.getX(), (int) event.getY());
            return maxPanelHeight - emptyBottomMargin;
            }
        }
        }
        return super.getMaxPanelHeight();
        if (PhoneStatusBar.SETTINGS_DRAG_SHORTCUT && mStatusBar.mHasFlipSettings) {
            switch (event.getActionMasked()) {
                case MotionEvent.ACTION_DOWN:
                    mOkToFlip = getExpandedHeight() == 0;
                    break;
                case MotionEvent.ACTION_POINTER_DOWN:
                    if (mOkToFlip) {
                        float miny = event.getY(0);
                        float maxy = miny;
                        for (int i=1; i<event.getPointerCount(); i++) {
                            final float y = event.getY(i);
                            if (y < miny) miny = y;
                            if (y > maxy) maxy = y;
                        }
                        if (maxy - miny < mHandleBarHeight) {
                            if (getMeasuredHeight() < mHandleBarHeight) {
                                mStatusBar.switchToSettings();
                            } else {
                                mStatusBar.flipToSettings();
    }
    }
                            mOkToFlip = false;

    private boolean isInSettings() {
        return mStatusBar != null && mStatusBar.isFlippedToSettings();
    }
    }

    @Override
    protected void onHeightUpdated(float expandedHeight) {
        updateNotificationStackHeight(expandedHeight);
    }
    }
                    break;

    /**
     * Update the height of the {@link #mNotificationStackScroller} to the new expanded height.
     * This is much more efficient than doing it over the layout pass.
     *
     * @param expandedHeight the new expanded height
     */
    private void updateNotificationStackHeight(float expandedHeight) {
        float childOffset = getRelativeTop(mNotificationStackScroller)
                - mNotificationParent.getTranslationY();
        int newStackHeight = (int) (expandedHeight - childOffset);
        int itemHeight = mNotificationStackScroller.getItemHeight();
        int bottomStackPeekSize = mNotificationStackScroller.getBottomStackPeekSize();
        int minStackHeight = itemHeight + bottomStackPeekSize;
        if (newStackHeight >= minStackHeight) {
            mNotificationParent.setTranslationY(0);
            mNotificationStackScroller.setCurrentStackHeight(newStackHeight);
        } else {

            // We did not reach the position yet where we actually start growing,
            // so we translate the stack upwards.
            int translationY = (newStackHeight - minStackHeight);
            // A slight parallax effect is introduced in order for the stack to catch up with
            // the top card.
            float partiallyThere = (float) newStackHeight / minStackHeight;
            partiallyThere = Math.max(0, partiallyThere);
            translationY += (1 - partiallyThere) * bottomStackPeekSize;
            mNotificationParent.setTranslationY(translationY);
            mNotificationStackScroller.setCurrentStackHeight(
                    (int) (expandedHeight - (childOffset + translationY)));
        }
        }
    }
    }
        return mHandleView.dispatchTouchEvent(event);

    @Override
    protected int getDesiredMeasureHeight() {
        return mMaxPanelHeight;
    }
    }
}
}
+268 −156

File changed.

Preview size limit exceeded, changes collapsed.

Loading