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 a238800b32
commit 0e4ed7f4fe
6 changed files with 22 additions and 56 deletions
@@ -13,23 +13,24 @@ import android.view.View;
import android.view.ViewGroup; 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 * 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 * 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: * other apart and settle above and to the right of it. The next touch picks:
* a soft spotlight follows it inside the bubble, leans toward whichever icon * a soft spotlight follows the thumb inside the bubble, leans toward whichever
* it's near (so it needn't be exact), and that icon gets a glowing blue ring. * icon it's near (so it needn't be exact), and that icon gets a glowing blue
* Let go on one to attach that; let go on none and they all slip back under * ring. Let go on one to attach that; let go on none and they all slip back
* the clip as the bubble sinks. * 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 * <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 * 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 * 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. * 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 * <p>Lives on the window's decor while open and takes its touches itself.
* 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.
*/ */
final class AttachBubble extends View { final class AttachBubble extends View {
interface OnPick { interface OnPick {
@@ -69,7 +70,6 @@ final class AttachBubble extends View {
private float width; // the bubble's right edge private float width; // the bubble's right edge
private float tx, ty; // the thumb private float tx, ty; // the thumb
private boolean touched; // the thumb has moved since the bubble opened 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. // 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]; 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; width = cx + (float) Math.cos(Math.toRadians(HOME_DEG[n - 1])) * HOME_DIST * dp + iconR + margin;
tx = cx; tx = cx;
ty = cy; ty = cy;
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
invalidate(); invalidate();
} }
@@ -230,18 +230,8 @@ final class AttachBubble extends View {
if (pick >= 0) performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); 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 @Override
public boolean onTouchEvent(MotionEvent e) { public boolean onTouchEvent(MotionEvent e) {
if (!sticky) return true;
switch (e.getActionMasked()) { switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
@@ -39,8 +39,6 @@ public final class ChatActivity extends BaseActivity {
private static final int PICK = 1; private static final int PICK = 1;
private static final int VOICE = 2; private static final int VOICE = 2;
private static final int CAMERA = 3; private static final int CAMERA = 3;
/** A press on the paperclip shorter than this (ms), without dragging, is a tap: the bubble stays open. */
private static final int TAP_MS = 250;
private static final int MAX_PHOTOS = 3; private static final int MAX_PHOTOS = 3;
private String did, contact; private String did, contact;
@@ -64,8 +62,6 @@ public final class ChatActivity extends BaseActivity {
// Audio playing in the list: one at a time, keyed "id/index". // Audio playing in the list: one at a time, keyed "id/index".
private android.media.MediaPlayer player; private android.media.MediaPlayer player;
private String playing; private String playing;
// The bubble while a press on the paperclip is feeding it.
private AttachBubble bubble;
// Where the camera is writing the photo it's taking. // Where the camera is writing the photo it's taking.
private Uri shot; private Uri shot;
@@ -183,7 +179,7 @@ public final class ChatActivity extends BaseActivity {
// of the composer, cut off. // of the composer, cut off.
row.setBaselineAligned(false); row.setBaselineAligned(false);
attach = Ui.headerButton(this, Glyph.Kind.ATTACH); attach = Ui.headerButton(this, Glyph.Kind.ATTACH);
attach.setOnTouchListener((v, e) -> attachTouch(e)); attach.setOnClickListener(v -> openAttach());
compactButton(attach); compactButton(attach);
input = new EditText(this); input = new EditText(this);
input.setHint("Message"); input.setHint("Message");
@@ -382,33 +378,13 @@ public final class ChatActivity extends BaseActivity {
} }
/** /**
* Press the paperclip and the bubble is out at once: drag to a choice and * Tap the paperclip and the bubble opens; tap a choice, or anywhere else
* let go. A quick tap leaves it open to tap a choice (or anywhere else to close). * to close it. Not hold-and-drag: the clip sits in the R1's bottom 48 dp,
* where a swipe up is the system's home gesture, and no app can opt out of that.
*/ */
private boolean attachTouch(android.view.MotionEvent e) { private void openAttach() {
switch (e.getActionMasked()) { // Google Voice only lets apps send photos: no voice-note choice there.
case android.view.MotionEvent.ACTION_DOWN: new AttachBubble(this, attach, composerBox, !Config.get(this).isGv(did), this::attachKind).show(this);
attach.getParent().requestDisallowInterceptTouchEvent(true);
// Google Voice only lets apps send photos: no voice-note choice there.
bubble = new AttachBubble(this, attach, composerBox, !Config.get(this).isGv(did), this::attachKind);
bubble.show(this);
return true;
case android.view.MotionEvent.ACTION_MOVE:
if (bubble != null) bubble.move(e.getRawX(), e.getRawY());
return true;
case android.view.MotionEvent.ACTION_UP:
if (bubble == null) return true;
if (e.getEventTime() - e.getDownTime() < TAP_MS && !bubble.dragged()) bubble.stay();
else bubble.release();
bubble = null;
return true;
case android.view.MotionEvent.ACTION_CANCEL:
if (bubble != null) bubble.dismiss();
bubble = null;
return true;
default:
return true;
}
} }
private void attachKind(int which) { private void attachKind(int which) {
+2 -2
View File
@@ -26,8 +26,8 @@ import sys
import zipfile import zipfile
from pathlib import Path from pathlib import Path
VERSION_NAME = "0.7.6" VERSION_NAME = "0.7.7"
VERSION_CODE = 14 VERSION_CODE = 15
PACKAGE = "me.teafry.voipmessages" PACKAGE = "me.teafry.voipmessages"
DEV_PACKAGE = PACKAGE + ".dev" DEV_PACKAGE = PACKAGE + ".dev"
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "voipms-desktop", "name": "voipms-desktop",
"productName": "bubble", "productName": "bubble",
"version": "0.9.3", "version": "0.9.4",
"description": "Signal-style desktop SMS client for voip.ms", "description": "Signal-style desktop SMS client for voip.ms",
"author": "trav <trav@teafry.me>", "author": "trav <trav@teafry.me>",
"private": true, "private": true,
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
{"version_name": "0.7.6", "version_code": 14, "package": "me.teafry.voipmessages"} {"version_name": "0.7.7", "version_code": 15, "package": "me.teafry.voipmessages"}