Don't crash when no store app is installed
This commit is contained in:
parent
c5a295d31c
commit
c7880b8a8b
2 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.stevesoltys.seedvault.restore.install
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -9,6 +10,8 @@ import android.view.ViewGroup
|
|||
import android.widget.Button
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.Fragment
|
||||
|
@ -117,7 +120,11 @@ class InstallProgressFragment : Fragment(), InstallItemListener {
|
|||
}
|
||||
|
||||
override fun onFailedItemClicked(item: ApkInstallResult) {
|
||||
try {
|
||||
installAppLauncher.launch(item)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(requireContext(), R.string.error_no_store, LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
private val installAppLauncher = registerForActivityResult(InstallApp()) { packageName ->
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
<string name="restore_installing_error_title">Some apps not installed</string>
|
||||
<string name="restore_installing_error_message">Data can only be restored if an app is installed.\n\nTap failed apps to try to install them manually before proceeding.</string>
|
||||
<string name="restore_installing_tap_to_install">Tap to install</string>
|
||||
<string name="error_no_store">Error: No app store installed</string>
|
||||
<string name="restore_next">Next</string>
|
||||
<string name="restore_restoring">Restoring backup</string>
|
||||
<string name="restore_restoring_error_title">Unable to restore some apps</string>
|
||||
|
|
Loading…
Reference in a new issue