Replace deprecated sharedViewModel by activityViewModel
This commit is contained in:
parent
e19be55f83
commit
f67c1d5544
13 changed files with 26 additions and 26 deletions
|
@ -13,11 +13,11 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.checkbox.MaterialCheckBox
|
import com.google.android.material.checkbox.MaterialCheckBox
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class AppSelectionFragment : Fragment() {
|
class AppSelectionFragment : Fragment() {
|
||||||
|
|
||||||
private val viewModel: RestoreViewModel by sharedViewModel()
|
private val viewModel: RestoreViewModel by activityViewModel()
|
||||||
|
|
||||||
private val layoutManager = LinearLayoutManager(context)
|
private val layoutManager = LinearLayoutManager(context)
|
||||||
private val adapter = AppSelectionAdapter(lifecycleScope, this::loadIcon) { item ->
|
private val adapter = AppSelectionAdapter(lifecycleScope, this::loadIcon) { item ->
|
||||||
|
|
|
@ -14,11 +14,11 @@ import android.widget.Button
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import org.calyxos.backup.storage.ui.restore.FileSelectionFragment
|
import org.calyxos.backup.storage.ui.restore.FileSelectionFragment
|
||||||
import org.calyxos.backup.storage.ui.restore.FilesItem
|
import org.calyxos.backup.storage.ui.restore.FilesItem
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
internal class FilesSelectionFragment : FileSelectionFragment() {
|
internal class FilesSelectionFragment : FileSelectionFragment() {
|
||||||
|
|
||||||
override val viewModel: RestoreViewModel by sharedViewModel()
|
override val viewModel: RestoreViewModel by activityViewModel()
|
||||||
private lateinit var button: Button
|
private lateinit var button: Button
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
|
|
@ -13,11 +13,11 @@ import android.widget.Button
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class RecycleBackupFragment : Fragment() {
|
class RecycleBackupFragment : Fragment() {
|
||||||
|
|
||||||
private val viewModel: RestoreViewModel by sharedViewModel()
|
private val viewModel: RestoreViewModel by activityViewModel()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
|
|
|
@ -17,10 +17,10 @@ import androidx.fragment.app.Fragment
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import org.calyxos.backup.storage.api.SnapshotItem
|
import org.calyxos.backup.storage.api.SnapshotItem
|
||||||
import org.calyxos.backup.storage.ui.restore.SnapshotFragment
|
import org.calyxos.backup.storage.ui.restore.SnapshotFragment
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
internal class RestoreFilesFragment : SnapshotFragment() {
|
internal class RestoreFilesFragment : SnapshotFragment() {
|
||||||
override val viewModel: RestoreViewModel by sharedViewModel()
|
override val viewModel: RestoreViewModel by activityViewModel()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
|
|
|
@ -22,11 +22,11 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.ui.AppBackupState.FAILED_NOT_INSTALLED
|
import com.stevesoltys.seedvault.ui.AppBackupState.FAILED_NOT_INSTALLED
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class RestoreProgressFragment : Fragment() {
|
class RestoreProgressFragment : Fragment() {
|
||||||
|
|
||||||
private val viewModel: RestoreViewModel by sharedViewModel()
|
private val viewModel: RestoreViewModel by activityViewModel()
|
||||||
|
|
||||||
private val layoutManager = LinearLayoutManager(context)
|
private val layoutManager = LinearLayoutManager(context)
|
||||||
private val adapter = RestoreProgressAdapter(lifecycleScope, this::loadIcon)
|
private val adapter = RestoreProgressAdapter(lifecycleScope, this::loadIcon)
|
||||||
|
|
|
@ -18,11 +18,11 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.transport.restore.RestorableBackup
|
import com.stevesoltys.seedvault.transport.restore.RestorableBackup
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class RestoreSetFragment : Fragment() {
|
class RestoreSetFragment : Fragment() {
|
||||||
|
|
||||||
private val viewModel: RestoreViewModel by sharedViewModel()
|
private val viewModel: RestoreViewModel by activityViewModel()
|
||||||
|
|
||||||
private lateinit var listView: RecyclerView
|
private lateinit var listView: RecyclerView
|
||||||
private lateinit var progressBar: ProgressBar
|
private lateinit var progressBar: ProgressBar
|
||||||
|
|
|
@ -26,11 +26,11 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.restore.RestoreViewModel
|
import com.stevesoltys.seedvault.restore.RestoreViewModel
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class InstallProgressFragment : Fragment(), InstallItemListener {
|
class InstallProgressFragment : Fragment(), InstallItemListener {
|
||||||
|
|
||||||
private val viewModel: RestoreViewModel by sharedViewModel()
|
private val viewModel: RestoreViewModel by activityViewModel()
|
||||||
|
|
||||||
private val layoutManager = LinearLayoutManager(context)
|
private val layoutManager = LinearLayoutManager(context)
|
||||||
private val adapter = InstallProgressAdapter(lifecycleScope, this::loadIcon, this)
|
private val adapter = InstallProgressAdapter(lifecycleScope, this::loadIcon, this)
|
||||||
|
|
|
@ -18,7 +18,7 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
internal interface AppStatusToggleListener {
|
internal interface AppStatusToggleListener {
|
||||||
fun onAppStatusToggled(status: AppStatus)
|
fun onAppStatusToggled(status: AppStatus)
|
||||||
|
@ -26,7 +26,7 @@ internal interface AppStatusToggleListener {
|
||||||
|
|
||||||
class AppStatusFragment : Fragment(), AppStatusToggleListener {
|
class AppStatusFragment : Fragment(), AppStatusToggleListener {
|
||||||
|
|
||||||
private val viewModel: SettingsViewModel by sharedViewModel()
|
private val viewModel: SettingsViewModel by activityViewModel()
|
||||||
|
|
||||||
private val layoutManager = LinearLayoutManager(context)
|
private val layoutManager = LinearLayoutManager(context)
|
||||||
private val adapter = AppStatusAdapter(this)
|
private val adapter = AppStatusAdapter(this)
|
||||||
|
|
|
@ -20,11 +20,11 @@ import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.permitDiskReads
|
import com.stevesoltys.seedvault.permitDiskReads
|
||||||
import com.stevesoltys.seedvault.transport.backup.PackageService
|
import com.stevesoltys.seedvault.transport.backup.PackageService
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class ExpertSettingsFragment : PreferenceFragmentCompat() {
|
class ExpertSettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
private val viewModel: SettingsViewModel by sharedViewModel()
|
private val viewModel: SettingsViewModel by activityViewModel()
|
||||||
private val packageService: PackageService by inject()
|
private val packageService: PackageService by inject()
|
||||||
private val backupManager: IBackupManager by inject()
|
private val backupManager: IBackupManager by inject()
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ import com.stevesoltys.seedvault.backend.BackendManager
|
||||||
import com.stevesoltys.seedvault.permitDiskReads
|
import com.stevesoltys.seedvault.permitDiskReads
|
||||||
import com.stevesoltys.seedvault.settings.preference.M3ListPreference
|
import com.stevesoltys.seedvault.settings.preference.M3ListPreference
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class SchedulingFragment : PreferenceFragmentCompat(),
|
class SchedulingFragment : PreferenceFragmentCompat(),
|
||||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
private val viewModel: SettingsViewModel by sharedViewModel()
|
private val viewModel: SettingsViewModel by activityViewModel()
|
||||||
private val settingsManager: SettingsManager by inject()
|
private val settingsManager: SettingsManager by inject()
|
||||||
private val backendManager: BackendManager by inject()
|
private val backendManager: BackendManager by inject()
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,14 @@ import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager
|
||||||
import com.stevesoltys.seedvault.ui.toRelativeTime
|
import com.stevesoltys.seedvault.ui.toRelativeTime
|
||||||
import org.calyxos.seedvault.core.backends.BackendProperties
|
import org.calyxos.seedvault.core.backends.BackendProperties
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
private val TAG = SettingsFragment::class.java.name
|
private val TAG = SettingsFragment::class.java.name
|
||||||
|
|
||||||
class SettingsFragment : PreferenceFragmentCompat() {
|
class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
private val viewModel: SettingsViewModel by sharedViewModel()
|
private val viewModel: SettingsViewModel by activityViewModel()
|
||||||
private val backendManager: BackendManager by inject()
|
private val backendManager: BackendManager by inject()
|
||||||
private val backupStateManager: BackupStateManager by inject()
|
private val backupStateManager: BackupStateManager by inject()
|
||||||
private val backupManager: IBackupManager by inject()
|
private val backupManager: IBackupManager by inject()
|
||||||
|
|
|
@ -39,14 +39,14 @@ import com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.isDebugBuild
|
import com.stevesoltys.seedvault.isDebugBuild
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
internal const val ARG_FOR_NEW_CODE = "forStoringNewCode"
|
internal const val ARG_FOR_NEW_CODE = "forStoringNewCode"
|
||||||
|
|
||||||
class RecoveryCodeInputFragment : Fragment() {
|
class RecoveryCodeInputFragment : Fragment() {
|
||||||
|
|
||||||
private val viewModel: RecoveryCodeViewModel by sharedViewModel()
|
private val viewModel: RecoveryCodeViewModel by activityViewModel()
|
||||||
|
|
||||||
private lateinit var introText: TextView
|
private lateinit var introText: TextView
|
||||||
private lateinit var doneButton: Button
|
private lateinit var doneButton: Button
|
||||||
|
|
|
@ -18,11 +18,11 @@ import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.stevesoltys.seedvault.R
|
import com.stevesoltys.seedvault.R
|
||||||
import com.stevesoltys.seedvault.isDebugBuild
|
import com.stevesoltys.seedvault.isDebugBuild
|
||||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
import org.koin.androidx.viewmodel.ext.android.activityViewModel
|
||||||
|
|
||||||
class RecoveryCodeOutputFragment : Fragment() {
|
class RecoveryCodeOutputFragment : Fragment() {
|
||||||
|
|
||||||
private val viewModel: RecoveryCodeViewModel by sharedViewModel()
|
private val viewModel: RecoveryCodeViewModel by activityViewModel()
|
||||||
|
|
||||||
private lateinit var wordList: RecyclerView
|
private lateinit var wordList: RecyclerView
|
||||||
private lateinit var confirmCodeButton: Button
|
private lateinit var confirmCodeButton: Button
|
||||||
|
|
Loading…
Reference in a new issue