commit
3ad51ba267
7 changed files with 22 additions and 29 deletions
|
@ -19,7 +19,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/content_padding_small"
|
||||
android:text="Crash"
|
||||
android:text="@string/shared_string_crash"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
@ -27,7 +27,7 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Последний запуск OsmAnd завершился с ошибкой. Помогите нам улучшить OsmAnd. Пожалуйста, отправьте нам сообщение об ошибке."
|
||||
android:text="@string/last_launch_crashed"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
|
|
|
@ -3089,4 +3089,5 @@
|
|||
<string name="shared_string_icon">Значок</string>
|
||||
<string name="collected_data">Собранные данные</string>
|
||||
<string name="press_again_to_change_the_map_orientation">Нажмите еще раз, чтобы изменить ориентацию карты</string>
|
||||
<string name="last_launch_crashed">Последний запуск OsmAnd завершился с ошибкой. Помогите нам улучшить OsmAnd. Пожалуйста, отправьте нам сообщение об ошибке.</string>
|
||||
</resources>
|
|
@ -11,6 +11,8 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
<string name="shared_string_crash">Crash</string>
|
||||
<string name="last_launch_crashed">The last launch of OsmAnd failed. Help us improve OsmAnd. Please send us an error message.</string>
|
||||
<string name="press_again_to_change_the_map_orientation">Press again to change the map orientation</string>
|
||||
<string name="process_downloading_service">OsmAnd downloading service</string>
|
||||
<string name="shared_string_color_magenta">Magenta</string>
|
||||
|
|
|
@ -63,11 +63,9 @@ public class NotificationHelper {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
public Notification buildDownloadNotification() {
|
||||
Builder notificationBuilder = downloadNotification.buildNotification(false);
|
||||
|
||||
return notificationBuilder != null ? notificationBuilder.build() : null;
|
||||
return downloadNotification.buildNotification(false).build();
|
||||
}
|
||||
|
||||
private Notification buildErrorNotification() {
|
||||
|
|
|
@ -93,6 +93,14 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
protected void downloadHasStarted() {
|
||||
if (app.getDownloadService() == null) {
|
||||
app.startDownloadService();
|
||||
}
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
@UiThread
|
||||
protected void downloadInProgress() {
|
||||
if (uiActivity != null) {
|
||||
|
@ -100,10 +108,6 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
private void updateNotification() {
|
||||
app.getNotificationHelper().refreshNotification(OsmandNotification.NotificationType.DOWNLOAD);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
protected void downloadHasFinished() {
|
||||
|
@ -225,9 +229,6 @@ public class DownloadIndexesThread {
|
|||
indexItemDownloading.add(item);
|
||||
}
|
||||
}
|
||||
if (app.getDownloadService() == null) {
|
||||
app.startDownloadService();
|
||||
}
|
||||
if (currentDownloadingItem == null) {
|
||||
execute(new DownloadIndexesAsyncTask());
|
||||
} else {
|
||||
|
@ -313,7 +314,9 @@ public class DownloadIndexesThread {
|
|||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, indexItems);
|
||||
}
|
||||
|
||||
|
||||
private void updateNotification() {
|
||||
app.getNotificationHelper().refreshNotification(OsmandNotification.NotificationType.DOWNLOAD);
|
||||
}
|
||||
|
||||
private class ReloadIndexesTask extends BasicProgressAsyncTask<Void, Void, Void, DownloadResources> {
|
||||
|
||||
|
@ -445,6 +448,7 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
}
|
||||
startTask(ctx.getString(R.string.shared_string_downloading) + ctx.getString(R.string.shared_string_ellipsis), -1);
|
||||
downloadHasStarted();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -463,9 +467,6 @@ public class DownloadIndexesThread {
|
|||
downloadHasFinished();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected String doInBackground(IndexItem... filesToDownload) {
|
||||
try {
|
||||
|
@ -557,7 +558,6 @@ public class DownloadIndexesThread {
|
|||
return !exceed;
|
||||
}
|
||||
|
||||
|
||||
private String reindexFiles(List<File> filesToReindex) {
|
||||
boolean vectorMapsToReindex = false;
|
||||
// reindex vector maps all at one time
|
||||
|
|
|
@ -35,10 +35,9 @@ public class DownloadService extends Service {
|
|||
app.setDownloadService(this);
|
||||
|
||||
Notification notification = app.getNotificationHelper().buildDownloadNotification();
|
||||
if (notification != null) {
|
||||
startForeground(OsmandNotification.DOWNLOAD_NOTIFICATION_SERVICE_ID, notification);
|
||||
app.getNotificationHelper().refreshNotification(OsmandNotification.NotificationType.DOWNLOAD);
|
||||
}
|
||||
startForeground(OsmandNotification.DOWNLOAD_NOTIFICATION_SERVICE_ID, notification);
|
||||
app.getNotificationHelper().refreshNotification(OsmandNotification.NotificationType.DOWNLOAD);
|
||||
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,17 +55,10 @@ public class DownloadNotification extends OsmandNotification {
|
|||
|
||||
@Override
|
||||
public NotificationCompat.Builder buildNotification(boolean wearable) {
|
||||
if (!isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
icon = android.R.drawable.stat_sys_download;
|
||||
ongoing = true;
|
||||
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||
|
||||
if (downloadThread.getCurrentDownloadingItem() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BasicProgressAsyncTask<?, ?, ?, ?> task = downloadThread.getCurrentRunningTask();
|
||||
final boolean isFinished = task == null || task.getStatus() == AsyncTask.Status.FINISHED;
|
||||
|
||||
|
|
Loading…
Reference in a new issue