This commit is contained in:
max-klaus 2019-10-21 19:01:20 +03:00
parent 9520101321
commit 8bfb7b39d2
2 changed files with 19 additions and 2 deletions

View file

@ -11,7 +11,8 @@
Thx - Hardy Thx - Hardy
--> -->
<string name="update_all_maps">Update all maps</string>
<string name="update_all_maps_q">Are you sure you want to update all (%1$d) maps?</string>
<string name="track_storage_directory">Track Storage Directory</string> <string name="track_storage_directory">Track Storage Directory</string>
<string name="track_storage_directory_descrp">Tracks can be stored in rec folder or in monthly or daily folders.</string> <string name="track_storage_directory_descrp">Tracks can be stored in rec folder or in monthly or daily folders.</string>
<string name="store_tracks_in_rec_directory">Store recorded tracks in rec folder</string> <string name="store_tracks_in_rec_directory">Store recorded tracks in rec folder</string>

View file

@ -19,10 +19,12 @@ import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -154,9 +156,23 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
updateAllButton.setOnClickListener(new View.OnClickListener() { updateAllButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (indexItems.size() > 3) {
AlertDialog.Builder dialog = new AlertDialog.Builder(getMyActivity());
dialog.setTitle(R.string.update_all_maps);
dialog.setMessage(getString(R.string.update_all_maps_q, indexItems.size()));
dialog.setNegativeButton(R.string.shared_string_cancel, null);
dialog.setPositiveButton(R.string.update, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getMyActivity().startDownload(indexItems.toArray(new IndexItem[indexItems.size()])); getMyActivity().startDownload(indexItems.toArray(new IndexItem[indexItems.size()]));
} }
}); });
dialog.create().show();
} else {
getMyActivity().startDownload(indexItems.toArray(new IndexItem[indexItems.size()]));
}
}
});
} }
} }