diff --git a/app/src/main/java/io/heckel/ntfy/ui/CustomHeaderFragment.kt b/app/src/main/java/io/heckel/ntfy/ui/CustomHeaderFragment.kt
index f734a93c..68ce533f 100644
--- a/app/src/main/java/io/heckel/ntfy/ui/CustomHeaderFragment.kt
+++ b/app/src/main/java/io/heckel/ntfy/ui/CustomHeaderFragment.kt
@@ -1,6 +1,5 @@
package io.heckel.ntfy.ui
-import android.app.AlertDialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
@@ -8,7 +7,9 @@ import android.view.View
import android.view.WindowManager
import android.widget.Button
import android.widget.TextView
+import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.textfield.TextInputEditText
import io.heckel.ntfy.R
import io.heckel.ntfy.db.CustomHeader
@@ -54,19 +55,19 @@ class CustomHeaderFragment : DialogFragment() {
val view = requireActivity().layoutInflater.inflate(R.layout.fragment_custom_header_dialog, null)
val positiveButtonTextResId = if (header == null) R.string.custom_headers_add else R.string.custom_headers_save
- val titleView = view.findViewById(R.id.custom_header_dialog_title) as TextView
- val descriptionView = view.findViewById(R.id.custom_header_dialog_description) as TextView
+ val descriptionView: TextView = view.findViewById(R.id.custom_header_dialog_description)
baseUrlView = view.findViewById(R.id.custom_header_dialog_base_url)
headerNameView = view.findViewById(R.id.custom_header_dialog_name)
headerValueView = view.findViewById(R.id.custom_header_dialog_value)
+ var title: String
if (header == null) {
- titleView.text = getString(R.string.custom_headers_add_title)
+ title = getString(R.string.custom_headers_add_title)
descriptionView.text = getString(R.string.custom_header_dialog_description_add)
baseUrlView.visibility = View.VISIBLE
} else {
- titleView.text = getString(R.string.custom_headers_edit_title)
+ title = getString(R.string.custom_headers_edit_title)
descriptionView.text = getString(R.string.custom_header_dialog_description_edit)
baseUrlView.visibility = View.GONE
baseUrlView.setText(header!!.baseUrl)
@@ -75,7 +76,8 @@ class CustomHeaderFragment : DialogFragment() {
}
// Build dialog
- val builder = AlertDialog.Builder(activity)
+ val builder = MaterialAlertDialogBuilder(requireContext())
+ .setTitle(title)
.setView(view)
.setPositiveButton(positiveButtonTextResId) { _, _ ->
saveClicked()
@@ -140,7 +142,7 @@ class CustomHeaderFragment : DialogFragment() {
listener.onAddCustomHeader(this, newHeader)
} else {
val newHeader = CustomHeader(
- if (baseUrl.isEmpty()) header!!.baseUrl else baseUrl,
+ baseUrl.ifEmpty { header!!.baseUrl },
headerName,
headerValue
)
diff --git a/app/src/main/res/layout/fragment_custom_header_dialog.xml b/app/src/main/res/layout/fragment_custom_header_dialog.xml
index 74acf3f9..8b82662a 100644
--- a/app/src/main/res/layout/fragment_custom_header_dialog.xml
+++ b/app/src/main/res/layout/fragment_custom_header_dialog.xml
@@ -1,55 +1,81 @@
-
-
+
+
+
+
-
+ android:text="@string/custom_header_dialog_description_add"
+ android:textColor="?android:attr/textColorSecondary"/>
-
-
-
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="?dialogPreferredPadding"
+ android:paddingTop="?dialogPreferredPadding"
+ android:hint="@string/custom_header_dialog_base_url_hint">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index de8383e0..42b30f73 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -371,8 +371,8 @@
Löschen
Ungültiger Header
Ungültige Zeichen im Header-Namen
- Header-Name (z.B. CF-Access-Client-Id)
- Header-Wert
+ Name (z.B. CF-Access-Client-Id)
+ Wert
Einen benutzerdefinierten HTTP-Header hinzufügen, der mit jeder Anfrage an den angegebenen Server gesendet wird.
Den Header-Namen/Wert bearbeiten oder löschen.
Service-URL
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e608f38d..ebb67d12 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -424,8 +424,8 @@
Delete
Invalid Header
Header name contains invalid characters
- Header name (e.g., CF-Access-Client-Id)
- Header value
+ Name (e.g. CF-Access-Client-Id)
+ Value
Add a custom HTTP header that will be sent with every request to the specified server.
You may edit the header name/value for the selected header, or delete it.
Service URL