fix refresh last date check after clear downloaded data;

fix refresh list after update all enabled
This commit is contained in:
Skalii 2021-03-07 12:50:26 +02:00
parent 2c6204810c
commit 1797e24f43
2 changed files with 11 additions and 11 deletions

View file

@ -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<Boolean> 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);

View file

@ -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