From 4efaa0888153f87057f8bd7bb0c8f49b9075a27a Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 13 Sep 2019 12:48:51 -0300 Subject: [PATCH] Show notification right away when requesting manual backup --- .../com/stevesoltys/backup/settings/SettingsViewModel.kt | 8 +++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/stevesoltys/backup/settings/SettingsViewModel.kt b/app/src/main/java/com/stevesoltys/backup/settings/SettingsViewModel.kt index 033a8dd3..3959aa9f 100644 --- a/app/src/main/java/com/stevesoltys/backup/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/stevesoltys/backup/settings/SettingsViewModel.kt @@ -1,6 +1,8 @@ package com.stevesoltys.backup.settings import android.app.Application +import com.stevesoltys.backup.Backup +import com.stevesoltys.backup.R import com.stevesoltys.backup.transport.requestBackup import com.stevesoltys.backup.ui.RequireProvisioningViewModel @@ -10,6 +12,10 @@ class SettingsViewModel(app: Application) : RequireProvisioningViewModel(app) { override val isRestoreOperation = false - fun backupNow() = Thread { requestBackup(app) }.start() + fun backupNow() { + val nm = (app as Backup).notificationManager + nm.onBackupUpdate(app.getString(R.string.notification_backup_starting), 0, 1, true) + Thread { requestBackup(app) }.start() + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4cd909e0..abeeedfe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -73,6 +73,7 @@ Backup Notification Backup running + Starting Backup… Backup complete Not backed up Backup failed