mirror of https://github.com/x13a/Wasted.git
change some ui to be material
This commit is contained in:
parent
8b76258cf7
commit
d8d1aef706
|
@ -6,7 +6,6 @@ import android.content.pm.PackageManager
|
|||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.SeekBar
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -60,7 +59,7 @@ open class MainActivity : AppCompatActivity() {
|
|||
wipeData.isChecked = prefs.isWipeData
|
||||
wipeESIM.isChecked = prefs.isWipeESIM
|
||||
wipeESIM.isEnabled = wipeData.isChecked
|
||||
maxFailedPasswordAttempts.progress = prefs.maxFailedPasswordAttempts
|
||||
maxFailedPasswordAttempts.value = prefs.maxFailedPasswordAttempts.toFloat()
|
||||
toggle.isChecked = prefs.isServiceEnabled
|
||||
}
|
||||
}
|
||||
|
@ -87,20 +86,9 @@ open class MainActivity : AppCompatActivity() {
|
|||
wipeESIM.setOnCheckedChangeListener { _, isChecked ->
|
||||
prefs.isWipeESIM = isChecked
|
||||
}
|
||||
maxFailedPasswordAttempts.setOnSeekBarChangeListener(
|
||||
object : SeekBar.OnSeekBarChangeListener {
|
||||
|
||||
override fun onProgressChanged(
|
||||
seekBar: SeekBar?,
|
||||
progress: Int,
|
||||
fromUser: Boolean,
|
||||
) {
|
||||
prefs.maxFailedPasswordAttempts = progress
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {}
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
|
||||
})
|
||||
maxFailedPasswordAttempts.addOnChangeListener { _, value, _ ->
|
||||
prefs.maxFailedPasswordAttempts = value.toInt()
|
||||
}
|
||||
toggle.setOnCheckedChangeListener { _, isChecked ->
|
||||
when (isChecked) {
|
||||
true -> if (!admin.isActive()) requestAdmin() else setOn()
|
||||
|
|
|
@ -2,7 +2,7 @@ package me.lucky.wasted
|
|||
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
import info.guardianproject.panic.PanicResponder
|
||||
|
||||
|
@ -30,7 +30,7 @@ class PanicConnectionActivity : MainActivity() {
|
|||
} catch (exc: PackageManager.NameNotFoundException) {}
|
||||
}
|
||||
|
||||
AlertDialog.Builder(this)
|
||||
MaterialAlertDialogBuilder(this)
|
||||
.setTitle(getString(R.string.panic_app_dialog_title))
|
||||
.setMessage(String.format(getString(R.string.panic_app_dialog_message), app))
|
||||
.setNegativeButton(R.string.allow) { _, _ ->
|
||||
|
|
|
@ -88,13 +88,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="16dp" />
|
||||
|
||||
<SeekBar
|
||||
<com.google.android.material.slider.Slider
|
||||
android:id="@+id/maxFailedPasswordAttempts"
|
||||
style="@style/Widget.AppCompat.SeekBar.Discrete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:max="10"
|
||||
android:progress="0" />
|
||||
android:valueFrom="0"
|
||||
android:valueTo="10"
|
||||
android:stepSize="1.0" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in New Issue