Manually refine look and feel

This commit is contained in:
Philipp Heckel 2026-01-11 22:43:55 -05:00
parent 916475f035
commit 88bfee1ea7
3 changed files with 27 additions and 26 deletions

View file

@ -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()) {

View file

@ -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" />
<!-- Error icon -->
<ImageView
android:id="@+id/connection_error_dialog_error_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="8dp"
app:srcCompat="@drawable/ic_error_red_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/connection_error_dialog_countdown" />
<!-- Error message text (red, like AddFragment) -->
<!-- Error message text (red) -->
<TextView
android:id="@+id/connection_error_dialog_error_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingStart="4dp"
android:layout_marginStart="28dp"
android:paddingStart="0dp"
android:paddingEnd="4dp"
android:textAppearance="@style/DangerText"
android:textColor="?attr/colorError"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/connection_error_dialog_error_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/connection_error_dialog_countdown" />
<!-- Error icon (top-aligned with error text) -->
<ImageView
android:id="@+id/connection_error_dialog_error_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="2dp"
android:paddingStart="2dp"
android:paddingEnd="0dp"
app:srcCompat="@drawable/ic_error_red_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/connection_error_dialog_error_text" />
<!-- Stack trace (scrollable horizontally, no word wrap) -->
<HorizontalScrollView
android:id="@+id/connection_error_dialog_details_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginTop="12dp"
android:fillViewport="true"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -291,12 +291,7 @@
<!-- Connection error dialog -->
<string name="connection_error_dialog_title">Connection error</string>
<string name="connection_error_dialog_message">There was a problem connecting to the server. The app will keep trying to reconnect in the background.</string>
<string name="connection_error_dialog_server_label">Server</string>
<string name="connection_error_dialog_error_label">Error message</string>
<string name="connection_error_dialog_details">Details</string>
<string name="connection_error_dialog_no_stack_trace">No additional details available</string>
<string name="connection_error_dialog_no_error">No error</string>
<string name="connection_error_dialog_message">There was a problem connecting to %1$s. The app will keep trying to reconnect in the background.</string>
<string name="connection_error_dialog_connection_refused">Connection refused. The server may be down or the address may be incorrect.</string>
<string name="connection_error_dialog_copy">Copy</string>
<string name="connection_error_dialog_retry_now">Retry now</string>