Hide null file path on backup creation (closes #1515)

(cherry picked from commit 48d9ad00e1)
This commit is contained in:
arkon 2020-02-23 13:05:39 -05:00
parent 2f69317f5d
commit 44b47b49bc

View File

@ -278,18 +278,20 @@ class SettingsBackupController : SettingsController() {
override fun onCreateDialog(savedViewState: Bundle?): Dialog { override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val activity = activity!! val activity = activity!!
val unifile = UniFile.fromUri(activity, args.getParcelable(KEY_URI)) val unifile = UniFile.fromUri(activity, args.getParcelable(KEY_URI))
return MaterialDialog.Builder(activity) return MaterialDialog.Builder(activity).apply {
.title(R.string.backup_created) title(R.string.backup_created)
.content(activity.getString(R.string.file_saved, unifile.filePath)) if (unifile.filePath != null) {
.positiveText(R.string.action_close) content(activity.getString(R.string.file_saved, unifile.filePath))
.negativeText(R.string.action_export) }
.onNegative { _, _ -> positiveText(R.string.action_close)
val sendIntent = Intent(Intent.ACTION_SEND) negativeText(R.string.action_export)
sendIntent.type = "application/json" onNegative { _, _ ->
sendIntent.putExtra(Intent.EXTRA_STREAM, unifile.uri) val sendIntent = Intent(Intent.ACTION_SEND)
startActivity(Intent.createChooser(sendIntent, "")) sendIntent.type = "application/json"
} sendIntent.putExtra(Intent.EXTRA_STREAM, unifile.uri)
.build() startActivity(Intent.createChooser(sendIntent, ""))
}
}.build()
} }
private companion object { private companion object {