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

Commit d3cf756a authored by Rohan Shah's avatar Rohan Shah
Browse files

Add alarm info to QS Panel

Added alarm info in the same space as the tooltip. Moved the header info
out to the QuickStatusBarHeader to consolidate all header views.

Since, theoretically, there can be some weird races between the
animations of the long press tooltip and the alarm info, added
protective animation state code in the header (such as fading out the
long press tooltip before animating in the alarm text).

Fully removed the alarm tile.

Test: Visually/manually
Bug: 73764084
Change-Id: Ic1ec450e560a56567f9efeb04d3efbd916f05bc3
parent 17bc6993
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
@@ -14,20 +14,45 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<com.android.systemui.qs.QSTooltipView
    xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/header_text_container"
    android:layout_width="match_parent"
    android:layout_height="@dimen/qs_header_tooltip_height"
    android:alpha="0"
    android:gravity="center_horizontal|bottom"
    android:visibility="invisible">
    android:layout_below="@id/quick_status_bar_system_icons"
    android:layout_marginTop="12dp">

    <TextView
        android:id="@+id/header_text"
        android:id="@+id/long_press_tooltip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:alpha="0"
        android:text="@string/quick_settings_header_onboarding_text"
        android:textAppearance="@style/TextAppearance.QS.TileLabel"
        android:textColor="?android:attr/colorAccent" />
        android:textColor="?android:attr/colorAccent"
        android:visibility="invisible" />

    <LinearLayout
        android:id="@+id/next_alarm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:gravity="center_vertical"
        android:visibility="invisible">

        <ImageView
            android:layout_width="@dimen/qs_header_alarm_icon_size"
            android:layout_height="@dimen/qs_header_alarm_icon_size"
            android:src="@drawable/stat_sys_alarm"
            android:tint="?android:attr/textColorPrimary" />

        <TextView
            android:id="@+id/next_alarm_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/qs_header_alarm_text_margin_start"
            android:textAppearance="@style/TextAppearance.QS.TileLabel" />

    </LinearLayout>

</com.android.systemui.qs.QSTooltipView>
</FrameLayout>
+5 −0
Original line number Diff line number Diff line
@@ -32,8 +32,13 @@
    android:elevation="4dp" >

    <include layout="@layout/quick_status_bar_header_system_icons" />

    <!-- Status icons within the panel itself (and not in the top-most status bar) -->
    <include layout="@layout/quick_qs_status_icons" />

    <!-- Layout containing tooltips, alarm text, etc. -->
    <include layout="@layout/quick_settings_header_info" />

    <com.android.systemui.qs.QuickQSPanel
        android:id="@+id/quick_qs_panel"
        android:layout_width="match_parent"
+4 −2
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@
    <dimen name="qs_tile_padding_bottom">16dp</dimen>
    <dimen name="qs_tile_spacing">4dp</dimen>
    <dimen name="qs_panel_padding_bottom">0dp</dimen>
    <dimen name="qs_panel_padding_top">32dp</dimen>
    <dimen name="qs_panel_padding_top">30dp</dimen>
    <dimen name="qs_detail_header_height">56dp</dimen>
    <dimen name="qs_detail_header_padding">0dp</dimen>
    <dimen name="qs_detail_image_width">56dp</dimen>
@@ -345,7 +345,9 @@
    <dimen name="qs_detail_item_icon_width">32dp</dimen>
    <dimen name="qs_detail_item_icon_marginStart">0dp</dimen>
    <dimen name="qs_detail_item_icon_marginEnd">20dp</dimen>
    <dimen name="qs_header_tooltip_height">30dp</dimen>
    <dimen name="qs_header_tooltip_height">18dp</dimen>
    <dimen name="qs_header_alarm_icon_size">18dp</dimen>
    <dimen name="qs_header_alarm_text_margin_start">6dp</dimen>
    <dimen name="qs_footer_padding_start">16dp</dimen>
    <dimen name="qs_footer_padding_end">24dp</dimen>
    <dimen name="qs_footer_icon_size">16dp</dimen>
+0 −27
Original line number Diff line number Diff line
@@ -66,10 +66,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
    private TouchAnimator mNonfirstPageDelayedAnimator;
    private TouchAnimator mBrightnessAnimator;

    /**
     * Whether we're in the middle of animating between the collapsed and expanded states.
     */
    private boolean mIsAnimating;
    private boolean mOnKeyguard;

    private boolean mAllowFancy;
@@ -94,9 +90,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
            Log.w(TAG, "QS Not using page layout");
        }
        panel.setPageListener(this);

        // At time of creation, the QS panel is never animating.
        mIsAnimating = false;
    }

    public void onRtlChanged() {
@@ -251,11 +244,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
            } else {
                mBrightnessAnimator = null;
            }
            View headerView = mQsPanel.getHeaderView();
            if (headerView!= null) {
                firstPageBuilder.addFloat(headerView, "translationY", heightDiff, 0);
                mAllViews.add(headerView);
            }
            mFirstPageAnimator = firstPageBuilder
                    .setListener(this)
                    .build();
@@ -342,21 +330,11 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha

    @Override
    public void onAnimationAtStart() {
        if (mIsAnimating) {
            mQsPanel.onCollapse();
        }
        mIsAnimating = false;

        mQuickQsPanel.setVisibility(View.VISIBLE);
    }

    @Override
    public void onAnimationAtEnd() {
        if (mIsAnimating) {
            mQsPanel.onExpanded();
        }
        mIsAnimating = false;

        mQuickQsPanel.setVisibility(View.INVISIBLE);
        final int N = mQuickQsViews.size();
        for (int i = 0; i < N; i++) {
@@ -366,11 +344,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha

    @Override
    public void onAnimationStarted() {
        if (!mIsAnimating) {
            mQsPanel.onAnimating();
        }
        mIsAnimating = true;

        mQuickQsPanel.setVisibility(mOnKeyguard ? View.INVISIBLE : View.VISIBLE);
        if (mOnFirstPage) {
            final int N = mQuickQsViews.size();
+12 −6
Original line number Diff line number Diff line
@@ -272,21 +272,27 @@ public class QSFragment extends Fragment implements QS {
        mContainer.setExpansion(expansion);
        final float translationScaleY = expansion - 1;
        if (!mHeaderAnimating) {
            int height = mHeader.getHeight();
            getView().setTranslationY(mKeyguardShowing ? (translationScaleY * height)
            getView().setTranslationY(
                    mKeyguardShowing
                            ? translationScaleY * mHeader.getHeight()
                            : headerTranslation);
        }
        if (expansion == mLastQSExpansion) {
            return;
        }
        mLastQSExpansion = expansion;
        mHeader.setExpansion(mKeyguardShowing ? 1 : expansion);
        mFooter.setExpansion(mKeyguardShowing ? 1 : expansion);

        boolean fullyExpanded = expansion == 1;
        int heightDiff = mQSPanel.getBottom() - mHeader.getBottom() + mHeader.getPaddingBottom()
                + mFooter.getHeight();
        float panelTranslationY = translationScaleY * heightDiff;

        // Let the views animate their contents correctly by giving them the necessary context.
        mHeader.setExpansion(mKeyguardShowing, expansion, panelTranslationY);
        mFooter.setExpansion(mKeyguardShowing ? 1 : expansion);
        mQSPanel.setTranslationY(translationScaleY * heightDiff);
        boolean fullyExpanded = expansion == 1;
        mQSDetail.setFullyExpanded(fullyExpanded);

        if (fullyExpanded) {
            // Always draw within the bounds of the view when fully expanded.
            mQSPanel.setClipBounds(null);
Loading