New menu, organizing settings to its separate categories

This commit is contained in:
partisan 2025-05-11 17:21:25 +02:00
parent cba93c6069
commit 663463cd38
12 changed files with 398 additions and 246 deletions

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,880L373,720L160,720Q127,720 103.5,696.5Q80,673 80,640L80,160Q80,127 103.5,103.5Q127,80 160,80L800,80Q833,80 856.5,103.5Q880,127 880,160L880,640Q880,673 856.5,696.5Q833,720 800,720L587,720L480,880ZM480,736L544,640L800,640Q800,640 800,640Q800,640 800,640L800,160Q800,160 800,160Q800,160 800,160L160,160Q160,160 160,160Q160,160 160,160L160,640Q160,640 160,640Q160,640 160,640L416,640L480,736ZM480,400L480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Z"/>
</vector>

View file

@ -1,100 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="32dp"
tools:context=".MainActivity">
android:layout_height="match_parent">
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/description"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Main content -->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="16dp"
android:layout_marginVertical="16dp"
app:layout_constraintTop_toBottomOf="@id/description"
app:layout_constraintBottom_toTopOf="@id/toggle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorSurface"
app:titleTextColor="?attr/colorOnSurface"
app:navigationIconTint="?attr/colorOnSurface"
app:title="@string/app_name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/topAppBar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.slider.Slider
android:id="@+id/redirectionDelay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stepSize="0.5"
android:valueFrom="2"
android:valueTo="4"
android:contentDescription="@string/redirection_delay_description" />
<TextView
android:id="@+id/description2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/redirection_delay_description"
android:textSize="12sp" />
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="8dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/popupPosition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="custom"
app:endIconDrawable="@drawable/ic_baseline_check_circle_24"
android:hint="@string/popup_position">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="8dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="8dp"
android:background="?android:attr/listDivider" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/serviceRecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:scrollbars="vertical" />
</LinearLayout>
</ScrollView>
<ToggleButton
android:id="@+id/toggle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingVertical="12dp"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- Sliding menu -->
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigationView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/main_menu" />
</androidx.drawerlayout.widget.DrawerLayout>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ToggleButton
android:id="@+id/toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp" />
</FrameLayout>

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="32dp"
tools:context=".PopupSettingsFragment">
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/popup_settings_description"
android:textSize="16sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<CheckBox
android:id="@+id/popupEnabledCheckbox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/popup_enabled"
android:textSize="14sp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/description"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/popupPreview" />
<Button
android:id="@+id/popupPreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test"
app:layout_constraintTop_toTopOf="@id/popupEnabledCheckbox"
app:layout_constraintBottom_toBottomOf="@id/popupEnabledCheckbox"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginStart="8dp" />
<ScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/popupEnabledCheckbox"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.slider.Slider
android:id="@+id/redirectionDelay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stepSize="0.5"
android:valueFrom="2"
android:valueTo="4"
android:layout_marginTop="8dp"
android:contentDescription="@string/redirection_delay_description" />
<TextView
android:id="@+id/delayDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/redirection_delay_description"
android:textSize="12sp"
android:layout_marginTop="4dp" />
<com.google.android.material.slider.Slider
android:id="@+id/popupHeightSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"
android:valueTo="100"
android:stepSize="1"
android:layout_marginTop="16dp"
android:contentDescription="@string/popup_position" />
<TextView
android:id="@+id/heightDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/popup_position"
android:textSize="12sp"
android:layout_marginTop="4dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="16dp"
android:background="?android:attr/listDivider" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/serviceRecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_marginTop="8dp" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,14 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
android:title="Settings" />
<item
android:id="@+id/action_about"
android:title="About" />
<item
android:id="@+id/action_popup_settings"
android:title="Popup Settings"
android:icon="@drawable/tooltip_24px"
app:showAsAction="never" />
</menu>

View file

@ -12,4 +12,9 @@
<string name="fallback">Fallback</string>
<string name="activate_description">To start, grant the required permissions and tap the Activate button.</string>
<string name="activate">Activate</string>
<string name="navigation_drawer_open">Open menu</string>
<string name="navigation_drawer_close">Close menu</string>
<string name="popup_settings_description">Configure popup behavior, position, and delay.</string>
<string name="popup_enabled">Popup enabled</string>
<string name="test">Test</string>
</resources>