Fix toolbar issues: setSupportActionBar in Editor and Settings

- Add toolbar setup in NoteEditorActivity
- Add toolbar setup in SettingsActivity
- Add toolbar to activity_settings.xml layout
- Fix back button and menu display issues
This commit is contained in:
inventory69
2025-12-20 01:12:44 +01:00
parent 0ef50d5d5a
commit 61ff005477
3 changed files with 142 additions and 120 deletions

View File

@@ -1,150 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
android:layout_height="?attr/actionBarSize"
app:title="@string/settings"
app:navigationIcon="?attr/homeAsUpIndicator" />
<!-- Server Settings -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/server_settings"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginBottom="16dp" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/server_url"
android:layout_marginBottom="8dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextServerUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:layout_marginBottom="8dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
android:layout_marginBottom="16dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
app:endIconMode="password_toggle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<!-- WiFi Settings -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wifi_settings"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp">
android:orientation="vertical"
android:padding="16dp">
<!-- Server Settings -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/server_settings"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginBottom="16dp" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/home_ssid"
android:layout_marginEnd="8dp"
android:hint="@string/server_url"
android:layout_marginBottom="8dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextHomeSSID"
android:id="@+id/editTextServerUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
android:layout_marginBottom="8dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/buttonDetectSSID"
android:layout_width="wrap_content"
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Detect"
android:hint="@string/password"
android:layout_marginBottom="16dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
app:endIconMode="password_toggle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<!-- WiFi Settings -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wifi_settings"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="8dp">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/home_ssid"
android:layout_marginEnd="8dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/editTextHomeSSID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/buttonDetectSSID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Detect"
style="@style/Widget.Material3.Button.OutlinedButton" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/auto_sync"
android:textSize="16sp"
android:layout_gravity="center_vertical" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switchAutoSync"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- Actions -->
<Button
android:id="@+id/buttonTestConnection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test_connection"
android:layout_marginTop="8dp"
style="@style/Widget.Material3.Button.OutlinedButton" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="0dp"
<Button
android:id="@+id/buttonSyncNow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/auto_sync"
android:textSize="16sp"
android:layout_gravity="center_vertical" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switchAutoSync"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:text="@string/sync_now"
android:layout_marginTop="8dp" />
</LinearLayout>
<!-- Actions -->
<Button
android:id="@+id/buttonTestConnection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test_connection"
android:layout_marginTop="8dp"
style="@style/Widget.Material3.Button.OutlinedButton" />
</ScrollView>
<Button
android:id="@+id/buttonSyncNow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sync_now"
android:layout_marginTop="8dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>