Merge pull request #276 from cyb3rko/simplify-header

Simplify Navigation Header
This commit is contained in:
Jannis Mattheis
2023-02-08 18:48:04 +01:00
committed by GitHub
3 changed files with 21 additions and 15 deletions

View File

@@ -228,7 +228,7 @@ internal class MessagesActivity :
user.text = settings.user?.name user.text = settings.user?.name
val connection = headerView.findViewById<TextView>(R.id.header_connection) val connection = headerView.findViewById<TextView>(R.id.header_connection)
connection.text = getString(R.string.connection, settings.user?.name, settings.url) connection.text = settings.url
val version = headerView.findViewById<TextView>(R.id.header_version) val version = headerView.findViewById<TextView>(R.id.header_version)
version.text = version.text =

View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height" android:layout_height="wrap_content"
android:minHeight="@dimen/nav_header_height"
android:layout_alignParentBottom="false" android:layout_alignParentBottom="false"
android:background="@drawable/side_nav_bar" android:background="@drawable/side_nav_bar"
android:gravity="bottom" android:gravity="bottom"
@@ -11,7 +13,7 @@
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark"> android:theme="@style/ThemeOverlay.Material3.Dark">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
@@ -21,7 +23,8 @@
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:paddingTop="@dimen/nav_header_vertical_spacing" android:paddingTop="@dimen/nav_header_vertical_spacing"
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/header_user" android:layout_marginTop="30dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/gotify" /> app:srcCompat="@drawable/gotify" />
@@ -30,33 +33,37 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing" android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="jmattheis"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
app:layout_constraintBottom_toTopOf="@+id/header_connection" android:maxLines="2"
app:layout_constraintStart_toStartOf="parent" /> android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/imageView"
app:layout_constraintStart_toStartOf="parent"
tools:text="jmattheis" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/header_connection" android:id="@+id/header_connection"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:text="admin@your.domain.de"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/header_version" android:maxLines="2"
app:layout_constraintStart_toStartOf="parent" /> android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/header_user"
app:layout_constraintStart_toStartOf="parent"
tools:text="https://your.domain.de" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/header_version" android:id="@+id/header_version"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="admin@your.domain.de"
android:textSize="10sp" android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/header_connection"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent"
tools:text="gotify/android vX.X.X; gotify/server vX.X.X" />
<ImageButton <ImageButton
android:id="@+id/refresh_all" android:id="@+id/refresh_all"
style="@style/Widget.AppCompat.Button.Borderless" style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true" android:adjustViewBounds="true"

View File

@@ -67,7 +67,6 @@
<string name="warning">Warning</string> <string name="warning">Warning</string>
<string name="http_warning">Using HTTP is insecure and it\'s recommend to use HTTPS instead. Use your favorite search engine to get more information about this topic.</string> <string name="http_warning">Using HTTP is insecure and it\'s recommend to use HTTPS instead. Use your favorite search engine to get more information about this topic.</string>
<string name="i_understand">I Understand</string> <string name="i_understand">I Understand</string>
<string name="connection">%s@%s</string>
<string name="no_messages_yet">There are no messages, yet.\nSend a message to Gotify\nand it will appear here.</string> <string name="no_messages_yet">There are no messages, yet.\nSend a message to Gotify\nand it will appear here.</string>
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="settings_appearance">Appearance</string> <string name="settings_appearance">Appearance</string>