v0.9.4: bubble for Android 0.7.7 — tap the paperclip, then tap a choice (holding and swiping up went home)

This commit is contained in:
2026-11-15 15:07:35 -08:00
parent e5439d37bd
commit ea9ce012e4
6 changed files with 22 additions and 56 deletions
@@ -13,23 +13,24 @@ import android.view.View;
import android.view.ViewGroup;
/**
* Hold the paperclip and the composer swells upward into a bubble while
* Tap the paperclip and the composer swells upward into a bubble while
* camera, photo and microphone (no microphone on a Google Voice chat, which
* can't send voice notes) float out from under the clip, jostle each
* other apart and settle above and to the right of it. The thumb stays down:
* a soft spotlight follows it inside the bubble, leans toward whichever icon
* it's near (so it needn't be exact), and that icon gets a glowing blue ring.
* Let go on one to attach that; let go on none and they all slip back under
* the clip as the bubble sinks.
* other apart and settle above and to the right of it. The next touch picks:
* a soft spotlight follows the thumb inside the bubble, leans toward whichever
* icon it's near (so it needn't be exact), and that icon gets a glowing blue
* ring. Let go on one to attach that; let go on none and they all slip back
* under the clip as the bubble sinks.
*
* <p>Not hold-and-drag from the clip: on the R1 the clip is in the bottom
* 48 dp, where a swipe up is the system's home gesture.
*
* <p>The way out is a little physics: each icon is sprung to a home spot and
* the icons push each other away, launched a beat apart in nearly the same
* direction so they bump and fan out. The bubble's height just chases the
* icons. The way back is a plain ease-in, since they're only going away.
*
* <p>Lives on the window's decor while open; the paperclip's own touch
* listener feeds it ({@link #move}, {@link #release}) since the touch began there.
* After a quick tap ({@link #stay}) it takes the next touch itself instead.
* <p>Lives on the window's decor while open and takes its touches itself.
*/
final class AttachBubble extends View {
interface OnPick {
@@ -69,7 +70,6 @@ final class AttachBubble extends View {
private float width; // the bubble's right edge
private float tx, ty; // the thumb
private boolean touched; // the thumb has moved since the bubble opened
private boolean sticky; // opened by a tap: the next touch picks or closes
// Icon state, in dp from the clip's centre with y up.
private final float[] px = new float[3], py = new float[3], vx = new float[3], vy = new float[3];
@@ -134,7 +134,7 @@ final class AttachBubble extends View {
width = cx + (float) Math.cos(Math.toRadians(HOME_DEG[n - 1])) * HOME_DIST * dp + iconR + margin;
tx = cx;
ty = cy;
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
invalidate();
}
@@ -230,18 +230,8 @@ final class AttachBubble extends View {
if (pick >= 0) performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);
}
boolean dragged() {
return touched;
}
/** Opened by a quick tap: stay out until the next touch. */
void stay() {
sticky = true;
}
@Override
public boolean onTouchEvent(MotionEvent e) {
if (!sticky) return true;
switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: