Move restore progress dialog to notification
This commit is contained in:
@@ -58,20 +58,10 @@ import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class BackupManager(val context: Context, version: Int = CURRENT_VERSION) {
|
||||
|
||||
/**
|
||||
* Database.
|
||||
*/
|
||||
internal val databaseHelper: DatabaseHelper by injectLazy()
|
||||
|
||||
/**
|
||||
* Source manager.
|
||||
*/
|
||||
internal val sourceManager: SourceManager by injectLazy()
|
||||
|
||||
/**
|
||||
* Tracking manager
|
||||
*/
|
||||
internal val trackManager: TrackManager by injectLazy()
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
/**
|
||||
* Version of parser
|
||||
@@ -84,11 +74,6 @@ class BackupManager(val context: Context, version: Int = CURRENT_VERSION) {
|
||||
*/
|
||||
var parser: Gson = initParser()
|
||||
|
||||
/**
|
||||
* Preferences
|
||||
*/
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
/**
|
||||
* Set version of parser
|
||||
*
|
||||
|
||||
@@ -81,6 +81,12 @@ class BackupRestoreService : Service() {
|
||||
*/
|
||||
fun stop(context: Context) {
|
||||
context.stopService(Intent(context, BackupRestoreService::class.java))
|
||||
|
||||
val errorIntent = Intent(BackupConst.INTENT_FILTER).apply {
|
||||
putExtra(BackupConst.ACTION, BackupConst.ACTION_RESTORE_ERROR)
|
||||
putExtra(BackupConst.EXTRA_ERROR_MESSAGE, context.getString(R.string.restoring_backup_canceled))
|
||||
}
|
||||
context.sendLocalBroadcast(errorIntent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +462,7 @@ class BackupRestoreService : Service() {
|
||||
amount: Int,
|
||||
title: String,
|
||||
errors: Int,
|
||||
content: String = getString(R.string.dialog_restoring_backup, title.chop(15))
|
||||
content: String = title.chop(30)
|
||||
) {
|
||||
val intent = Intent(BackupConst.INTENT_FILTER).apply {
|
||||
putExtra(BackupConst.EXTRA_PROGRESS, progress)
|
||||
|
||||
Reference in New Issue
Block a user