mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
parent
fc19b50290
commit
d462873e74
@ -1,5 +1,9 @@
|
||||
package com.topjohnwu.magisk.ui.install
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.arch.BaseUIFragment
|
||||
@ -22,4 +26,20 @@ class InstallFragment : BaseUIFragment<InstallViewModel, FragmentInstallMd2Bindi
|
||||
BaseDownloader.observeProgress(this, viewModel::onProgressUpdate)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
viewModel._method = savedInstanceState?.getInt(KEY_CURRENT_METHOD, -1) ?: -1
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
outState.putInt(KEY_CURRENT_METHOD, viewModel.method)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KEY_CURRENT_METHOD = "current_method"
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,12 @@ class InstallViewModel(
|
||||
var step = if (skipOptions) 1 else 0
|
||||
set(value) = set(value, field, { field = it }, BR.step)
|
||||
|
||||
var _method = -1
|
||||
|
||||
@get:Bindable
|
||||
var method = -1
|
||||
set(value) = set(value, field, { field = it }, BR.method) {
|
||||
var method
|
||||
get() = _method
|
||||
set(value) = set(value, _method, { _method = it }, BR.method) {
|
||||
when (it) {
|
||||
R.id.method_patch -> {
|
||||
MagiskInstallFileEvent { code, intent ->
|
||||
|
Loading…
Reference in New Issue
Block a user