From 44b47b49bc676680f8229bede8249672ba7f4d59 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 23 Feb 2020 13:05:39 -0500 Subject: [PATCH] Hide null file path on backup creation (closes #1515) (cherry picked from commit 48d9ad00e11836b00c5dcd8f114fe513fa0f34b2) --- .../ui/setting/SettingsBackupController.kt | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt index 597cc4eef2..008be7b248 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt @@ -278,18 +278,20 @@ class SettingsBackupController : SettingsController() { override fun onCreateDialog(savedViewState: Bundle?): Dialog { val activity = activity!! val unifile = UniFile.fromUri(activity, args.getParcelable(KEY_URI)) - return MaterialDialog.Builder(activity) - .title(R.string.backup_created) - .content(activity.getString(R.string.file_saved, unifile.filePath)) - .positiveText(R.string.action_close) - .negativeText(R.string.action_export) - .onNegative { _, _ -> - val sendIntent = Intent(Intent.ACTION_SEND) - sendIntent.type = "application/json" - sendIntent.putExtra(Intent.EXTRA_STREAM, unifile.uri) - startActivity(Intent.createChooser(sendIntent, "")) - } - .build() + return MaterialDialog.Builder(activity).apply { + title(R.string.backup_created) + if (unifile.filePath != null) { + content(activity.getString(R.string.file_saved, unifile.filePath)) + } + positiveText(R.string.action_close) + negativeText(R.string.action_export) + onNegative { _, _ -> + val sendIntent = Intent(Intent.ACTION_SEND) + sendIntent.type = "application/json" + sendIntent.putExtra(Intent.EXTRA_STREAM, unifile.uri) + startActivity(Intent.createChooser(sendIntent, "")) + } + }.build() } private companion object {