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

Commit d3406d7a authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Flatten notification hiearchy and remove glow."

parents 21cc5731 fe40f7d1
Loading
Loading
Loading
Loading
+21 −28
Original line number Diff line number Diff line
@@ -19,12 +19,6 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >
    <com.android.systemui.statusbar.LatestItemView
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_marginTop="@dimen/notification_divider_height"
    android:focusable="true"
    android:clickable="true"
    android:background="@*android:drawable/notification_quantum_bg_dim"
@@ -48,5 +42,4 @@
        android:layout_width="120dp"
        android:layout_height="wrap_content"
        />
    </com.android.systemui.statusbar.LatestItemView>
</com.android.systemui.statusbar.NotificationOverflowContainer>
+9 −37
Original line number Diff line number Diff line
@@ -2,34 +2,6 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >

    <View
        android:id="@+id/top_glow"
        android:alpha="0"
        android:visibility="invisible"
        android:layout_width="match_parent"
        android:layout_height="@dimen/notification_divider_height"
        android:layout_gravity="top|center_horizontal"
        android:background="@drawable/top_divider_glow"
        />

    <Button
        android:id="@+id/veto"
        android:layout_width="48dp"
        android:layout_height="match_parent"
        android:gravity="end"
        android:layout_marginEnd="-80dp"
        android:background="@null"
        android:paddingEnd="8dp"
        android:paddingStart="8dp"
        />

    <com.android.systemui.statusbar.LatestItemView android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/notification_divider_height"
        android:layout_marginTop="@dimen/notification_divider_height"
    android:focusable="true"
    android:clickable="true"
    android:background="@*android:drawable/notification_quantum_bg"
@@ -42,16 +14,16 @@
    <com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/expandedPublic"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    </com.android.systemui.statusbar.LatestItemView>

    <View
        android:id="@+id/bottom_glow"
        android:alpha="0"
        android:visibility="invisible"
        android:layout_width="match_parent"
        android:layout_height="@dimen/notification_divider_height"
        android:layout_gravity="bottom|center_horizontal"
        android:background="@drawable/bottom_divider_glow"
    <Button
        android:id="@+id/veto"
        android:layout_width="48dp"
        android:layout_height="match_parent"
        android:gravity="end"
        android:layout_marginEnd="-80dp"
        android:background="@null"
        android:paddingEnd="8dp"
        android:paddingStart="8dp"
        />

    <TextView
+3 −6
Original line number Diff line number Diff line
@@ -82,12 +82,6 @@
    <!-- Height of a medium notification in the status bar -->
    <dimen name="notification_mid_height">128dp</dimen>

    <!-- Height of a small notification in the status bar plus glow, padding, etc -->
    <dimen name="notification_row_min_height">68dp</dimen>

    <!-- Height of a large notification in the status bar plus glow, padding, etc -->
    <dimen name="notification_row_max_height">260dp</dimen>

    <!-- size at which Notification icons will be drawn in the status bar -->
    <dimen name="status_bar_icon_drawing_size">18dip</dimen>

@@ -261,6 +255,9 @@
    <!-- Z distance between notifications if they are in the stack -->
    <dimen name="z_distance_between_notifications">2dp</dimen>

    <!-- The padding between the individual notification cards. -->
    <dimen name="notification_padding">3dp</dimen>

    <!-- Width of the zen mode interstitial dialog. -->
    <dimen name="zen_mode_dialog_width">320dp</dimen>

+1 −64
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.media.AudioManager;
@@ -81,8 +80,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
    private boolean mHasPopped;
    private View mEventSource;
    private View mCurrView;
    private View mCurrViewTopGlow;
    private View mCurrViewBottomGlow;
    private float mOldHeight;
    private float mNaturalHeight;
    private float mInitialTouchFocusY;
@@ -99,9 +96,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
    private ScaleGestureDetector mSGD;
    private ViewScaler mScaler;
    private ObjectAnimator mScaleAnimation;
    private AnimatorSet mGlowAnimationSet;
    private ObjectAnimator mGlowTopAnimation;
    private ObjectAnimator mGlowBottomAnimation;
    private Vibrator mVibrator;

    private int mSmallSize;
@@ -223,14 +217,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
            }
        };

        mGlowTopAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
        mGlowTopAnimation.addListener(glowVisibilityController);
        mGlowBottomAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
        mGlowBottomAnimation.addListener(glowVisibilityController);
        mGlowAnimationSet = new AnimatorSet();
        mGlowAnimationSet.play(mGlowTopAnimation).with(mGlowBottomAnimation);
        mGlowAnimationSet.setDuration(GLOW_DURATION);

        final ViewConfiguration configuration = ViewConfiguration.get(mContext);
        mTouchSlop = configuration.getScaledTouchSlop();

@@ -251,7 +237,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
        float newHeight = clamp(target);
        mScaler.setHeight(newHeight);

        setGlow(calculateGlow(target, newHeight));
        mLastFocusY = mSGD.getFocusY();
        mLastSpanY = mSGD.getCurrentSpan();
    }
