aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-08-11 21:38:18 +0200
committerChristian Schneppe <christian@pix-art.de>2016-08-11 21:38:18 +0200
commit6556154f28baea01ac0aab9d358d5b731a24dd8b (patch)
tree23b1b342898e934313642ef8373e330b8a9df878 /src
parent44fcc33f0fe8ec37869f68fa0b1df87b7e039a3e (diff)
improve notification during backup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/services/ExportLogsService.java24
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/values/strings.xml2
3 files changed, 13 insertions, 15 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();
+ }
}
}
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 7820715bc..d8d800007 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -317,7 +317,7 @@
<string name="conversations_foreground_service">Pix-Art Messenger</string>
<string name="pref_export_logs">Chats exportieren</string>
<string name="pref_export_logs_summary">Chats auf SD-Karte schreiben</string>
- <string name="notification_export_logs_title">Chats werden auf SD-Karte geschrieben</string>
+ <string name="notification_export_logs_title">Backup wird auf SD-Karte geschrieben</string>
<string name="choose_file">Datei auswählen</string>
<string name="receiving_x_file">Empfange %1$s (%2$d%% abgeschlossen)</string>
<string name="download_x_file">%s herunterladen</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 309cdd285..11dc0a58b 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -375,7 +375,7 @@
<string name="conversations_foreground_service">Pix-Art Messenger</string>
<string name="pref_export_logs">Export Logs</string>
<string name="pref_export_logs_summary">Write logs to SD card</string>
- <string name="notification_export_logs_title">Writing logs to SD card</string>
+ <string name="notification_export_logs_title">Writing backup to SD card</string>
<string name="choose_file">Choose file</string>
<string name="receiving_x_file">Receiving %1$s (%2$d%% completed)</string>
<string name="download_x_file">Download %s</string>