Merge pull request #2

Add settings menu
This commit is contained in:
Ethan Pearson 2022-10-27 11:53:46 -03:00 committed by GitHub
commit 28dc11863c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.FragmentSettingsBinding
@ -24,15 +23,15 @@ class SettingsFragment : Fragment() {
savedInstanceState: Bundle?
): View {
val homeViewModel =
ViewModelProvider(this).get(SettingsViewModel::class.java)
ViewModelProvider(this)[SettingsViewModel::class.java]
_binding = FragmentSettingsBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textSettings
homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}
// val textView: TextView = binding.textSettings
// homeViewModel.text.observe(viewLifecycleOwner) {
// textView.text = it
// }
return root
}

View File

@ -1,22 +1,60 @@
<?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"
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
android:id="@+id/text_settings"
android:id="@+id/setting_video_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:text="@string/settings_video_size" />
<RadioButton
android:id="@+id/setting_default_size_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_default_size" />
<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>

View File

@ -3,4 +3,11 @@
<string name="title_compressing">Compressing</string>
<string name="title_completed">Completed</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>