Added world basemap mini
This commit is contained in:
parent
913feb0899
commit
3b4238dcc6
6 changed files with 98 additions and 303 deletions
1
OsmAnd/.gitignore
vendored
1
OsmAnd/.gitignore
vendored
|
@ -22,6 +22,7 @@ assets/specialphrases/*
|
|||
assets/voice/*
|
||||
assets/fonts/*
|
||||
assets/feature_articles/*
|
||||
assets/World_basemap_mini*
|
||||
gen/
|
||||
local.properties
|
||||
raw/
|
||||
|
|
|
@ -60,4 +60,6 @@
|
|||
<asset source="fonts/65_NotoSansNastaliqUrdu-Regular.ttf" destination="fonts/65_NotoSansNastaliqUrdu-Regular.ttf" mode="alwaysOverwriteOrCopy" />
|
||||
|
||||
<asset source="sounds/camera_click.ogg" destination="sounds/camera_click.ogg" mode="copyOnlyIfDoesNotExist" />
|
||||
|
||||
<asset source="World_basemap_mini.obf" destination="World_basemap_mini.obf" mode="alwaysOverwriteOrCopy" />
|
||||
</assets>
|
||||
|
|
|
@ -234,6 +234,12 @@ task validateTranslate {
|
|||
}
|
||||
}
|
||||
|
||||
task downloadWorldMiniBasemap {
|
||||
doLast {
|
||||
ant.get(src: 'http://builder.osmand.net/basemap/World_basemap_mini_2.obf', dest: 'assets/World_basemap_mini.obf', skipexisting: 'true')
|
||||
}
|
||||
}
|
||||
|
||||
task collectVoiceAssets(type: Sync) {
|
||||
from "../../resources/voice"
|
||||
into "assets/voice"
|
||||
|
@ -298,7 +304,8 @@ task collectExternalResources {
|
|||
copyStyleIcons,
|
||||
updateNoTranslate,
|
||||
validateTranslate,
|
||||
copyWidgetIcons
|
||||
copyWidgetIcons,
|
||||
downloadWorldMiniBasemap
|
||||
}
|
||||
|
||||
// Legacy core build
|
||||
|
|
|
@ -622,122 +622,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map_downloading_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/dashboard_divider_light"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map2_downloading_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:minHeight="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/map2_downloading_icon"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_map"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="35dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map2_downloading_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="The Netherlands"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map2_downloading_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="255 MB"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map2_redownload_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="60dp"
|
||||
android:contentDescription="@string/shared_string_cancel"
|
||||
android:src="@drawable/ic_action_refresh_dark"
|
||||
android:tint="@color/map_widget_blue"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map2_download_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map2_download_progress_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/map2_download_progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map2_download_progress_button"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:contentDescription="@string/shared_string_cancel"
|
||||
android:src="@drawable/map_action_cancel"
|
||||
android:tint="@color/icon_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/map2_downloading_divider"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -57,7 +57,6 @@ import org.json.JSONObject;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -86,14 +85,11 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
|
||||
private Timer locationSearchTimer;
|
||||
private boolean waitForIndexes;
|
||||
List<IndexItem> indexItems = new ArrayList<>();
|
||||
|
||||
private static Location location;
|
||||
private static WorldRegion localDownloadRegion;
|
||||
private static IndexItem localMapIndexItem;
|
||||
private static IndexItem baseMapIndexItem;
|
||||
private static boolean firstMapDownloadCancelled;
|
||||
private static boolean secondMapDownloadCancelled;
|
||||
private static WorldRegion mapDownloadRegion;
|
||||
private static IndexItem mapIndexItem;
|
||||
private static boolean mapDownloadCancelled;
|
||||
private static boolean wizardClosed;
|
||||
|
||||
enum WizardType {
|
||||
|
@ -197,19 +193,14 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
case MAP_FOUND:
|
||||
TextView mapTitle = (TextView) view.findViewById(R.id.map_download_title);
|
||||
TextView mapDescription = (TextView) view.findViewById(R.id.map_download_desc);
|
||||
final IndexItem indexItem = localMapIndexItem != null ? localMapIndexItem : baseMapIndexItem;
|
||||
if (indexItem != null) {
|
||||
mapTitle.setText(indexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false));
|
||||
mapDescription.setText(indexItem.getSizeDescription(getContext()));
|
||||
if (mapIndexItem != null) {
|
||||
mapTitle.setText(mapIndexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false));
|
||||
mapDescription.setText(mapIndexItem.getSizeDescription(getContext()));
|
||||
}
|
||||
view.findViewById(R.id.map_download_action_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean spaceEnoughForBoth = validationManager.isSpaceEnoughForDownload(getActivity(), false, localMapIndexItem, baseMapIndexItem);
|
||||
boolean spaceEnoughForLocal = validationManager.isSpaceEnoughForDownload(getActivity(), true, localMapIndexItem);
|
||||
if (!spaceEnoughForBoth) {
|
||||
baseMapIndexItem = null;
|
||||
}
|
||||
boolean spaceEnoughForLocal = validationManager.isSpaceEnoughForDownload(getActivity(), true, mapIndexItem);
|
||||
if (spaceEnoughForLocal) {
|
||||
showMapDownloadFragment(getActivity());
|
||||
}
|
||||
|
@ -226,38 +217,30 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
});
|
||||
break;
|
||||
case MAP_DOWNLOAD:
|
||||
if (localMapIndexItem != null) {
|
||||
indexItems.add(localMapIndexItem);
|
||||
}
|
||||
if (baseMapIndexItem != null) {
|
||||
indexItems.add(baseMapIndexItem);
|
||||
}
|
||||
|
||||
if (indexItems.size() > 0) {
|
||||
final IndexItem item = indexItems.get(0);
|
||||
String mapName = item.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
||||
if (mapIndexItem != null) {
|
||||
String mapName = mapIndexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
||||
TextView mapNameTextView = (TextView) view.findViewById(R.id.map_downloading_title);
|
||||
mapNameTextView.setText(mapName);
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||
final View progressPadding = view.findViewById(R.id.map_download_padding);
|
||||
final View progressLayout = view.findViewById(R.id.map_download_progress_layout);
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
mapDescriptionTextView.setText(mapIndexItem.getSizeDescription(getContext()));
|
||||
final ImageButton redownloadButton = (ImageButton) view.findViewById(R.id.map_redownload_button);
|
||||
redownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!downloadThread.isDownloading(item) && !item.isDownloaded()) {
|
||||
validationManager.startDownload(getActivity(), item);
|
||||
firstMapDownloadCancelled = false;
|
||||
if (!downloadThread.isDownloading(mapIndexItem) && !mapIndexItem.isDownloaded()) {
|
||||
validationManager.startDownload(getActivity(), mapIndexItem);
|
||||
mapDownloadCancelled = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.map_download_progress_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
firstMapDownloadCancelled = true;
|
||||
downloadThread.cancelDownload(item);
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
mapDownloadCancelled = true;
|
||||
downloadThread.cancelDownload(mapIndexItem);
|
||||
mapDescriptionTextView.setText(mapIndexItem.getSizeDescription(getContext()));
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
redownloadButton.setVisibility(View.VISIBLE);
|
||||
|
@ -269,45 +252,6 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
view.findViewById(R.id.map_downloading_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.findViewById(R.id.map_downloading_layout).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.map_downloading_divider).setVisibility(View.GONE);
|
||||
}
|
||||
if (indexItems.size() > 1) {
|
||||
final IndexItem item = indexItems.get(1);
|
||||
String mapName = item.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
||||
TextView mapNameTextView = (TextView) view.findViewById(R.id.map2_downloading_title);
|
||||
mapNameTextView.setText(mapName);
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map2_downloading_desc);
|
||||
final View progressPadding = view.findViewById(R.id.map2_download_padding);
|
||||
final View progressLayout = view.findViewById(R.id.map2_download_progress_layout);
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
final ImageButton redownloadButton = (ImageButton) view.findViewById(R.id.map2_redownload_button);
|
||||
redownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!downloadThread.isDownloading(item) && !item.isDownloaded()) {
|
||||
validationManager.startDownload(getActivity(), item);
|
||||
secondMapDownloadCancelled = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.map2_download_progress_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
secondMapDownloadCancelled = true;
|
||||
downloadThread.cancelDownload(item);
|
||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
redownloadButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
progressPadding.setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
redownloadButton.setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.map2_downloading_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.findViewById(R.id.map_downloading_divider).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.map2_downloading_layout).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
view.findViewById(R.id.map_downloading_action_button).setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -422,11 +366,9 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
case MAP_FOUND:
|
||||
break;
|
||||
case MAP_DOWNLOAD:
|
||||
if (!startDownload(0)) {
|
||||
startDownload(1);
|
||||
}
|
||||
if (localDownloadRegion != null) {
|
||||
downloadThread.initSettingsFirstMap(localDownloadRegion);
|
||||
startDownload();
|
||||
if (mapDownloadRegion != null) {
|
||||
downloadThread.initSettingsFirstMap(mapDownloadRegion);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -505,97 +447,55 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
} else {
|
||||
v = getString(R.string.file_size_in_mb, mb);
|
||||
}
|
||||
|
||||
int index = indexItems.indexOf(indexItem);
|
||||
if (index == 0) {
|
||||
if (!firstMapDownloadCancelled) {
|
||||
if (!mapDownloadCancelled) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.map_download_progress_bar);
|
||||
mapDescriptionTextView.setText(v);
|
||||
progressBar.setProgress(progress < 0 ? 0 : progress);
|
||||
}
|
||||
} else if (index == 1) {
|
||||
if (!secondMapDownloadCancelled) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map2_downloading_desc);
|
||||
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.map2_download_progress_bar);
|
||||
mapDescriptionTextView.setText(v);
|
||||
progressBar.setProgress(progress < 0 ? 0 : progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateDownloadedItems();
|
||||
updateDownloadedItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadHasFinished() {
|
||||
updateDownloadedItems();
|
||||
startDownload(1);
|
||||
updateDownloadedItem();
|
||||
}
|
||||
|
||||
private boolean startDownload(int itemIndex) {
|
||||
private boolean startDownload() {
|
||||
boolean downloadStarted = false;
|
||||
if (itemIndex == 0 && indexItems.size() > 0) {
|
||||
IndexItem indexItem = indexItems.get(0);
|
||||
if (!downloadThread.isDownloading(indexItem)
|
||||
&& !indexItem.isDownloaded()
|
||||
&& !firstMapDownloadCancelled) {
|
||||
validationManager.startDownload(getActivity(), indexItem);
|
||||
if (!downloadThread.isDownloading(mapIndexItem)
|
||||
&& !mapIndexItem.isDownloaded()
|
||||
&& !mapDownloadCancelled) {
|
||||
validationManager.startDownload(getActivity(), mapIndexItem);
|
||||
downloadStarted = true;
|
||||
}
|
||||
} else if (itemIndex == 1 && indexItems.size() > 1) {
|
||||
IndexItem indexItem = indexItems.get(1);
|
||||
if (!downloadThread.isDownloading(indexItem)
|
||||
&& !indexItem.isDownloaded()
|
||||
&& !secondMapDownloadCancelled) {
|
||||
validationManager.startDownload(getActivity(), indexItem);
|
||||
downloadStarted = true;
|
||||
}
|
||||
}
|
||||
return downloadStarted;
|
||||
}
|
||||
|
||||
private void updateDownloadedItems() {
|
||||
int i = 0;
|
||||
private void updateDownloadedItem() {
|
||||
final View firstRowLayout = view.findViewById(R.id.map_downloading_layout);
|
||||
final View secondRowLayout = view.findViewById(R.id.map2_downloading_layout);
|
||||
final View progressLayout = view.findViewById(R.id.map_download_progress_layout);
|
||||
final View progressLayout2 = view.findViewById(R.id.map2_download_progress_layout);
|
||||
final ImageButton redownloadButton = (ImageButton) view.findViewById(R.id.map_redownload_button);
|
||||
final ImageButton redownloadButton2 = (ImageButton) view.findViewById(R.id.map2_redownload_button);
|
||||
for (IndexItem indexItem : indexItems) {
|
||||
if (indexItem.isDownloaded()) {
|
||||
if (i == 0 && progressLayout.getVisibility() == View.VISIBLE) {
|
||||
if (mapIndexItem.isDownloaded()) {
|
||||
if (progressLayout.getVisibility() == View.VISIBLE) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||
mapDescriptionTextView.setText(indexItem.getSizeDescription(getContext()));
|
||||
mapDescriptionTextView.setText(mapIndexItem.getSizeDescription(getContext()));
|
||||
view.findViewById(R.id.map_download_padding).setVisibility(View.VISIBLE);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
firstRowLayout.setClickable(true);
|
||||
final LatLon mapCenter = getMapCenter(indexItem);
|
||||
final int mapZoom = getMapZoom(indexItem);
|
||||
final LatLon mapCenter = getMapCenter();
|
||||
final int mapZoom = getMapZoom();
|
||||
firstRowLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOnMap(mapCenter, mapZoom);
|
||||
}
|
||||
});
|
||||
} else if (i == 1 && progressLayout2.getVisibility() == View.VISIBLE) {
|
||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map2_downloading_desc);
|
||||
mapDescriptionTextView.setText(indexItem.getSizeDescription(getContext()));
|
||||
view.findViewById(R.id.map2_download_padding).setVisibility(View.VISIBLE);
|
||||
progressLayout2.setVisibility(View.GONE);
|
||||
secondRowLayout.setClickable(true);
|
||||
final LatLon mapCenter = getMapCenter(indexItem);
|
||||
final int mapZoom = getMapZoom(indexItem);
|
||||
secondRowLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOnMap(mapCenter, mapZoom);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (downloadThread.isDownloading(indexItem)) {
|
||||
if (i == 0 && !firstMapDownloadCancelled) {
|
||||
if (downloadThread.isDownloading(mapIndexItem)) {
|
||||
if (!mapDownloadCancelled) {
|
||||
if (progressLayout.getVisibility() == View.GONE) {
|
||||
progressLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -603,33 +503,23 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
redownloadButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (i == 1 && !secondMapDownloadCancelled) {
|
||||
if (progressLayout2.getVisibility() == View.GONE) {
|
||||
progressLayout2.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (redownloadButton2.getVisibility() == View.VISIBLE) {
|
||||
redownloadButton2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private LatLon getMapCenter(IndexItem indexItem) {
|
||||
private LatLon getMapCenter() {
|
||||
final LatLon mapCenter;
|
||||
if (indexItem == localMapIndexItem && localDownloadRegion != null) {
|
||||
mapCenter = localDownloadRegion.getRegionCenter();
|
||||
if (mapDownloadRegion != null) {
|
||||
mapCenter = mapDownloadRegion.getRegionCenter();
|
||||
} else {
|
||||
mapCenter = new LatLon(48, 17);
|
||||
}
|
||||
return mapCenter;
|
||||
}
|
||||
|
||||
private int getMapZoom(IndexItem indexItem) {
|
||||
private int getMapZoom() {
|
||||
final int mapZoom;
|
||||
if (indexItem == localMapIndexItem && localDownloadRegion != null) {
|
||||
if (mapDownloadRegion != null) {
|
||||
mapZoom = 13;
|
||||
} else {
|
||||
mapZoom = 3;
|
||||
|
@ -691,19 +581,17 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
if (!Algorithms.isEmpty(selectedFullName)) {
|
||||
WorldRegion downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
||||
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
||||
localDownloadRegion = downloadRegion;
|
||||
FirstUsageWizardFragment.mapDownloadRegion = downloadRegion;
|
||||
List<IndexItem> indexItems = new LinkedList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||
for (IndexItem item : indexItems) {
|
||||
if (item.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||
localMapIndexItem = item;
|
||||
mapIndexItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
baseMapIndexItem = downloadThread.getIndexes().getWorldBaseMapItem();
|
||||
|
||||
if (localMapIndexItem != null || baseMapIndexItem != null) {
|
||||
if (mapIndexItem != null) {
|
||||
showMapFoundFragment(getActivity());
|
||||
} else {
|
||||
closeWizard();
|
||||
|
@ -740,9 +628,8 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
activity.getSupportFragmentManager().beginTransaction()
|
||||
.remove(FirstUsageWizardFragment.this).commit();
|
||||
location = null;
|
||||
localDownloadRegion = null;
|
||||
localMapIndexItem = null;
|
||||
baseMapIndexItem = null;
|
||||
mapDownloadRegion = null;
|
||||
mapIndexItem = null;
|
||||
wizardClosed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -639,6 +639,19 @@ public class ResourceManager {
|
|||
}
|
||||
File liveDir = context.getAppPath(IndexConstants.LIVE_INDEX_DIR);
|
||||
depthContours = false;
|
||||
boolean hasWorldBasemap = false;
|
||||
File worldBasemapMini = null;
|
||||
for (File f : files) {
|
||||
if (f.getName().equals("World_basemap.obf")) {
|
||||
hasWorldBasemap = true;
|
||||
}
|
||||
if (f.getName().startsWith("World_basemap_mini")) {
|
||||
worldBasemapMini = f;
|
||||
}
|
||||
}
|
||||
if (hasWorldBasemap && worldBasemapMini != null) {
|
||||
files.remove(worldBasemapMini);
|
||||
}
|
||||
for (File f : files) {
|
||||
progress.startTask(context.getString(R.string.indexing_map) + " " + f.getName(), -1); //$NON-NLS-1$
|
||||
try {
|
||||
|
@ -1043,7 +1056,8 @@ public class ResourceManager {
|
|||
File[] maps = dir.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return pathname.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT);
|
||||
return pathname.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT) &&
|
||||
!pathname.getName().endsWith("World_basemap_mini.obf");
|
||||
}
|
||||
});
|
||||
return maps != null && maps.length > 0;
|
||||
|
|
Loading…
Reference in a new issue