From 1797e24f43318e2c80d326e4ddddf72da0508f38 Mon Sep 17 00:00:00 2001 From: Skalii Date: Sun, 7 Mar 2021 12:50:26 +0200 Subject: [PATCH] fix refresh last date check after clear downloaded data; fix refresh list after update all enabled --- .../plus/liveupdates/LiveUpdatesFragmentNew.java | 14 +++++--------- .../LiveUpdatesSettingsDialogFragmentNew.java | 8 ++++++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index b34c6986ba..1c898c4bef 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -217,6 +217,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements stopUpdateDateAsyncTask(); stopLoadLiveMapsAsyncTask(); } + @Override public void onDismiss(@NonNull DialogInterface dialog) { super.onDismiss(dialog); @@ -262,7 +263,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public void onClick(View view) { boolean visible = !isChecked; - if (visible) { if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) { switchOnLiveUpdates(); @@ -291,7 +291,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } private void showUpdateDialog() { - final AsyncResponse runListSort = new AsyncResponse() { + final AsyncResponse refreshAfterUpdate = new AsyncResponse() { @Override public void processFinish() { adapter.notifyDataSetChanged(); @@ -300,7 +300,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements if (!Algorithms.isEmpty(adapter.mapsList)) { if (adapter.countEnabled == 1) { LocalIndexInfo li = adapter.mapsList.get(0); - runLiveUpdate(getActivity(), li.getFileName(), false, runListSort); + runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); } else if (adapter.countEnabled > 1) { AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); bld.setMessage(R.string.update_all_maps_now); @@ -311,14 +311,10 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements for (LocalIndexInfo li : adapter.mapsList) { CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), settings); if (localUpdateOn.get()) { - if (adapter.mapsList.indexOf(li) == adapter.mapsList.size() - 1) { - runLiveUpdate(getActivity(), li.getFileName(), false, runListSort); - } else { - runLiveUpdate(getActivity(), li.getFileName(), false); - } + runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); } - startUpdateDateAsyncTask(); } + startUpdateDateAsyncTask(); } }); bld.setNegativeButton(R.string.shared_string_no, null); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index d65df0b4c1..df408b17e7 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -518,6 +518,10 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (confirmationInterface != null) { confirmationInterface.updateList(); } + if (indexLastCheckItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) + .setDescription(getLastCheckString()); + } if (indexClearItem != -1) { ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); @@ -535,8 +539,8 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF void updateList(); } - public String getStateText(boolean state) { - return app.getResources().getString(state ? R.string.shared_string_enabled : R.string.shared_string_disabled); + public String getStateText(boolean isEnabled) { + return app.getResources().getString(isEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled); } @ColorRes