Add settings menu

This commit is contained in:
Isaac Shoebottom 2022-10-26 22:55:18 -03:00
parent f2e7e3dd02
commit 7a3c844099
3 changed files with 63 additions and 19 deletions

View File

@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentSettingsBinding import com.example.myapplication.databinding.FragmentSettingsBinding
@ -24,15 +23,15 @@ class SettingsFragment : Fragment() {
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View { ): View {
val homeViewModel = val homeViewModel =
ViewModelProvider(this).get(SettingsViewModel::class.java) ViewModelProvider(this)[SettingsViewModel::class.java]
_binding = FragmentSettingsBinding.inflate(inflater, container, false) _binding = FragmentSettingsBinding.inflate(inflater, container, false)
val root: View = binding.root val root: View = binding.root
val textView: TextView = binding.textSettings // val textView: TextView = binding.textSettings
homeViewModel.text.observe(viewLifecycleOwner) { // homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it // textView.text = it
} // }
return root return root
} }

View File

@ -1,22 +1,60 @@
<?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:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.settings.SettingsFragment"> tools:context=".ui.settings.SettingsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/text_settings" android:id="@+id/setting_video_group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:text="@string/settings_video_size" />
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" <RadioButton
android:textAlignment="center" android:id="@+id/setting_default_size_video"
android:textSize="20sp" android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent" android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent" android:text="@string/settings_default_size" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> <RadioButton
android:id="@+id/setting_big_size_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_big_size" />
<RadioButton
android:id="@+id/setting_huge_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_huge_size" />
<RadioButton
android:id="@+id/setting_custom_size_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_custom_size" />
<EditText
android:id="@+id/setting_custom_size_video_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:ems="10"
android:hint="@string/settings_custom_size_hint"
android:inputType="numberSigned"
android:minHeight="48dp"
android:textColorHint="#757575" />
</RadioGroup>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -3,4 +3,11 @@
<string name="title_compressing">Compressing</string> <string name="title_compressing">Compressing</string>
<string name="title_completed">Completed</string> <string name="title_completed">Completed</string>
<string name="title_settings">Settings</string> <string name="title_settings">Settings</string>
<string name="settings_video_size">Video Size</string>
<string name="settings_image_size">Image Size</string>
<string name="settings_default_size">8mb</string>
<string name="settings_big_size">50mb</string>
<string name="settings_huge_size">500mb</string>
<string name="settings_custom_size">Custom</string>
<string name="settings_custom_size_hint">Enter Size in MB</string>
</resources> </resources>