diff --git a/android/app/src/main/java/me/teafry/voipmessages/AttachBubble.java b/android/app/src/main/java/me/teafry/voipmessages/AttachBubble.java index 5a9b753..244bd98 100644 --- a/android/app/src/main/java/me/teafry/voipmessages/AttachBubble.java +++ b/android/app/src/main/java/me/teafry/voipmessages/AttachBubble.java @@ -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. + * + *

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. * *

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. * - *

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. + *

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: diff --git a/android/app/src/main/java/me/teafry/voipmessages/ChatActivity.java b/android/app/src/main/java/me/teafry/voipmessages/ChatActivity.java index e3cae5d..d7d080e 100644 --- a/android/app/src/main/java/me/teafry/voipmessages/ChatActivity.java +++ b/android/app/src/main/java/me/teafry/voipmessages/ChatActivity.java @@ -39,8 +39,6 @@ public final class ChatActivity extends BaseActivity { private static final int PICK = 1; private static final int VOICE = 2; 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 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". private android.media.MediaPlayer player; 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. private Uri shot; @@ -183,7 +179,7 @@ public final class ChatActivity extends BaseActivity { // of the composer, cut off. row.setBaselineAligned(false); attach = Ui.headerButton(this, Glyph.Kind.ATTACH); - attach.setOnTouchListener((v, e) -> attachTouch(e)); + attach.setOnClickListener(v -> openAttach()); compactButton(attach); input = new EditText(this); 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 - * let go. A quick tap leaves it open to tap a choice (or anywhere else to close). + * Tap the paperclip and the bubble opens; tap a choice, or anywhere else + * 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) { - switch (e.getActionMasked()) { - case android.view.MotionEvent.ACTION_DOWN: - 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 openAttach() { + // Google Voice only lets apps send photos: no voice-note choice there. + new AttachBubble(this, attach, composerBox, !Config.get(this).isGv(did), this::attachKind).show(this); } private void attachKind(int which) { diff --git a/android/build.py b/android/build.py index 714c6ea..bd5450f 100644 --- a/android/build.py +++ b/android/build.py @@ -26,8 +26,8 @@ import sys import zipfile from pathlib import Path -VERSION_NAME = "0.7.6" -VERSION_CODE = 14 +VERSION_NAME = "0.7.7" +VERSION_CODE = 15 PACKAGE = "me.teafry.voipmessages" DEV_PACKAGE = PACKAGE + ".dev" diff --git a/package.json b/package.json index 9e4bad0..35ac4cf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "voipms-desktop", "productName": "bubble", - "version": "0.9.3", + "version": "0.9.4", "description": "Signal-style desktop SMS client for voip.ms", "author": "trav ", "private": true, diff --git a/resources/android/VoipMessages.apk b/resources/android/VoipMessages.apk index 8402a67..fc59aef 100644 Binary files a/resources/android/VoipMessages.apk and b/resources/android/VoipMessages.apk differ diff --git a/resources/android/VoipMessages.json b/resources/android/VoipMessages.json index fa15c4c..598e3c5 100644 --- a/resources/android/VoipMessages.json +++ b/resources/android/VoipMessages.json @@ -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"}