Fix #7
This commit is contained in:
parent
d5aea5d98c
commit
6c379259a5
1 changed files with 21 additions and 2 deletions
|
@ -1,8 +1,11 @@
|
|||
package com.nin0dev.vendroid
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.opengl.Visibility
|
||||
import android.os.Bundle
|
||||
import android.service.voice.VoiceInteractionSession.VisibleActivityCallback
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.widget.CheckBox
|
||||
|
@ -13,11 +16,14 @@ import androidx.appcompat.app.AppCompatActivity
|
|||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
import com.google.android.material.materialswitch.MaterialSwitch
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
@SuppressLint("CutPasteId")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val sPrefs = getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
window.statusBarColor = Color.TRANSPARENT
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||
|
@ -25,6 +31,19 @@ class SettingsActivity : AppCompatActivity() {
|
|||
|
||||
setContentView(R.layout.activity_settings)
|
||||
|
||||
findViewById<MaterialSwitch>(R.id.check_vendroid_updates).isChecked = sPrefs.getBoolean("checkVendroidUpdates", false)
|
||||
when (sPrefs.getString("discordBranch", "stable")) {
|
||||
"stable" -> findViewById<MaterialRadioButton>(R.id.stable).isChecked = true
|
||||
"ptb" -> findViewById<MaterialRadioButton>(R.id.ptb).isChecked = true
|
||||
"canary" -> findViewById<MaterialRadioButton>(R.id.canary).isChecked = true
|
||||
}
|
||||
if(sPrefs.getString("vencordLocation", "")?.isNotBlank() == true) {
|
||||
findViewById<CheckBox>(R.id.allow_custom_location).isChecked = true
|
||||
val devbuildField = findViewById<TextInputEditText>(R.id.custom_location)
|
||||
devbuildField.visibility = View.VISIBLE
|
||||
devbuildField.setText(sPrefs.getString("vencordLocation", ""))
|
||||
}
|
||||
|
||||
val devbuildCheckbox = findViewById<CheckBox>(R.id.allow_custom_location)
|
||||
devbuildCheckbox.setOnClickListener {
|
||||
if (devbuildCheckbox.isChecked) {
|
||||
|
@ -41,11 +60,11 @@ class SettingsActivity : AppCompatActivity() {
|
|||
}
|
||||
else {
|
||||
findViewById<EditText>(R.id.custom_location).visibility = View.GONE
|
||||
findViewById<EditText>(R.id.custom_location).setText("")
|
||||
}
|
||||
}
|
||||
|
||||
findViewById<ExtendedFloatingActionButton>(R.id.save_settings).setOnClickListener {
|
||||
val sPrefs = getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||
val editor = sPrefs.edit()
|
||||
|
||||
editor.putBoolean("checkVendroidUpdates", findViewById<MaterialSwitch>(R.id.check_vendroid_updates).isChecked)
|
||||
|
|
Loading…
Reference in a new issue