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

Commit 103011ca authored by Matt Pietal's avatar Matt Pietal Committed by Automerger Merge Worker
Browse files

Merge "AOD - Notif icon location" into sc-v2-dev am: e2e1314e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16041990

Change-Id: I589051346f525456024b13810c779502dd62c913
parents dd8c200b e2e1314e
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@
        android:id="@+id/lockscreen_clock_view_large"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/keyguard_status_area"
        android:layout_below="@id/keyguard_slice_view"
        android:visibility="gone">
        <com.android.keyguard.AnimatableClockView
            android:id="@+id/animatable_clock_view_large"
@@ -68,19 +68,28 @@
            lockScreenWeight="400"
        />
    </FrameLayout>
    <include layout="@layout/keyguard_status_area"

    <!-- Not quite optimal but needed to translate these items as a group. The
         NotificationIconContainer has its own logic for translation. -->
    <LinearLayout
        android:id="@+id/keyguard_status_area"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@id/lockscreen_clock_view" />
        android:layout_below="@id/lockscreen_clock_view">

      <include layout="@layout/keyguard_slice_view"
               android:id="@+id/keyguard_slice_view"
               android:layout_width="match_parent"
               android:layout_height="wrap_content" />

      <com.android.systemui.statusbar.phone.NotificationIconContainer
          android:id="@+id/left_aligned_notification_icon_container"
          android:layout_width="match_parent"
          android:layout_height="@dimen/notification_shelf_height"
        android:layout_below="@id/keyguard_status_area"
          android:paddingStart="@dimen/below_clock_padding_start_icons"
          android:visibility="invisible"
          />
    </LinearLayout>
</com.android.keyguard.KeyguardClockSwitch>
+3 −4
Original line number Diff line number Diff line
@@ -22,11 +22,10 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_gravity="start"
    android:clipToPadding="false"
    android:orientation="vertical"
    android:paddingStart="@dimen/below_clock_padding_start"
    android:layout_centerHorizontal="true">
    android:paddingStart="@dimen/below_clock_padding_start">
    <TextView
              android:id="@+id/title"
              android:layout_width="match_parent"
@@ -42,6 +41,6 @@
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              android:gravity="center"
              android:gravity="start"
    />
</com.android.keyguard.KeyguardSliceView>
+0 −3
Original line number Diff line number Diff line
@@ -24,9 +24,6 @@

    <bool name="flag_monet">true</bool>

    <!-- AOD/Lockscreen alternate layout -->
    <bool name="flag_keyguard_layout">true</bool>

    <!-- People Tile flag -->
    <bool name="flag_conversations">false</bool>

