Docs; pause notification dialog style
This commit is contained in:
parent
955f3922d1
commit
04c4bc2d5b
3 changed files with 25 additions and 3 deletions
|
@ -18,6 +18,16 @@ import java.util.concurrent.TimeUnit
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
import kotlin.random.Random
|
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(
|
class WsConnection(
|
||||||
private val repository: Repository,
|
private val repository: Repository,
|
||||||
private val baseUrl: String,
|
private val baseUrl: String,
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
Log.d(TAG, "Create $this")
|
Log.d(TAG, "Create $this")
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
fragment = SettingsFragment()
|
fragment = SettingsFragment() // Empty constructor!
|
||||||
supportFragmentManager
|
supportFragmentManager
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.settings_layout, fragment)
|
.replace(R.id.settings_layout, fragment)
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
android:text="@string/notification_dialog_title"
|
android:text="@string/notification_dialog_title"
|
||||||
android:textAlignment="viewStart"
|
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_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" android:paddingStart="5dp" android:paddingEnd="5dp"
|
app:layout_constraintEnd_toEndOf="parent" android:paddingStart="5dp" android:paddingEnd="5dp"
|
||||||
android:textColor="?android:attr/textColorPrimary"/>
|
android:textColor="?android:attr/textColorPrimary" />
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -32,6 +32,8 @@
|
||||||
android:layout_height="wrap_content" android:id="@+id/notification_dialog_30min"
|
android:layout_height="wrap_content" android:id="@+id/notification_dialog_30min"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
android:paddingStart="5dp"
|
||||||
/>
|
/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:text="@string/notification_dialog_1h"
|
android:text="@string/notification_dialog_1h"
|
||||||
|
@ -39,6 +41,8 @@
|
||||||
android:layout_height="wrap_content" android:id="@+id/notification_dialog_1h"
|
android:layout_height="wrap_content" android:id="@+id/notification_dialog_1h"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
android:paddingStart="5dp"
|
||||||
/>
|
/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:text="@string/notification_dialog_2h"
|
android:text="@string/notification_dialog_2h"
|
||||||
|
@ -46,6 +50,8 @@
|
||||||
android:layout_height="wrap_content" android:id="@+id/notification_dialog_2h"
|
android:layout_height="wrap_content" android:id="@+id/notification_dialog_2h"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
android:paddingStart="5dp"
|
||||||
/>
|
/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:text="@string/notification_dialog_8h"
|
android:text="@string/notification_dialog_8h"
|
||||||
|
@ -53,6 +59,8 @@
|
||||||
android:layout_height="wrap_content" android:id="@+id/notification_dialog_8h"
|
android:layout_height="wrap_content" android:id="@+id/notification_dialog_8h"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
android:paddingStart="5dp"
|
||||||
/>
|
/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:text="@string/notification_dialog_tomorrow"
|
android:text="@string/notification_dialog_tomorrow"
|
||||||
|
@ -60,6 +68,8 @@
|
||||||
android:layout_height="wrap_content" android:id="@+id/notification_dialog_tomorrow"
|
android:layout_height="wrap_content" android:id="@+id/notification_dialog_tomorrow"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
android:paddingStart="5dp"
|
||||||
/>
|
/>
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:text="@string/notification_dialog_forever"
|
android:text="@string/notification_dialog_forever"
|
||||||
|
@ -67,6 +77,8 @@
|
||||||
android:layout_height="wrap_content" android:id="@+id/notification_dialog_forever"
|
android:layout_height="wrap_content" android:id="@+id/notification_dialog_forever"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
android:layout_marginTop="-3dp" android:layout_marginBottom="-3dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||||
|
android:paddingStart="5dp"
|
||||||
/>
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
Loading…
Reference in a new issue