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

Commit b58c7568 authored by Lyn Han's avatar Lyn Han
Browse files

Bubble overflow - core functionality

BubbleStackView
- create show-overflow-button
- create expanded view to show overflow activity

BubbleOverflowActivity
- add adapter for recycler view of BadgedImageViews
- select bubble to promote it out of overflow, to first bubble in row

BubbleExpandedView
- create overflow intent
- add null bubble checks for overflow expanded view

BubbleData
- new list: overflow bubbles
- only repack bubbles in row (leave overflow order alone)
- update sortKey() to account for last access in addition to last
update. When users select a bubble to promote it out of overflow, it
counts as one access (instead of update); if sortKey does not check last
accessed time, the order is lost in the next repacking and the bubble goes
back to overflow.
- remove oldest bubbles if overflow bubble count > 16

BubbleController
- add callback that updates overflow activity when data changes
- allow overflow activity to set callback
- add/remove bubbles from bubble row ui

BadgedImageView
- set update() param to bubble only
- save other params in Bubble.java so that overflow can update
BadgedImageView with just a bubble

Bug: 138116789
Fixes: 148232991
Fixes: 148232992
Test: (manual) add 5+ bubbles: show-overflow-button shows in bubble row
Test: (manual) tap show-overflow-button: overflow shows aged out bubbles
Test: (manual) remove bubbles, count <= 5: overflow button hides
Test: (manual) tap bubble in overflow: bubble promoted to left of top row
Test: atest SystemUITests

Change-Id: I020ee4c9e16b236043c5cc244e610725e86bcc37
parent 412d30ef
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2020 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.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:viewportHeight="24"
    android:viewportWidth="24"
    android:height="52dp"
    android:width="52dp">
    <path android:fillColor="#1A73E8"
          android:pathData="M6,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
 No newline at end of file
+4 −3
Original line number Diff line number Diff line
@@ -13,8 +13,9 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bubble_overflow_recycler"
    android:scrollbars="vertical"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"/>
    android:layout_gravity="center_horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
       ~ Copyright (C) 2020 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.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ 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
  -->
<ImageView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bubble_overflow_button"
    android:layout_width="@dimen/individual_bubble_size"
    android:layout_height="@dimen/individual_bubble_size"
    android:src="@drawable/ic_bubble_overflow_button"
    android:scaleType="center"
    android:layout_gravity="end"/>
+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,12 @@
         performance issues arise. -->
    <integer name="bubbles_max_rendered">5</integer>

    <!-- Number of columns in bubble overflow. -->
    <integer name="bubbles_overflow_columns">4</integer>

    <!-- Maximum number of bubbles we allow in overflow before we dismiss the oldest one. -->
    <integer name="bubbles_max_overflow">16</integer>

    <!-- Ratio of "left" end of status bar that will swipe to QQS. -->
    <integer name="qqs_split_fraction">3</integer>
    <!-- Ratio of "right" end of status bar that will swipe to QS. -->
+4 −4
Original line number Diff line number Diff line
@@ -89,12 +89,12 @@ public class BadgedImageView extends ImageView {
    /**
     * Updates the view with provided info.
     */
    public void update(Bubble bubble, Bitmap bubbleImage, int dotColor, Path dotPath) {
    public void update(Bubble bubble) {
        mBubble = bubble;
        setImageBitmap(bubbleImage);
        setImageBitmap(bubble.getBadgedImage());
        setDotState(DOT_STATE_SUPPRESSED_FOR_FLYOUT);
        mDotColor = dotColor;
        drawDot(dotPath);
        mDotColor = bubble.getDotColor();
        drawDot(bubble.getDotPath());
        animateDot();
    }

Loading