v0.9.1: bubble for Android 0.7.6 — pictures have the bubble's round corners; no "MMS Sent"
Android: a picture in a chat is clipped to the bubble's 30 dp corner, sent and received. Checked on the Rabbit with the dev app (the sandbox now has a made-up picture each way). Both: voip.ms gives a picture we sent with no words the text "MMS Sent", like the "MMS Received" already dropped; that goes too, from new messages and (once) from ones already stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -754,6 +754,14 @@ public final class ChatActivity extends BaseActivity {
|
||||
ImageView iv = new ImageView(c);
|
||||
iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
iv.setBackgroundColor(0x22FFFFFF);
|
||||
// The picture's corners match the bubble's (30 dp).
|
||||
float corner = Ui.dp(c, 30);
|
||||
iv.setOutlineProvider(new android.view.ViewOutlineProvider() {
|
||||
@Override public void getOutline(View v, android.graphics.Outline o) {
|
||||
o.setRoundRect(0, 0, v.getWidth(), v.getHeight(), corner);
|
||||
}
|
||||
});
|
||||
iv.setClipToOutline(true);
|
||||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(bw, bh);
|
||||
iv.setLayoutParams(new LinearLayout.LayoutParams(bw, bh));
|
||||
String tag = id + "/" + index;
|
||||
|
||||
@@ -96,6 +96,11 @@ final class Store {
|
||||
db.execSQL("UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms received'");
|
||||
set("mms_received_stripped", "1");
|
||||
}
|
||||
// ...and one we sent with no words "MMS Sent".
|
||||
if (get("mms_sent_stripped") == null) {
|
||||
db.execSQL("UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms sent'");
|
||||
set("mms_sent_stripped", "1");
|
||||
}
|
||||
if (get("unread_floor") == null) set("unread_floor", String.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ final class VoipMs {
|
||||
for (String u : urls) refs.put(new JSONObject().put("url", u));
|
||||
m.mediaJson = refs.toString();
|
||||
// voip.ms's own stand-in text for a picture with no words, not the sender's.
|
||||
if (m.body.trim().equalsIgnoreCase("MMS Received")) m.body = "";
|
||||
if (m.body.trim().equalsIgnoreCase("MMS Received") || m.body.trim().equalsIgnoreCase("MMS Sent")) m.body = "";
|
||||
} else if (Phone.charCount(m.body) > Phone.SMS_TEXT_LIMIT) {
|
||||
m.kind = "mms";
|
||||
}
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ import sys
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
VERSION_NAME = "0.7.5"
|
||||
VERSION_CODE = 13
|
||||
VERSION_NAME = "0.7.6"
|
||||
VERSION_CODE = 14
|
||||
|
||||
PACKAGE = "me.teafry.voipmessages"
|
||||
DEV_PACKAGE = PACKAGE + ".dev"
|
||||
|
||||
@@ -17,7 +17,9 @@ import json
|
||||
import os
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import struct
|
||||
import tempfile
|
||||
import zlib
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
@@ -26,6 +28,12 @@ VOIP, GV = "5415550100", "5415550177"
|
||||
GROUP = "5415550101,5415550102,5415550103"
|
||||
|
||||
|
||||
def gradient_png(w: int, h: int) -> bytes:
|
||||
raw = b"".join(b"\0" + bytes(c for x in range(w) for c in (x * 255 // w, y * 255 // h, 160)) for y in range(h))
|
||||
chunk = lambda t, b: struct.pack(">I", len(b)) + t + b + struct.pack(">I", zlib.crc32(t + b))
|
||||
return b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, 8, 2, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(raw)) + chunk(b"IEND", b"")
|
||||
|
||||
|
||||
def push(local: Path, name: str):
|
||||
with open(local, "rb") as f:
|
||||
subprocess.run(["adb", "shell", f"run-as {PKG} sh -c 'cat > files/{name}'"], stdin=f, check=True)
|
||||
@@ -84,6 +92,12 @@ def main():
|
||||
rows.append((SIM_BASE + 1, "sim", "5415550150", "in", "Texting your SIM number now", now - 20 * m, None))
|
||||
rows.append((SIM_BASE + 2, "sim", "5415550150", "out", "Got it, this is the SIM", now - 19 * m, None))
|
||||
con.executemany("INSERT INTO messages (id, did, contact, direction, body, ts, sender) VALUES (?,?,?,?,?,?,?)", rows)
|
||||
# Pictures both ways (a made-up gradient), to see their corners.
|
||||
pic = Path(d) / "sandbox-pic.png"
|
||||
pic.write_bytes(gradient_png(400, 300))
|
||||
ref = json.dumps([{"file": "sandbox-pic.png", "mime": "image/png", "width": 400, "height": 300}])
|
||||
con.execute("INSERT INTO messages (id, did, contact, direction, body, ts, kind, media_json) VALUES (1007, ?, '5415550110', 'in', 'Look at this', ?, 'mms', ?)", (VOIP, now - 280 * m, ref))
|
||||
con.execute("INSERT INTO messages (id, did, contact, direction, body, ts, kind, media_json) VALUES (1008, ?, '5415550110', 'out', '', ?, 'mms', ?)", (VOIP, now - 279 * m, ref))
|
||||
con.execute("INSERT INTO kv VALUES ('unread_floor', '0')")
|
||||
con.execute("INSERT INTO gv_threads VALUES (?, ?, 'g.demo')", (GV, GROUP))
|
||||
con.commit()
|
||||
@@ -99,6 +113,8 @@ def main():
|
||||
}))
|
||||
push(db, "messages.db")
|
||||
push(cfg, "config.json")
|
||||
subprocess.run(["adb", "shell", f"run-as {PKG} mkdir -p files/media"], check=True)
|
||||
push(pic, "media/sandbox-pic.png")
|
||||
subprocess.run(["adb", "shell", "am", "start", "-n", f"{PKG}/me.teafry.voipmessages.MainActivity"], check=True)
|
||||
print("sandbox data pushed to", PKG)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user