mirror of
https://github.com/binwiederhier/ntfy-android.git
synced 2024-06-02 02:34:33 +12:00
Add foreground description textview in add dialog
This commit is contained in:
parent
1d916de81e
commit
3ea762b5d1
|
@ -46,6 +46,7 @@ class AddFragment : DialogFragment() {
|
|||
private lateinit var subscribeInstantDeliveryBox: View
|
||||
private lateinit var subscribeInstantDeliveryCheckbox: CheckBox
|
||||
private lateinit var subscribeInstantDeliveryDescription: View
|
||||
private lateinit var subscribeForegroundDescription: TextView
|
||||
private lateinit var subscribeProgress: ProgressBar
|
||||
private lateinit var subscribeErrorText: TextView
|
||||
private lateinit var subscribeErrorTextImage: View
|
||||
|
@ -98,6 +99,7 @@ class AddFragment : DialogFragment() {
|
|||
subscribeInstantDeliveryDescription = view.findViewById(R.id.add_dialog_subscribe_instant_delivery_description)
|
||||
subscribeUseAnotherServerCheckbox = view.findViewById(R.id.add_dialog_subscribe_use_another_server_checkbox)
|
||||
subscribeUseAnotherServerDescription = view.findViewById(R.id.add_dialog_subscribe_use_another_server_description)
|
||||
subscribeForegroundDescription = view.findViewById(R.id.add_dialog_subscribe_foreground_description)
|
||||
subscribeProgress = view.findViewById(R.id.add_dialog_subscribe_progress)
|
||||
subscribeErrorText = view.findViewById(R.id.add_dialog_subscribe_error_text)
|
||||
subscribeErrorText.visibility = View.GONE
|
||||
|
@ -111,12 +113,8 @@ class AddFragment : DialogFragment() {
|
|||
loginErrorText = view.findViewById(R.id.add_dialog_login_error_text)
|
||||
loginErrorTextImage = view.findViewById(R.id.add_dialog_login_error_text_image)
|
||||
|
||||
// Set "Use another server" description based on flavor
|
||||
subscribeUseAnotherServerDescription.text = if (BuildConfig.FIREBASE_AVAILABLE) {
|
||||
getString(R.string.add_dialog_use_another_server_description)
|
||||
} else {
|
||||
getString(R.string.add_dialog_use_another_server_description_noinstant)
|
||||
}
|
||||
// Set foreground description text
|
||||
subscribeForegroundDescription.text = getString(R.string.add_dialog_foreground_description, shortUrl(appBaseUrl))
|
||||
|
||||
// Show/hide based on flavor
|
||||
subscribeInstantDeliveryBox.visibility = instantCheckboxVisible()
|
||||
|
@ -209,6 +207,7 @@ class AddFragment : DialogFragment() {
|
|||
validateInputSubscribeView()
|
||||
}
|
||||
subscribeInstantDeliveryBox.visibility = instantCheckboxVisible()
|
||||
subscribeForegroundDescription.visibility = if (!BuildConfig.FIREBASE_AVAILABLE || subscribeInstantDeliveryBox.visibility == View.VISIBLE) View.GONE else View.VISIBLE
|
||||
|
||||
// Focus topic text (keyboard is shown too, see above)
|
||||
subscribeTopicText.requestFocus()
|
||||
|
@ -346,6 +345,7 @@ class AddFragment : DialogFragment() {
|
|||
}
|
||||
subscribeInstantDeliveryBox.visibility = instantCheckboxVisible()
|
||||
subscribeInstantDeliveryDescription.visibility = if (subscribeInstantDeliveryBox.visibility == View.VISIBLE && subscribeInstantDeliveryCheckbox.isChecked) View.VISIBLE else View.GONE
|
||||
subscribeForegroundDescription.visibility = if (!BuildConfig.FIREBASE_AVAILABLE || subscribeInstantDeliveryBox.visibility == View.VISIBLE) View.GONE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
android:paddingStart="4dp" android:paddingTop="3dp" app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_subscribe_title"/>
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/add_dialog_subscribe_topic_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/add_dialog_topic_name_hint"
|
||||
|
@ -88,7 +88,7 @@
|
|||
android:hint="@string/app_base_url"
|
||||
android:maxLines="1"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
|
@ -128,24 +128,31 @@
|
|||
android:visibility="gone" app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_subscribe_instant_delivery_box"/>
|
||||
<ImageView
|
||||
<TextView
|
||||
android:text="@string/add_dialog_foreground_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:id="@+id/add_dialog_subscribe_foreground_description"
|
||||
android:paddingStart="4dp" app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_subscribe_instant_delivery_description"/>
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp" app:srcCompat="@drawable/ic_error_red_24dp"
|
||||
android:id="@+id/add_dialog_subscribe_error_text_image"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@id/add_dialog_subscribe_error_text" android:layout_marginTop="1dp"/>
|
||||
<TextView
|
||||
android:text="Unable to resolve host example.com"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" android:id="@+id/add_dialog_subscribe_error_text"
|
||||
android:paddingStart="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_subscribe_instant_delivery_description"
|
||||
android:paddingEnd="4dp"
|
||||
android:textAppearance="@style/DangerText"
|
||||
app:layout_constraintStart_toEndOf="@id/add_dialog_subscribe_error_text_image"
|
||||
android:layout_marginTop="5dp"
|
||||
tools:visibility="gone"/>
|
||||
<TextView
|
||||
android:text="Unable to resolve host example.com"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" android:id="@+id/add_dialog_subscribe_error_text"
|
||||
android:paddingStart="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_subscribe_foreground_description"
|
||||
android:paddingEnd="4dp"
|
||||
android:textAppearance="@style/DangerText"
|
||||
app:layout_constraintStart_toEndOf="@id/add_dialog_subscribe_error_text_image"
|
||||
android:layout_marginTop="5dp"
|
||||
tools:visibility="gone"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
<ScrollView
|
||||
|
|
|
@ -81,17 +81,10 @@
|
|||
</string>
|
||||
<string name="add_dialog_topic_name_hint">Topic name, e.g. phils_alerts</string>
|
||||
<string name="add_dialog_use_another_server">Use another server</string>
|
||||
<string name="add_dialog_use_another_server_description">
|
||||
You can subscribe to topics from another server. This option requires a foreground service.
|
||||
</string>
|
||||
<string name="add_dialog_use_another_server_description_noinstant">
|
||||
You can subscribe to topics from another server. Type the server URL below.
|
||||
</string>
|
||||
<string name="add_dialog_use_another_server_description">You can subscribe to topics from another server. Type the server URL below.</string>
|
||||
<string name="add_dialog_instant_delivery">Instant delivery in doze mode</string>
|
||||
<string name="add_dialog_instant_delivery_description">
|
||||
Ensures that messages are immediately delivered, even if the device is inactive.
|
||||
This requires a foreground service.
|
||||
</string>
|
||||
<string name="add_dialog_instant_delivery_description">Ensures that messages are immediately delivered, even if the device is inactive.</string>
|
||||
<string name="add_dialog_foreground_description">Instant delivery is always enabled for hosts other than %1$s.</string>
|
||||
<string name="add_dialog_button_cancel">Cancel</string>
|
||||
<string name="add_dialog_button_subscribe">Subscribe</string>
|
||||
<string name="add_dialog_button_back">Back</string>
|
||||
|
|
Loading…
Reference in a new issue