+20 −33
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public class KeyguardClockSwitch extends RelativeLayout {

    private static final long CLOCK_OUT_MILLIS = 150;
    private static final long CLOCK_IN_MILLIS = 200;
    private static final long SMARTSPACE_MOVE_MILLIS = 350;
    private static final long STATUS_AREA_MOVE_MILLIS = 350;

    @IntDef({LARGE, SMALL})
    @Retention(RetentionPolicy.SOURCE)
@@ -63,13 +63,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
    private AnimatableClockView mClockView;
    private AnimatableClockView mLargeClockView;

    /**
     * Status area (date and other stuff) shown below the clock. Plugin can decide whether or not to
     * show it below the alternate clock.
     */
    private View mKeyguardStatusArea;
    /** Mutually exclusive with mKeyguardStatusArea */
    private View mSmartspaceView;
    private View mStatusArea;
    private int mSmartspaceTopOffset;

    /**
@@ -85,7 +79,7 @@ public class KeyguardClockSwitch extends RelativeLayout {

    @VisibleForTesting AnimatorSet mClockInAnim = null;
    @VisibleForTesting AnimatorSet mClockOutAnim = null;
    private ObjectAnimator mSmartspaceAnim = null;
    private ObjectAnimator mStatusAreaAnim = null;

    /**
     * If the Keyguard Slice has a header (big center-aligned text.)
@@ -131,7 +125,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
        mClockView = findViewById(R.id.animatable_clock_view);
        mLargeClockFrame = findViewById(R.id.lockscreen_clock_view_large);
        mLargeClockView = findViewById(R.id.animatable_clock_view_large);
        mKeyguardStatusArea = findViewById(R.id.keyguard_status_area);
        mStatusArea = findViewById(R.id.keyguard_status_area);

        onDensityOrFontScaleChanged();
    }
@@ -200,22 +194,22 @@ public class KeyguardClockSwitch extends RelativeLayout {
    private void animateClockChange(boolean useLargeClock) {
        if (mClockInAnim != null) mClockInAnim.cancel();
        if (mClockOutAnim != null) mClockOutAnim.cancel();
        if (mSmartspaceAnim != null) mSmartspaceAnim.cancel();
        if (mStatusAreaAnim != null) mStatusAreaAnim.cancel();

        View in, out;
        int direction = 1;
        float smartspaceYTranslation;
        float statusAreaYTranslation;
        if (useLargeClock) {
            out = mClockFrame;
            in = mLargeClockFrame;
            if (indexOfChild(in) == -1) addView(in);
            direction = -1;
            smartspaceYTranslation = mSmartspaceView == null ? 0
                    : mClockFrame.getTop() - mSmartspaceView.getTop() + mSmartspaceTopOffset;
            statusAreaYTranslation = mClockFrame.getTop() - mStatusArea.getTop()
                    + mSmartspaceTopOffset;
        } else {
            in = mClockFrame;
            out = mLargeClockFrame;
            smartspaceYTranslation = 0f;
            statusAreaYTranslation = 0f;

            // Must remove in order for notifications to appear in the proper place
            removeView(out);
@@ -251,18 +245,16 @@ public class KeyguardClockSwitch extends RelativeLayout {
        mClockInAnim.start();
        mClockOutAnim.start();

        if (mSmartspaceView != null) {
            mSmartspaceAnim = ObjectAnimator.ofFloat(mSmartspaceView, View.TRANSLATION_Y,
                    smartspaceYTranslation);
            mSmartspaceAnim.setDuration(SMARTSPACE_MOVE_MILLIS);
            mSmartspaceAnim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
            mSmartspaceAnim.addListener(new AnimatorListenerAdapter() {
        mStatusAreaAnim = ObjectAnimator.ofFloat(mStatusArea, View.TRANSLATION_Y,
                statusAreaYTranslation);
        mStatusAreaAnim.setDuration(STATUS_AREA_MOVE_MILLIS);
        mStatusAreaAnim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
        mStatusAreaAnim.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                    mSmartspaceAnim = null;
                mStatusAreaAnim = null;
            }
        });
            mSmartspaceAnim.start();
        }
        mStatusAreaAnim.start();
    }

    /**
@@ -352,10 +344,6 @@ public class KeyguardClockSwitch extends RelativeLayout {
        }
    }

    void setSmartspaceView(View smartspaceView) {
        mSmartspaceView = smartspaceView;
    }

    void updateColors(ColorExtractor.GradientColors colors) {
        mSupportsDarkText = colors.supportsDarkText();
        mColorPalette = colors.getColorPalette();
@@ -369,8 +357,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
        pw.println("  mClockPlugin: " + mClockPlugin);
        pw.println("  mClockFrame: " + mClockFrame);
        pw.println("  mLargeClockFrame: " + mLargeClockFrame);
        pw.println("  mKeyguardStatusArea: " + mKeyguardStatusArea);
        pw.println("  mSmartspaceView: " + mSmartspaceView);
        pw.println("  mStatusArea: " + mStatusArea);
        pw.println("  mDarkAmount: " + mDarkAmount);
        pw.println("  mSupportsDarkText: " + mSupportsDarkText);
        pw.println("  mColorPalette: " + Arrays.toString(mColorPalette));
+15 −24
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ import android.app.WallpaperManager;
import android.content.res.Resources;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.android.internal.colorextraction.ColorExtractor;
@@ -99,7 +101,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS

    private final ClockManager.ClockChangedListener mClockChangedListener = this::setClockPlugin;

    // If set, will replace keyguard_status_area
    private ViewGroup mStatusArea;
    // If set will replace keyguard_slice_view
    private View mSmartspaceView;

    private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
@@ -191,8 +194,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
                mView.getResources().getDimensionPixelSize(R.dimen.keyguard_clock_top_margin);

        if (mOnlyClock) {
            View ksa = mView.findViewById(R.id.keyguard_status_area);
            ksa.setVisibility(View.GONE);
            View ksv = mView.findViewById(R.id.keyguard_slice_view);
            ksv.setVisibility(View.GONE);

            View nic = mView.findViewById(
                    R.id.left_aligned_notification_icon_container);
@@ -201,19 +204,18 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }
        updateAodIcons();

        mStatusArea = mView.findViewById(R.id.keyguard_status_area);

        if (mSmartspaceController.isEnabled()) {
            mSmartspaceView = mSmartspaceController.buildAndConnectView(mView);
            View ksv = mView.findViewById(R.id.keyguard_slice_view);
            int ksvIndex = mStatusArea.indexOfChild(ksv);
            ksv.setVisibility(View.GONE);

            View ksa = mView.findViewById(R.id.keyguard_status_area);
            int ksaIndex = mView.indexOfChild(ksa);
            ksa.setVisibility(View.GONE);

            // Place smartspace view below normal clock...
            RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                    MATCH_PARENT, WRAP_CONTENT);
            lp.addRule(RelativeLayout.BELOW, R.id.lockscreen_clock_view);

            mView.addView(mSmartspaceView, ksaIndex, lp);
            mStatusArea.addView(mSmartspaceView, ksvIndex, lp);
            int startPadding = getContext().getResources()
                    .getDimensionPixelSize(R.dimen.below_clock_padding_start);
            int endPadding = getContext().getResources()
@@ -221,14 +223,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
            mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0);

            updateClockLayout();

            View nic = mView.findViewById(
                    R.id.left_aligned_notification_icon_container);
            lp = (RelativeLayout.LayoutParams) nic.getLayoutParams();
            lp.addRule(RelativeLayout.BELOW, mSmartspaceView.getId());
            nic.setLayoutParams(lp);

            mView.setSmartspaceView(mSmartspaceView);
            mSmartspaceTransitionController.setLockscreenSmartspace(mSmartspaceView);
        }
    }
@@ -244,8 +238,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }
        mColorExtractor.removeOnColorsChangedListener(mColorsListener);
        mView.setClockPlugin(null, mStatusBarStateController.getState());

        mSmartspaceController.disconnect();
    }

    /**
@@ -328,8 +320,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        PropertyAnimator.setProperty(mLargeClockFrame, AnimatableProperty.SCALE_Y,
                scale, props, animate);

        if (mSmartspaceView != null) {
            PropertyAnimator.setProperty(mSmartspaceView, AnimatableProperty.TRANSLATION_X,
        if (mStatusArea != null) {
            PropertyAnimator.setProperty(mStatusArea, AnimatableProperty.TRANSLATION_X,
                    x, props, animate);

            // If we're unlocking with the SmartSpace shared element transition, let the controller
@@ -340,7 +332,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }

        mKeyguardSliceViewController.updatePosition(x, props, animate);
        mNotificationIconAreaController.updatePosition(x, props, animate);
    }

    /** Sets an alpha value on every child view except for the smartspace. */
Loading