diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-08-11 21:38:18 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-11 21:38:18 +0200 |
commit | 6556154f28baea01ac0aab9d358d5b731a24dd8b (patch) | |
tree | 23b1b342898e934313642ef8373e330b8a9df878 /src/main/java/de/pixart | |
parent | 44fcc33f0fe8ec37869f68fa0b1df87b7e039a3e (diff) |
improve notification during backup
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/ExportLogsService.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ExportLogsService.java b/src/main/java/de/pixart/messenger/services/ExportLogsService.java index bc385b1e5..e7c72e5bb 100644 --- a/src/main/java/de/pixart/messenger/services/ExportLogsService.java +++ b/src/main/java/de/pixart/messenger/services/ExportLogsService.java @@ -55,13 +55,6 @@ public class ExportLogsService extends Service { new Thread(new Runnable() { @Override public void run() { - if (mAccounts.size() == 1) { - try { - ExportDatabase(); - } catch (IOException e) { - e.printStackTrace(); - } - } export(); stopForeground(true); running.set(false); @@ -77,17 +70,22 @@ public class ExportLogsService extends Service { conversations.addAll(mDatabaseBackend.getConversations(Conversation.STATUS_ARCHIVED)); NotificationManager mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getBaseContext()); - mBuilder.setContentTitle(getString(R.string.notification_export_logs_title)) + mBuilder.setContentTitle(getString(R.string.app_name)) + .setContentText(getString(R.string.notification_export_logs_title)) .setSmallIcon(R.drawable.ic_import_export_white_24dp) - .setProgress(conversations.size(), 0, false); + .setProgress(0, 0, true); startForeground(NOTIFICATION_ID, mBuilder.build()); + mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build()); - int progress = 0; for (Conversation conversation : conversations) { writeToFile(conversation); - progress++; - mBuilder.setProgress(conversations.size(), progress, false); - mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build()); + } + if (mAccounts.size() == 1) { + try { + ExportDatabase(); + } catch (IOException e) { + e.printStackTrace(); + } } } |