parent
fc19b50290
commit
d462873e74
@ -1,5 +1,9 @@
|
|||||||
package com.topjohnwu.magisk.ui.install
|
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 androidx.lifecycle.viewModelScope
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
import com.topjohnwu.magisk.arch.BaseUIFragment
|
import com.topjohnwu.magisk.arch.BaseUIFragment
|
||||||
@ -22,4 +26,20 @@ class InstallFragment : BaseUIFragment<InstallViewModel, FragmentInstallMd2Bindi
|
|||||||
BaseDownloader.observeProgress(this, viewModel::onProgressUpdate)
|
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
|
var step = if (skipOptions) 1 else 0
|
||||||
set(value) = set(value, field, { field = it }, BR.step)
|
set(value) = set(value, field, { field = it }, BR.step)
|
||||||
|
|
||||||
|
var _method = -1
|
||||||
|
|
||||||
@get:Bindable
|
@get:Bindable
|
||||||
var method = -1
|
var method
|
||||||
set(value) = set(value, field, { field = it }, BR.method) {
|
get() = _method
|
||||||
|
set(value) = set(value, _method, { _method = it }, BR.method) {
|
||||||
when (it) {
|
when (it) {
|
||||||
R.id.method_patch -> {
|
R.id.method_patch -> {
|
||||||
MagiskInstallFileEvent { code, intent ->
|
MagiskInstallFileEvent { code, intent ->
|
||||||
|
Loading…
Reference in New Issue
Block a user