From 04c4bc2d5b854761b452984fef6596935427fb91 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Thu, 20 Jan 2022 21:43:28 -0500 Subject: [PATCH] Docs; pause notification dialog style --- .../java/io/heckel/ntfy/service/WsConnection.kt | 10 ++++++++++ .../java/io/heckel/ntfy/ui/SettingsActivity.kt | 2 +- .../res/layout/fragment_notification_dialog.xml | 16 ++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/service/WsConnection.kt b/app/src/main/java/io/heckel/ntfy/service/WsConnection.kt index 9ea00a5..fd76294 100644 --- a/app/src/main/java/io/heckel/ntfy/service/WsConnection.kt +++ b/app/src/main/java/io/heckel/ntfy/service/WsConnection.kt @@ -18,6 +18,16 @@ import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicLong import kotlin.random.Random +/** + * Connect to ntfy server via WebSockets. This connection represents a single connection to a server, with + * one or more topics. When the topics are changed, the connection is recreated by the service. + * + * The connection re-connects on failure, indefinitely. It reports limited status via the stateChangeListener, + * and forwards incoming messages via the notificationListener. + * + * The original class is taken from the fantastic Gotify project (MIT). Thank you: + * https://github.com/gotify/android/blob/master/app/src/main/java/com/github/gotify/service/WebSocketConnection.java + */ class WsConnection( private val repository: Repository, private val baseUrl: String, diff --git a/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt index e8631fa..e6b486f 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt @@ -45,7 +45,7 @@ class SettingsActivity : AppCompatActivity() { Log.d(TAG, "Create $this") if (savedInstanceState == null) { - fragment = SettingsFragment() + fragment = SettingsFragment() // Empty constructor! supportFragmentManager .beginTransaction() .replace(R.id.settings_layout, fragment) diff --git a/app/src/main/res/layout/fragment_notification_dialog.xml b/app/src/main/res/layout/fragment_notification_dialog.xml index a5a51c6..0ca6cd1 100644 --- a/app/src/main/res/layout/fragment_notification_dialog.xml +++ b/app/src/main/res/layout/fragment_notification_dialog.xml @@ -16,10 +16,10 @@ android:paddingBottom="8dp" android:text="@string/notification_dialog_title" android:textAlignment="viewStart" - android:textAppearance="?android:attr/textAppearanceLarge" + android:textAppearance="?android:attr/textAppearanceMedium" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:paddingStart="5dp" android:paddingEnd="5dp" - android:textColor="?android:attr/textColorPrimary"/> + android:textColor="?android:attr/textColorPrimary" />