diff --git a/app/src/main/java/io/heckel/ntfy/ui/ConnectionErrorFragment.kt b/app/src/main/java/io/heckel/ntfy/ui/ConnectionErrorFragment.kt index 598f13f4..a3e1350a 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/ConnectionErrorFragment.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/ConnectionErrorFragment.kt @@ -11,6 +11,7 @@ import android.widget.ArrayAdapter import android.widget.AutoCompleteTextView import android.widget.HorizontalScrollView import android.widget.TextView +import androidx.core.text.HtmlCompat import androidx.fragment.app.DialogFragment import com.google.android.material.appbar.MaterialToolbar import com.google.android.material.color.MaterialColors @@ -20,6 +21,7 @@ import io.heckel.ntfy.db.ConnectionDetails import io.heckel.ntfy.db.Repository import io.heckel.ntfy.service.SubscriberServiceManager import io.heckel.ntfy.util.copyToClipboard +import io.heckel.ntfy.util.shortUrl class ConnectionErrorFragment : DialogFragment() { private lateinit var repository: Repository @@ -189,7 +191,7 @@ class ConnectionErrorFragment : DialogFragment() { private fun updateErrorDisplay() { val baseUrl = selectedBaseUrl ?: return - descriptionTextView.text = getString(R.string.connection_error_dialog_message) + descriptionTextView.text = getString(R.string.connection_error_dialog_message, baseUrl) val details = connectionDetails[baseUrl] if (details != null && details.hasError()) { @@ -205,7 +207,7 @@ class ConnectionErrorFragment : DialogFragment() { detailsScrollView.visibility = View.GONE } } else { - errorTextView.text = getString(R.string.connection_error_dialog_no_error) + errorTextView.visibility = View.GONE detailsScrollView.visibility = View.GONE } updateCountdown() @@ -213,7 +215,7 @@ class ConnectionErrorFragment : DialogFragment() { private fun getErrorDisplayText(error: Throwable?): String { if (error == null) { - return getString(R.string.connection_error_dialog_no_error) + return "" // This should not happen } val message = error.message if (!message.isNullOrBlank()) { diff --git a/app/src/main/res/layout/fragment_connection_error_dialog.xml b/app/src/main/res/layout/fragment_connection_error_dialog.xml index af12bc55..aabd022f 100644 --- a/app/src/main/res/layout/fragment_connection_error_dialog.xml +++ b/app/src/main/res/layout/fragment_connection_error_dialog.xml @@ -48,7 +48,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:hint="@string/connection_error_dialog_server_label" + android:hint="@string/common_service_url" android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -80,7 +80,8 @@ android:id="@+id/connection_error_dialog_countdown" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginTop="16dp" + android:layout_marginTop="8dp" + android:layout_marginBottom="16dp" android:paddingStart="4dp" android:paddingEnd="4dp" android:textAppearance="?android:attr/textAppearanceSmall" @@ -89,35 +90,38 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/connection_error_dialog_description" /> - - - - + + + + Connection error - There was a problem connecting to the server. The app will keep trying to reconnect in the background. - Server - Error message - Details - No additional details available - No error + There was a problem connecting to %1$s. The app will keep trying to reconnect in the background. Connection refused. The server may be down or the address may be incorrect. Copy Retry now