@@ -322,37 +307,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
        return (GLOW_BASE + strength * (1f - GLOW_BASE));
    }

    public void setGlow(float glow) {
        if (!mGlowAnimationSet.isRunning() || glow == 0f) {
            if (mGlowAnimationSet.isRunning()) {
                mGlowAnimationSet.end();
            }
            if (mCurrViewTopGlow != null && mCurrViewBottomGlow != null) {
                if (glow == 0f || mCurrViewTopGlow.getAlpha() == 0f) {
                    // animate glow in and out
                    mGlowTopAnimation.setTarget(mCurrViewTopGlow);
                    mGlowBottomAnimation.setTarget(mCurrViewBottomGlow);
                    mGlowTopAnimation.setFloatValues(glow);
                    mGlowBottomAnimation.setFloatValues(glow);
                    mGlowAnimationSet.setupStartValues();
                    mGlowAnimationSet.start();
                } else {
                    // set it explicitly in reponse to touches.
                    mCurrViewTopGlow.setAlpha(glow);
                    mCurrViewBottomGlow.setAlpha(glow);
                    handleGlowVisibility();
                }
            }
        }
    }

    private void handleGlowVisibility() {
        mCurrViewTopGlow.setVisibility(mCurrViewTopGlow.getAlpha() <= 0.0f ?
                View.INVISIBLE : View.VISIBLE);
        mCurrViewBottomGlow.setVisibility(mCurrViewBottomGlow.getAlpha() <= 0.0f ?
                View.INVISIBLE : View.VISIBLE);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        final int action = ev.getAction();
@@ -466,9 +420,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {

                    if (mHasPopped) {
                        mScaler.setHeight(newHeight);
                        setGlow(GLOW_BASE);
                    } else {
                        setGlow(calculateGlow(4f * pull, 0f));
                    }

                    final int x = (int) mSGD.getFocusX();
@@ -517,7 +468,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
        if (DEBUG) Log.d(TAG, "scale type " + expandType + " beginning on view: " + v);
        mCallback.setUserLockedChild(v, true);
        setView(v);
        setGlow(GLOW_BASE);
        mScaler.setView(v);
        mOldHeight = mScaler.getHeight();
        if (mCallback.canChildBeExpanded(v)) {
@@ -549,7 +499,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
        if (mScaleAnimation.isRunning()) {
            mScaleAnimation.cancel();
        }
        setGlow(0f);
        mCallback.setUserExpandedChild(mCurrView, h == mNaturalHeight);
        if (targetHeight != currentHeight) {
            mScaleAnimation.setFloatValues(targetHeight);
@@ -571,23 +520,11 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {

    private void clearView() {
        mCurrView = null;
        mCurrViewTopGlow = null;
        mCurrViewBottomGlow = null;

    }

    private void setView(View v) {
        mCurrView = v;
        if (v instanceof ViewGroup) {
            ViewGroup g = (ViewGroup) v;
            mCurrViewTopGlow = g.findViewById(R.id.top_glow);
            mCurrViewBottomGlow = g.findViewById(R.id.bottom_glow);
            if (DEBUG) {
                String debugLog = "Looking for glows: " +
                        (mCurrViewTopGlow != null ? "found top " : "didn't find top") +
                        (mCurrViewBottomGlow != null ? "found bottom " : "didn't find bottom");
                Log.v(TAG,  debugLog);
            }
        }
    }

    @Override
+9 −19
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -11,7 +11,7 @@
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * limitations under the License
 */

package com.android.systemui.statusbar;
@@ -21,12 +21,15 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;

import com.android.internal.R;

public class LatestItemView extends FrameLayout {
/**
 * Base class for both {@link ExpandableNotificationRow} and {@link NotificationOverflowContainer}
 * to implement dimming/activating on Keyguard for the double-tap gesture
 */
public class ActivatableNotificationView extends FrameLayout {

    private static final long DOUBLETAP_TIMEOUT_MS = 1000;

@@ -48,11 +51,12 @@ public class LatestItemView extends FrameLayout {

    private OnActivatedListener mOnActivatedListener;

    public LatestItemView(Context context, AttributeSet attrs) {
    public ActivatableNotificationView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    }


    private final Runnable mTapTimeoutRunnable = new Runnable() {
        @Override
        public void run() {
@@ -65,20 +69,6 @@ public class LatestItemView extends FrameLayout {
        super.setOnClickListener(l);
    }

    @Override
    public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
        if (super.onRequestSendAccessibilityEvent(child, event)) {
            // Add a record for the entire layout since its content is somehow small.
            // The event comes from a leaf view that is interacted with.
            AccessibilityEvent record = AccessibilityEvent.obtain();
            onInitializeAccessibilityEvent(record);
            dispatchPopulateAccessibilityEvent(record);
            event.appendRecord(record);
            return true;
        }
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (mLocked) {
Loading