add srtm map download option, refactoring p1
This commit is contained in:
parent
ac3aeacca1
commit
b14f62822b
10 changed files with 121 additions and 121 deletions
|
@ -331,15 +331,16 @@ public class LocalIndexHelper {
|
||||||
if (mapPath.canRead()) {
|
if (mapPath.canRead()) {
|
||||||
for (File mapFile : listFilesSorted(mapPath)) {
|
for (File mapFile : listFilesSorted(mapPath)) {
|
||||||
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)) {
|
||||||
|
String fileName = mapFile.getName();
|
||||||
LocalIndexType lt = LocalIndexType.MAP_DATA;
|
LocalIndexType lt = LocalIndexType.MAP_DATA;
|
||||||
if (mapFile.getName().endsWith(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT)
|
if (fileName.endsWith(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT)
|
||||||
|| mapFile.getName().endsWith(IndexConstants.BINARY_SRTM_FEET_MAP_INDEX_EXT)) {
|
|| fileName.endsWith(IndexConstants.BINARY_SRTM_FEET_MAP_INDEX_EXT)) {
|
||||||
lt = LocalIndexType.SRTM_DATA;
|
lt = LocalIndexType.SRTM_DATA;
|
||||||
} else if (mapFile.getName().endsWith(IndexConstants.BINARY_WIKI_MAP_INDEX_EXT)) {
|
} else if (fileName.endsWith(IndexConstants.BINARY_WIKI_MAP_INDEX_EXT)) {
|
||||||
lt = LocalIndexType.WIKI_DATA;
|
lt = LocalIndexType.WIKI_DATA;
|
||||||
}
|
}
|
||||||
LocalIndexInfo info = new LocalIndexInfo(lt, mapFile, backup, app);
|
LocalIndexInfo info = new LocalIndexInfo(lt, mapFile, backup, app);
|
||||||
if (loadedMaps.containsKey(mapFile.getName()) && !backup) {
|
if (loadedMaps.containsKey(fileName) && !backup) {
|
||||||
info.setLoaded(true);
|
info.setLoaded(true);
|
||||||
}
|
}
|
||||||
updateDescription(info);
|
updateDescription(info);
|
||||||
|
|
|
@ -70,42 +70,6 @@ public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
private OnRadioButtonSelectListener onRadioButtonSelectListener;
|
private OnRadioButtonSelectListener onRadioButtonSelectListener;
|
||||||
private SelectedItemsListener selectedItemsListener;
|
private SelectedItemsListener selectedItemsListener;
|
||||||
|
|
||||||
public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity,
|
|
||||||
@NonNull List<SelectableItem> items,
|
|
||||||
@Nullable List<SelectableItem> selected,
|
|
||||||
boolean usedOnMap) {
|
|
||||||
SelectMultipleItemsBottomSheet fragment = new SelectMultipleItemsBottomSheet();
|
|
||||||
fragment.setUsedOnMap(usedOnMap);
|
|
||||||
fragment.setItems(items);
|
|
||||||
fragment.setSelectedItems(selected);
|
|
||||||
FragmentManager fm = activity.getSupportFragmentManager();
|
|
||||||
fragment.show(fm, TAG);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity,
|
|
||||||
@NonNull List<SelectableItem> items,
|
|
||||||
@Nullable List<SelectableItem> selected,
|
|
||||||
boolean usedOnMap,
|
|
||||||
String addDescription,
|
|
||||||
boolean customOptionsVisible,
|
|
||||||
boolean leftButtonSelected,
|
|
||||||
String leftRadioButtonText,
|
|
||||||
String rightRadioButtonText) {
|
|
||||||
SelectMultipleItemsBottomSheet fragment = new SelectMultipleItemsBottomSheet();
|
|
||||||
fragment.setUsedOnMap(usedOnMap);
|
|
||||||
fragment.setItems(items);
|
|
||||||
fragment.setSelectedItems(selected);
|
|
||||||
fragment.setAddDescriptionText(addDescription);
|
|
||||||
fragment.setCustomOptionsVisible(customOptionsVisible);
|
|
||||||
fragment.setLeftButtonSelected(leftButtonSelected);
|
|
||||||
fragment.setLeftRadioButtonText(leftRadioButtonText);
|
|
||||||
fragment.setRightRadioButtonText(rightRadioButtonText);
|
|
||||||
FragmentManager fm = activity.getSupportFragmentManager();
|
|
||||||
fragment.show(fm, TAG);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||||
|
@ -392,6 +356,66 @@ public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
this.selectedItemsListener = selectedItemsListener;
|
this.selectedItemsListener = selectedItemsListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupRightButton() {
|
||||||
|
super.setupRightButton();
|
||||||
|
applyButtonTitle = rightButton.findViewById(R.id.button_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRightBottomButtonClick() {
|
||||||
|
if (onApplySelectionListener != null) {
|
||||||
|
onApplySelectionListener.onSelectionApplied(selectedItems);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return R.string.shared_string_apply;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean useVerticalButtons() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity,
|
||||||
|
@NonNull List<SelectableItem> items,
|
||||||
|
@Nullable List<SelectableItem> selected,
|
||||||
|
boolean usedOnMap) {
|
||||||
|
SelectMultipleItemsBottomSheet fragment = new SelectMultipleItemsBottomSheet();
|
||||||
|
fragment.setUsedOnMap(usedOnMap);
|
||||||
|
fragment.setItems(items);
|
||||||
|
fragment.setSelectedItems(selected);
|
||||||
|
FragmentManager fm = activity.getSupportFragmentManager();
|
||||||
|
fragment.show(fm, TAG);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SelectMultipleItemsBottomSheet showInstance(@NonNull AppCompatActivity activity,
|
||||||
|
@NonNull List<SelectableItem> items,
|
||||||
|
@Nullable List<SelectableItem> selected,
|
||||||
|
boolean usedOnMap,
|
||||||
|
String addDescription,
|
||||||
|
boolean customOptionsVisible,
|
||||||
|
boolean leftButtonSelected,
|
||||||
|
String leftRadioButtonText,
|
||||||
|
String rightRadioButtonText) {
|
||||||
|
SelectMultipleItemsBottomSheet fragment = new SelectMultipleItemsBottomSheet();
|
||||||
|
fragment.setUsedOnMap(usedOnMap);
|
||||||
|
fragment.setItems(items);
|
||||||
|
fragment.setSelectedItems(selected);
|
||||||
|
fragment.setAddDescriptionText(addDescription);
|
||||||
|
fragment.setCustomOptionsVisible(customOptionsVisible);
|
||||||
|
fragment.setLeftButtonSelected(leftButtonSelected);
|
||||||
|
fragment.setLeftRadioButtonText(leftRadioButtonText);
|
||||||
|
fragment.setRightRadioButtonText(rightRadioButtonText);
|
||||||
|
FragmentManager fm = activity.getSupportFragmentManager();
|
||||||
|
fragment.show(fm, TAG);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
public interface SelectionUpdateListener {
|
public interface SelectionUpdateListener {
|
||||||
void onSelectionUpdate();
|
void onSelectionUpdate();
|
||||||
}
|
}
|
||||||
|
@ -435,27 +459,4 @@ public class SelectMultipleItemsBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setupRightButton() {
|
|
||||||
super.setupRightButton();
|
|
||||||
applyButtonTitle = rightButton.findViewById(R.id.button_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onRightBottomButtonClick() {
|
|
||||||
if (onApplySelectionListener != null) {
|
|
||||||
onApplySelectionListener.onSelectionApplied(selectedItems);
|
|
||||||
}
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getRightBottomButtonTextId() {
|
|
||||||
return R.string.shared_string_apply;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean useVerticalButtons() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class DownloadOsmandIndexesHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void listVoiceAssets(IndexFileList result, AssetManager amanager, PackageManager pm,
|
private static void listVoiceAssets(IndexFileList result, AssetManager amanager, PackageManager pm,
|
||||||
OsmandSettings settings) {
|
OsmandSettings settings) {
|
||||||
try {
|
try {
|
||||||
File voicePath = settings.getContext().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
File voicePath = settings.getContext().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||||
// list = amanager.list("voice");
|
// list = amanager.list("voice");
|
||||||
|
@ -207,9 +207,6 @@ public class DownloadOsmandIndexesHelper {
|
||||||
if (next == XmlPullParser.START_TAG) {
|
if (next == XmlPullParser.START_TAG) {
|
||||||
DownloadActivityType tp = DownloadActivityType.getIndexType(parser.getAttributeValue(null, "type"));
|
DownloadActivityType tp = DownloadActivityType.getIndexType(parser.getAttributeValue(null, "type"));
|
||||||
if (tp != null) {
|
if (tp != null) {
|
||||||
if (tp == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
|
||||||
log.debug("strUrl = " + strUrl);
|
|
||||||
}
|
|
||||||
IndexItem it = tp.parseIndexItem(ctx, parser);
|
IndexItem it = tp.parseIndexItem(ctx, parser);
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
result.add(it);
|
result.add(it);
|
||||||
|
@ -249,7 +246,7 @@ public class DownloadOsmandIndexesHelper {
|
||||||
private final long dateModified;
|
private final long dateModified;
|
||||||
|
|
||||||
public AssetIndexItem(String fileName, String description, String date,
|
public AssetIndexItem(String fileName, String description, String date,
|
||||||
long dateModified, String size, long sizeL, String assetName, String destFile, DownloadActivityType type) {
|
long dateModified, String size, long sizeL, String assetName, String destFile, DownloadActivityType type) {
|
||||||
super(fileName, description, dateModified, size, sizeL, sizeL, type);
|
super(fileName, description, dateModified, size, sizeL, sizeL, type);
|
||||||
this.dateModified = dateModified;
|
this.dateModified = dateModified;
|
||||||
this.assetName = assetName;
|
this.assetName = assetName;
|
||||||
|
|
|
@ -264,7 +264,7 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> listWithAlternatives(final java.text.DateFormat dateFormat, File file,
|
private Map<String, String> listWithAlternatives(final java.text.DateFormat dateFormat, File file,
|
||||||
final String ext, final Map<String, String> files) {
|
final String ext, final Map<String, String> files) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
file.list(new FilenameFilter() {
|
file.list(new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -518,7 +518,7 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private List<IndexItem> collectIndexesOfType(@NonNull List<WorldRegion> regions,
|
private List<IndexItem> collectIndexesOfType(@NonNull List<WorldRegion> regions,
|
||||||
@NonNull DownloadActivityType type) {
|
@NonNull DownloadActivityType type) {
|
||||||
List<IndexItem> collectedIndexes = new ArrayList<>();
|
List<IndexItem> collectedIndexes = new ArrayList<>();
|
||||||
for (WorldRegion region : regions) {
|
for (WorldRegion region : regions) {
|
||||||
List<IndexItem> regionIndexes = getIndexItems(region);
|
List<IndexItem> regionIndexes = getIndexItems(region);
|
||||||
|
@ -645,10 +645,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<IndexItem> findIndexItemsAt(OsmandApplication app,
|
public static List<IndexItem> findIndexItemsAt(OsmandApplication app,
|
||||||
List<String> names,
|
List<String> names,
|
||||||
DownloadActivityType type,
|
DownloadActivityType type,
|
||||||
boolean includeDownloaded,
|
boolean includeDownloaded,
|
||||||
int limit) {
|
int limit) {
|
||||||
List<IndexItem> res = new ArrayList<>();
|
List<IndexItem> res = new ArrayList<>();
|
||||||
OsmandRegions regions = app.getRegions();
|
OsmandRegions regions = app.getRegions();
|
||||||
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||||
|
@ -665,9 +665,9 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isIndexItemDownloaded(DownloadIndexesThread downloadThread,
|
private static boolean isIndexItemDownloaded(DownloadIndexesThread downloadThread,
|
||||||
DownloadActivityType type,
|
DownloadActivityType type,
|
||||||
WorldRegion downloadRegion,
|
WorldRegion downloadRegion,
|
||||||
List<IndexItem> res) {
|
List<IndexItem> res) {
|
||||||
List<IndexItem> otherIndexItems =
|
List<IndexItem> otherIndexItems =
|
||||||
new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||||
for (IndexItem indexItem : otherIndexItems) {
|
for (IndexItem indexItem : otherIndexItems) {
|
||||||
|
@ -680,7 +680,7 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean doesListContainIndexWithType(List<IndexItem> indexItems,
|
private boolean doesListContainIndexWithType(List<IndexItem> indexItems,
|
||||||
DownloadActivityType type) {
|
DownloadActivityType type) {
|
||||||
if (indexItems != null) {
|
if (indexItems != null) {
|
||||||
for (IndexItem indexItem : indexItems) {
|
for (IndexItem indexItem : indexItems) {
|
||||||
if (indexItem.getType() == type) {
|
if (indexItem.getType() == type) {
|
||||||
|
@ -692,9 +692,9 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean addIndexItem(DownloadIndexesThread downloadThread,
|
private static boolean addIndexItem(DownloadIndexesThread downloadThread,
|
||||||
DownloadActivityType type,
|
DownloadActivityType type,
|
||||||
WorldRegion downloadRegion,
|
WorldRegion downloadRegion,
|
||||||
List<IndexItem> res) {
|
List<IndexItem> res) {
|
||||||
List<IndexItem> otherIndexItems =
|
List<IndexItem> otherIndexItems =
|
||||||
new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||||
for (IndexItem indexItem : otherIndexItems) {
|
for (IndexItem indexItem : otherIndexItems) {
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class MultipleIndexItem extends DownloadItem {
|
||||||
private final List<IndexItem> items;
|
private final List<IndexItem> items;
|
||||||
|
|
||||||
public MultipleIndexItem(@NonNull WorldRegion region,
|
public MultipleIndexItem(@NonNull WorldRegion region,
|
||||||
@NonNull List<IndexItem> items,
|
@NonNull List<IndexItem> items,
|
||||||
@NonNull DownloadActivityType type) {
|
@NonNull DownloadActivityType type) {
|
||||||
super(type);
|
super(type);
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
@ -139,4 +139,5 @@ public class MultipleIndexItem extends DownloadItem {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,11 @@ import static net.osmand.plus.download.DownloadActivityType.SRTM_COUNTRY_FILE;
|
||||||
public class MultipleIndexesUiHelper {
|
public class MultipleIndexesUiHelper {
|
||||||
|
|
||||||
public static void showDialog(@NonNull DownloadItem item,
|
public static void showDialog(@NonNull DownloadItem item,
|
||||||
@NonNull AppCompatActivity activity,
|
@NonNull AppCompatActivity activity,
|
||||||
@NonNull final OsmandApplication app,
|
@NonNull final OsmandApplication app,
|
||||||
@NonNull DateFormat dateFormat,
|
@NonNull DateFormat dateFormat,
|
||||||
boolean showRemoteDate,
|
boolean showRemoteDate,
|
||||||
@NonNull final SelectItemsToDownloadListener listener) {
|
@NonNull final SelectItemsToDownloadListener listener) {
|
||||||
if (item.getType() == SRTM_COUNTRY_FILE) {
|
if (item.getType() == SRTM_COUNTRY_FILE) {
|
||||||
showSRTMDialog(item, activity, app, dateFormat, showRemoteDate, listener);
|
showSRTMDialog(item, activity, app, dateFormat, showRemoteDate, listener);
|
||||||
} else if (item instanceof MultipleIndexItem) {
|
} else if (item instanceof MultipleIndexItem) {
|
||||||
|
@ -42,11 +42,11 @@ public class MultipleIndexesUiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showBaseDialog(@NonNull MultipleIndexItem multipleIndexItem,
|
public static void showBaseDialog(@NonNull MultipleIndexItem multipleIndexItem,
|
||||||
@NonNull AppCompatActivity activity,
|
@NonNull AppCompatActivity activity,
|
||||||
@NonNull final OsmandApplication app,
|
@NonNull final OsmandApplication app,
|
||||||
@NonNull DateFormat dateFormat,
|
@NonNull DateFormat dateFormat,
|
||||||
boolean showRemoteDate,
|
boolean showRemoteDate,
|
||||||
@NonNull final SelectItemsToDownloadListener listener) {
|
@NonNull final SelectItemsToDownloadListener listener) {
|
||||||
List<IndexItem> indexesToDownload = getIndexesToDownload(multipleIndexItem);
|
List<IndexItem> indexesToDownload = getIndexesToDownload(multipleIndexItem);
|
||||||
List<SelectableItem> allItems = new ArrayList<>();
|
List<SelectableItem> allItems = new ArrayList<>();
|
||||||
List<SelectableItem> selectedItems = new ArrayList<>();
|
List<SelectableItem> selectedItems = new ArrayList<>();
|
||||||
|
@ -80,11 +80,11 @@ public class MultipleIndexesUiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showSRTMDialog(@NonNull final DownloadItem downloadItem,
|
public static void showSRTMDialog(@NonNull final DownloadItem downloadItem,
|
||||||
@NonNull AppCompatActivity activity,
|
@NonNull AppCompatActivity activity,
|
||||||
@NonNull final OsmandApplication app,
|
@NonNull final OsmandApplication app,
|
||||||
@NonNull final DateFormat dateFormat,
|
@NonNull final DateFormat dateFormat,
|
||||||
final boolean showRemoteDate,
|
final boolean showRemoteDate,
|
||||||
@NonNull final SelectItemsToDownloadListener listener) {
|
@NonNull final SelectItemsToDownloadListener listener) {
|
||||||
List<SelectableItem> selectedItems = new ArrayList<>();
|
List<SelectableItem> selectedItems = new ArrayList<>();
|
||||||
final List<SelectableItem> leftItems = new ArrayList<>();
|
final List<SelectableItem> leftItems = new ArrayList<>();
|
||||||
final List<SelectableItem> rightItems = new ArrayList<>();
|
final List<SelectableItem> rightItems = new ArrayList<>();
|
||||||
|
@ -201,7 +201,7 @@ public class MultipleIndexesUiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isListDialog(OsmandApplication app,
|
private static boolean isListDialog(OsmandApplication app,
|
||||||
List<SelectableItem> leftItems, List<SelectableItem> rightItems) {
|
List<SelectableItem> leftItems, List<SelectableItem> rightItems) {
|
||||||
return (isBaseSRTMMetricSystem(app) ? leftItems : rightItems).size() > 1;
|
return (isBaseSRTMMetricSystem(app) ? leftItems : rightItems).size() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,8 +216,8 @@ public class ItemViewHolder {
|
||||||
MultipleIndexItem item = (MultipleIndexItem) downloadItem;
|
MultipleIndexItem item = (MultipleIndexItem) downloadItem;
|
||||||
String allRegionsHeader = context.getString(R.string.shared_strings_all_regions);
|
String allRegionsHeader = context.getString(R.string.shared_strings_all_regions);
|
||||||
String regionsHeader = context.getString(R.string.regions);
|
String regionsHeader = context.getString(R.string.regions);
|
||||||
String allRegionsCountStr;
|
String allRegionsCount;
|
||||||
String leftToDownloadCountStr;
|
String leftToDownloadCount;
|
||||||
if (isSRTMItem(item)) {
|
if (isSRTMItem(item)) {
|
||||||
List<IndexItem> items = new ArrayList<>();
|
List<IndexItem> items = new ArrayList<>();
|
||||||
for (IndexItem indexItem : item.getAllIndexes()) {
|
for (IndexItem indexItem : item.getAllIndexes()) {
|
||||||
|
@ -226,7 +226,7 @@ public class ItemViewHolder {
|
||||||
items.add(indexItem);
|
items.add(indexItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allRegionsCountStr = String.valueOf(items.size());
|
allRegionsCount = String.valueOf(items.size());
|
||||||
items.clear();
|
items.clear();
|
||||||
for (IndexItem indexItem : item.getIndexesToDownload()) {
|
for (IndexItem indexItem : item.getIndexesToDownload()) {
|
||||||
boolean baseItem = isBaseSRTMItem(indexItem);
|
boolean baseItem = isBaseSRTMItem(indexItem);
|
||||||
|
@ -235,27 +235,27 @@ public class ItemViewHolder {
|
||||||
items.add(indexItem);
|
items.add(indexItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
leftToDownloadCountStr = String.valueOf(items.size());
|
leftToDownloadCount = String.valueOf(items.size());
|
||||||
} else {
|
} else {
|
||||||
allRegionsCountStr = String.valueOf(item.getAllIndexes().size());
|
allRegionsCount = String.valueOf(item.getAllIndexes().size());
|
||||||
leftToDownloadCountStr = String.valueOf(item.getIndexesToDownload().size());
|
leftToDownloadCount = String.valueOf(item.getIndexesToDownload().size());
|
||||||
}
|
}
|
||||||
String header;
|
String header;
|
||||||
String count;
|
String count;
|
||||||
if (item.hasActualDataToDownload()) {
|
if (item.hasActualDataToDownload()) {
|
||||||
if (!item.isDownloaded()) {
|
if (!item.isDownloaded()) {
|
||||||
header = allRegionsHeader;
|
header = allRegionsHeader;
|
||||||
count = leftToDownloadCountStr;
|
count = leftToDownloadCount;
|
||||||
} else {
|
} else {
|
||||||
header = regionsHeader;
|
header = regionsHeader;
|
||||||
count = String.format(
|
count = String.format(
|
||||||
context.getString(R.string.ltr_or_rtl_combine_via_slash),
|
context.getString(R.string.ltr_or_rtl_combine_via_slash),
|
||||||
leftToDownloadCountStr,
|
leftToDownloadCount,
|
||||||
allRegionsCountStr);
|
allRegionsCount);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header = allRegionsHeader;
|
header = allRegionsHeader;
|
||||||
count = allRegionsCountStr;
|
count = allRegionsCount;
|
||||||
}
|
}
|
||||||
String fullDescription = context.getString(R.string.ltr_or_rtl_combine_via_colon, header, count);
|
String fullDescription = context.getString(R.string.ltr_or_rtl_combine_via_colon, header, count);
|
||||||
if (srtmItem) {
|
if (srtmItem) {
|
||||||
|
|
|
@ -511,7 +511,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
|
||||||
int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
localOptionsMenu(itemId);
|
localOptionsMenu(itemId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openSelectionMode(final int actionResId, final int actionIconId,
|
private void openSelectionMode(final int actionResId, final int actionIconId,
|
||||||
final DialogInterface.OnClickListener listener) {
|
final DialogInterface.OnClickListener listener) {
|
||||||
final int colorResId = getMyApplication().getSettings().isLightContent() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
|
final int colorResId = getMyApplication().getSettings().isLightContent() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
|
||||||
String value = getString(actionResId);
|
String value = getString(actionResId);
|
||||||
if (value.endsWith("...")) {
|
if (value.endsWith("...")) {
|
||||||
|
@ -713,7 +713,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openSelectionMode(int stringRes, int darkIcon, DialogInterface.OnClickListener listener,
|
public void openSelectionMode(int stringRes, int darkIcon, DialogInterface.OnClickListener listener,
|
||||||
EnumSet<LocalIndexType> filter) {
|
EnumSet<LocalIndexType> filter) {
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
listAdapter.filterCategories(filter);
|
listAdapter.filterCategories(filter);
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getChildView(final int groupPosition, final int childPosition,
|
public View getChildView(final int groupPosition, final int childPosition,
|
||||||
boolean isLastChild, View convertView, ViewGroup parent) {
|
boolean isLastChild, View convertView, ViewGroup parent) {
|
||||||
LocalIndexInfoViewHolder viewHolder;
|
LocalIndexInfoViewHolder viewHolder;
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
LayoutInflater inflater = LayoutInflater.from(ctx);
|
LayoutInflater inflater = LayoutInflater.from(ctx);
|
||||||
|
|
|
@ -871,7 +871,7 @@ public class ResourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Amenity> searchAmenities(SearchPoiTypeFilter filter,
|
public List<Amenity> searchAmenities(SearchPoiTypeFilter filter,
|
||||||
double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
||||||
final List<Amenity> amenities = new ArrayList<Amenity>();
|
final List<Amenity> amenities = new ArrayList<Amenity>();
|
||||||
searchAmenitiesInProgress = true;
|
searchAmenitiesInProgress = true;
|
||||||
try {
|
try {
|
||||||
|
@ -901,7 +901,7 @@ public class ResourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, SearchPoiTypeFilter filter,
|
public List<Amenity> searchAmenitiesOnThePath(List<Location> locations, double radius, SearchPoiTypeFilter filter,
|
||||||
ResultMatcher<Amenity> matcher) {
|
ResultMatcher<Amenity> matcher) {
|
||||||
searchAmenitiesInProgress = true;
|
searchAmenitiesInProgress = true;
|
||||||
final List<Amenity> amenities = new ArrayList<Amenity>();
|
final List<Amenity> amenities = new ArrayList<Amenity>();
|
||||||
try {
|
try {
|
||||||
|
@ -957,8 +957,8 @@ public class ResourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Amenity> searchAmenitiesByName(String searchQuery,
|
public List<Amenity> searchAmenitiesByName(String searchQuery,
|
||||||
double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude,
|
double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude,
|
||||||
double lat, double lon, ResultMatcher<Amenity> matcher) {
|
double lat, double lon, ResultMatcher<Amenity> matcher) {
|
||||||
List<Amenity> amenities = new ArrayList<Amenity>();
|
List<Amenity> amenities = new ArrayList<Amenity>();
|
||||||
List<AmenityIndexRepositoryBinary> list = new ArrayList<AmenityIndexRepositoryBinary>();
|
List<AmenityIndexRepositoryBinary> list = new ArrayList<AmenityIndexRepositoryBinary>();
|
||||||
int left = MapUtils.get31TileNumberX(leftLongitude);
|
int left = MapUtils.get31TileNumberX(leftLongitude);
|
||||||
|
@ -1056,7 +1056,7 @@ public class ResourceManager {
|
||||||
|
|
||||||
|
|
||||||
public List<TransportStop> searchTransportSync(double topLat, double leftLon, double bottomLat, double rightLon,
|
public List<TransportStop> searchTransportSync(double topLat, double leftLon, double bottomLat, double rightLon,
|
||||||
ResultMatcher<TransportStop> matcher) throws IOException {
|
ResultMatcher<TransportStop> matcher) throws IOException {
|
||||||
TransportStopsRouteReader readers =
|
TransportStopsRouteReader readers =
|
||||||
new TransportStopsRouteReader(getTransportRepositories(topLat, leftLon, bottomLat, rightLon));
|
new TransportStopsRouteReader(getTransportRepositories(topLat, leftLon, bottomLat, rightLon));
|
||||||
List<TransportStop> stops = new ArrayList<>();
|
List<TransportStop> stops = new ArrayList<>();
|
||||||
|
|
|
@ -302,9 +302,9 @@ public class DataStorageHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DirectoryItem createDirectory(@NonNull String relativePath,
|
public DirectoryItem createDirectory(@NonNull String relativePath,
|
||||||
boolean processInternalDirectories,
|
boolean processInternalDirectories,
|
||||||
CheckingType checkingType,
|
CheckingType checkingType,
|
||||||
boolean addUnmatchedToOtherMemory) {
|
boolean addUnmatchedToOtherMemory) {
|
||||||
String path = app.getAppPath(relativePath).getAbsolutePath();
|
String path = app.getAppPath(relativePath).getAbsolutePath();
|
||||||
return new DirectoryItem(path, processInternalDirectories, checkingType, addUnmatchedToOtherMemory);
|
return new DirectoryItem(path, processInternalDirectories, checkingType, addUnmatchedToOtherMemory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue