From 7373341f50ac55066486053b661870145f17de05 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Tue, 13 Oct 2026 15:27:11 +0000 Subject: [PATCH] fix: U cell hint without the port line, blank line before the addresses Co-Authored-By: Claude --- .../app/src/main/java/com/openipc/decoder/Decoder.java | 8 +++++--- .../src/test/java/com/openipc/decoder/QuadGridTest.java | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/java/com/openipc/decoder/Decoder.java b/android/app/src/main/java/com/openipc/decoder/Decoder.java index ffab4504..ac407c9a 100755 --- a/android/app/src/main/java/com/openipc/decoder/Decoder.java +++ b/android/app/src/main/java/com/openipc/decoder/Decoder.java @@ -863,13 +863,15 @@ private void refreshUdpHint() { if (!text.contentEquals(hint.getText())) hint.setText(text); } - /** Hint of the U cell: every usable IPv4 address of the device, one per line (#87). */ + /** + * Hint of the U cell: every usable IPv4 address of the device, one per line (#87). The + * addresses carry the port, so no separate port line. + */ static String udpHintText(List ips, int port) { StringBuilder target = new StringBuilder(); for (String ip : ips) target.append('\n').append(ip).append(':').append(port); if (target.length() == 0) target.append("\nthis device:").append(port); - return "UDP RTP \u00b7 port " + port + "\nWaiting for a stream\u2026\n\n" - + "Send the camera's RTP/UDP output to" + target; + return "Waiting for a stream\u2026\n\nSend the camera's RTP/UDP output to\n" + target; } diff --git a/android/app/src/test/java/com/openipc/decoder/QuadGridTest.java b/android/app/src/test/java/com/openipc/decoder/QuadGridTest.java index ede0a841..041e7664 100644 --- a/android/app/src/test/java/com/openipc/decoder/QuadGridTest.java +++ b/android/app/src/test/java/com/openipc/decoder/QuadGridTest.java @@ -8,6 +8,7 @@ package com.openipc.decoder; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -50,7 +51,8 @@ public void emptyOrMissingUpperSlotsDoNotCount() { @Test public void udpCellHintNamesPortAndAddress() { String t = Decoder.udpHintText(java.util.Arrays.asList("192.168.1.20"), 5600); - assertTrue(t.contains("UDP RTP")); + assertTrue(t, t.startsWith("Waiting for a stream")); + assertFalse(t, t.contains("UDP RTP")); assertTrue(t.contains("192.168.1.20:5600")); // Without a known address the hint still tells where to send the stream assertTrue(Decoder.udpHintText(java.util.Collections.emptyList(), 5600) @@ -69,9 +71,9 @@ public void udpHintListsEveryAddress() { String none = Decoder.udpHintText(java.util.Collections.emptyList(), 5600); assertTrue(none, none.endsWith("\nthis device:5600")); String one = Decoder.udpHintText(java.util.Arrays.asList("172.17.32.144"), 5600); - assertTrue(one, one.endsWith("output to\n172.17.32.144:5600")); + assertTrue(one, one.endsWith("output to\n\n172.17.32.144:5600")); String two = Decoder.udpHintText( java.util.Arrays.asList("172.17.32.144", "192.168.1.20"), 5600); - assertTrue(two, two.endsWith("output to\n172.17.32.144:5600\n192.168.1.20:5600")); + assertTrue(two, two.endsWith("output to\n\n172.17.32.144:5600\n192.168.1.20:5600")); } }