summaryrefslogtreecommitdiff
path: root/java/com/android/dialershared/bubble/g3doc/INTEGRATION.md
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-19 12:40:59 -0700
committerEric Erfanian <erfanian@google.com>2017-06-19 20:00:08 +0000
commitea7890cd5e829ed3f0b5f726561c569690af2030 (patch)
tree235ab5ab9f9215782c29ef350d275fe12e7b2f74 /java/com/android/dialershared/bubble/g3doc/INTEGRATION.md
parent91ce7d2a476bd04fe525049a37a2f8b2824e9724 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/159428781. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/158012278 (6/05/2017) to cl/159428781 (6/19/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Merged-In: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030 Change-Id: If1fa394df2609f0d38b4f794c83f4db3f1006484
Diffstat (limited to 'java/com/android/dialershared/bubble/g3doc/INTEGRATION.md')
-rw-r--r--java/com/android/dialershared/bubble/g3doc/INTEGRATION.md69
1 files changed, 69 insertions, 0 deletions
diff --git a/java/com/android/dialershared/bubble/g3doc/INTEGRATION.md b/java/com/android/dialershared/bubble/g3doc/INTEGRATION.md
new file mode 100644
index 000000000..a13a6053b
--- /dev/null
+++ b/java/com/android/dialershared/bubble/g3doc/INTEGRATION.md
@@ -0,0 +1,69 @@
+# Floating Bubble Integration
+
+go/bubble-integration
+
+Author: keyboardr@
+
+Last Updated: 2017-06-06
+
+Floating bubbles provide a lightweight means of providing interactive UI while
+the user is away from the app. This document details the steps necessary to
+integrate these bubbles into your app.
+
+[TOC]
+
+![Floating bubble](images/bubble_collapsed.png){height=400}
+
+## Ensure Bubbles can be shown
+
+Add the `android.permission.SYSTEM_ALERT_WINDOW` permission to your manifest.
+Before you show the bubble, call `Bubble.canShowBubbles(Context)` to see if the
+user has granted you permission. If not, you can start an Activity from
+`Bubble.getRequestPermissionIntent(Context)` to navigate the user to the system
+settings to enable drawing over other apps. This is more than just a simple
+runtime permission; the user must explicitly allow you to draw over other apps
+via this system setting. System apps may have this allowed by default, but be
+sure to test.
+
+## Create your initial `BubbleInfo`
+
+Use `BubbleInfo.builder()` to populate a `BubbleInfo` with your color, main
+icon, main Intent (which should navigate back to your app), starting Y position,
+and a list of `Actions` to put in the drawer. Each `Action` will define its
+icon, user-displayable name (used for content description), Intent to perform
+when clicked, whether it is enabled (optional, default true), and whether it is
+checked (optional, default false).
+
+![Floating bubble expanded](images/bubble_expanded.png){height=400}
+
+## Create, show, and hide the Bubble
+
+Create the bubble using `Bubble.createBubble(Context, BubbleInfo)`. The `show()`
+method is safe to call at any time. If the Bubble is already showing, it is a
+no-op. `hide()` may also be called at any time and will collapse the drawer
+before hiding if already open. While `show()` will show immediately, `hide()`
+may need to wait for other operations or animations before the bubble is hidden.
+It is unlikely you will need to keep track of this, however. The bubble will be
+hidden at its next opportunity, and `hide()` will not block.
+
+![Floating bubble with state](images/bubble_state.png){height=400}
+
+## Update the Bubble's state
+
+Call `Bubble.setBubbleInfo(BubbleInfo)` to update all displayed state.
+`BubbleInfo`s are immutable, so to make a new one using an existing
+`BubbleInfo`, use `BubbleInfo.from(BubbleInfo)` to get a `Builder` with
+prepopulated info. If only the `Action` state has changed, it is more efficient
+to just call `Bubble.updateActions(List<Action>)`
+
+![Floating bubble with text](images/bubble_text.png){height=400}
+
+## Show text
+
+To temporarily replace the icon with a textual message, call
+`Bubble.showText(CharSequence)`. The text will be displayed for several seconds
+before transitioning back to the primary icon. The drawer will be closed if open
+and cannot be reopened while the text is displayed. Any calls to `hide()` will
+be deferred until after the text is done being displayed, so if you wish to show
+an ending message of some sort you may call `hide()` immediately after
+`showText(CharSequence)`.