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/voice/*
|
||||||
assets/fonts/*
|
assets/fonts/*
|
||||||
assets/feature_articles/*
|
assets/feature_articles/*
|
||||||
|
assets/World_basemap_mini*
|
||||||
gen/
|
gen/
|
||||||
local.properties
|
local.properties
|
||||||
raw/
|
raw/
|
||||||
|
|
|
@ -60,4 +60,6 @@
|
||||||
<asset source="fonts/65_NotoSansNastaliqUrdu-Regular.ttf" destination="fonts/65_NotoSansNastaliqUrdu-Regular.ttf" mode="alwaysOverwriteOrCopy" />
|
<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="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>
|
</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) {
|
task collectVoiceAssets(type: Sync) {
|
||||||
from "../../resources/voice"
|
from "../../resources/voice"
|
||||||
into "assets/voice"
|
into "assets/voice"
|
||||||
|
@ -298,7 +304,8 @@ task collectExternalResources {
|
||||||
copyStyleIcons,
|
copyStyleIcons,
|
||||||
updateNoTranslate,
|
updateNoTranslate,
|
||||||
validateTranslate,
|
validateTranslate,
|
||||||
copyWidgetIcons
|
copyWidgetIcons,
|
||||||
|
downloadWorldMiniBasemap
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy core build
|
// Legacy core build
|
||||||
|
|
|
@ -622,122 +622,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</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
|
<View
|
||||||
android:id="@+id/map2_downloading_divider"
|
android:id="@+id/map2_downloading_divider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -57,7 +57,6 @@ import org.json.JSONObject;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -86,14 +85,11 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
|
|
||||||
private Timer locationSearchTimer;
|
private Timer locationSearchTimer;
|
||||||
private boolean waitForIndexes;
|
private boolean waitForIndexes;
|
||||||
List<IndexItem> indexItems = new ArrayList<>();
|
|
||||||
|
|
||||||
private static Location location;
|
private static Location location;
|
||||||
private static WorldRegion localDownloadRegion;
|
private static WorldRegion mapDownloadRegion;
|
||||||
private static IndexItem localMapIndexItem;
|
private static IndexItem mapIndexItem;
|
||||||
private static IndexItem baseMapIndexItem;
|
private static boolean mapDownloadCancelled;
|
||||||
private static boolean firstMapDownloadCancelled;
|
|
||||||
private static boolean secondMapDownloadCancelled;
|
|
||||||
private static boolean wizardClosed;
|
private static boolean wizardClosed;
|
||||||
|
|
||||||
enum WizardType {
|
enum WizardType {
|
||||||
|
@ -197,19 +193,14 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
case MAP_FOUND:
|
case MAP_FOUND:
|
||||||
TextView mapTitle = (TextView) view.findViewById(R.id.map_download_title);
|
TextView mapTitle = (TextView) view.findViewById(R.id.map_download_title);
|
||||||
TextView mapDescription = (TextView) view.findViewById(R.id.map_download_desc);
|
TextView mapDescription = (TextView) view.findViewById(R.id.map_download_desc);
|
||||||
final IndexItem indexItem = localMapIndexItem != null ? localMapIndexItem : baseMapIndexItem;
|
if (mapIndexItem != null) {
|
||||||
if (indexItem != null) {
|
mapTitle.setText(mapIndexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false));
|
||||||
mapTitle.setText(indexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false));
|
mapDescription.setText(mapIndexItem.getSizeDescription(getContext()));
|
||||||
mapDescription.setText(indexItem.getSizeDescription(getContext()));
|
|
||||||
}
|
}
|
||||||
view.findViewById(R.id.map_download_action_button).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.map_download_action_button).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
boolean spaceEnoughForBoth = validationManager.isSpaceEnoughForDownload(getActivity(), false, localMapIndexItem, baseMapIndexItem);
|
boolean spaceEnoughForLocal = validationManager.isSpaceEnoughForDownload(getActivity(), true, mapIndexItem);
|
||||||
boolean spaceEnoughForLocal = validationManager.isSpaceEnoughForDownload(getActivity(), true, localMapIndexItem);
|
|
||||||
if (!spaceEnoughForBoth) {
|
|
||||||
baseMapIndexItem = null;
|
|
||||||
}
|
|
||||||
if (spaceEnoughForLocal) {
|
if (spaceEnoughForLocal) {
|
||||||
showMapDownloadFragment(getActivity());
|
showMapDownloadFragment(getActivity());
|
||||||
}
|
}
|
||||||
|
@ -226,38 +217,30 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case MAP_DOWNLOAD:
|
case MAP_DOWNLOAD:
|
||||||
if (localMapIndexItem != null) {
|
if (mapIndexItem != null) {
|
||||||
indexItems.add(localMapIndexItem);
|
String mapName = mapIndexItem.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
||||||
}
|
|
||||||
if (baseMapIndexItem != null) {
|
|
||||||
indexItems.add(baseMapIndexItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (indexItems.size() > 0) {
|
|
||||||
final IndexItem item = indexItems.get(0);
|
|
||||||
String mapName = item.getVisibleName(getContext(), getMyApplication().getRegions(), false);
|
|
||||||
TextView mapNameTextView = (TextView) view.findViewById(R.id.map_downloading_title);
|
TextView mapNameTextView = (TextView) view.findViewById(R.id.map_downloading_title);
|
||||||
mapNameTextView.setText(mapName);
|
mapNameTextView.setText(mapName);
|
||||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||||
final View progressPadding = view.findViewById(R.id.map_download_padding);
|
final View progressPadding = view.findViewById(R.id.map_download_padding);
|
||||||
final View progressLayout = view.findViewById(R.id.map_download_progress_layout);
|
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);
|
final ImageButton redownloadButton = (ImageButton) view.findViewById(R.id.map_redownload_button);
|
||||||
redownloadButton.setOnClickListener(new View.OnClickListener() {
|
redownloadButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (!downloadThread.isDownloading(item) && !item.isDownloaded()) {
|
if (!downloadThread.isDownloading(mapIndexItem) && !mapIndexItem.isDownloaded()) {
|
||||||
validationManager.startDownload(getActivity(), item);
|
validationManager.startDownload(getActivity(), mapIndexItem);
|
||||||
firstMapDownloadCancelled = false;
|
mapDownloadCancelled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.findViewById(R.id.map_download_progress_button).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.map_download_progress_button).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
firstMapDownloadCancelled = true;
|
mapDownloadCancelled = true;
|
||||||
downloadThread.cancelDownload(item);
|
downloadThread.cancelDownload(mapIndexItem);
|
||||||
mapDescriptionTextView.setText(item.getSizeDescription(getContext()));
|
mapDescriptionTextView.setText(mapIndexItem.getSizeDescription(getContext()));
|
||||||
progressPadding.setVisibility(View.VISIBLE);
|
progressPadding.setVisibility(View.VISIBLE);
|
||||||
progressLayout.setVisibility(View.GONE);
|
progressLayout.setVisibility(View.GONE);
|
||||||
redownloadButton.setVisibility(View.VISIBLE);
|
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);
|
view.findViewById(R.id.map_downloading_layout).setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
view.findViewById(R.id.map_downloading_layout).setVisibility(View.GONE);
|
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() {
|
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:
|
case MAP_FOUND:
|
||||||
break;
|
break;
|
||||||
case MAP_DOWNLOAD:
|
case MAP_DOWNLOAD:
|
||||||
if (!startDownload(0)) {
|
startDownload();
|
||||||
startDownload(1);
|
if (mapDownloadRegion != null) {
|
||||||
}
|
downloadThread.initSettingsFirstMap(mapDownloadRegion);
|
||||||
if (localDownloadRegion != null) {
|
|
||||||
downloadThread.initSettingsFirstMap(localDownloadRegion);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -505,97 +447,55 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
} else {
|
} else {
|
||||||
v = getString(R.string.file_size_in_mb, mb);
|
v = getString(R.string.file_size_in_mb, mb);
|
||||||
}
|
}
|
||||||
|
if (!mapDownloadCancelled) {
|
||||||
int index = indexItems.indexOf(indexItem);
|
|
||||||
if (index == 0) {
|
|
||||||
if (!firstMapDownloadCancelled) {
|
|
||||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
||||||
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.map_download_progress_bar);
|
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.map_download_progress_bar);
|
||||||
mapDescriptionTextView.setText(v);
|
mapDescriptionTextView.setText(v);
|
||||||
progressBar.setProgress(progress < 0 ? 0 : progress);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
updateDownloadedItem();
|
||||||
}
|
|
||||||
updateDownloadedItems();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadHasFinished() {
|
public void downloadHasFinished() {
|
||||||
updateDownloadedItems();
|
updateDownloadedItem();
|
||||||
startDownload(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean startDownload(int itemIndex) {
|
private boolean startDownload() {
|
||||||
boolean downloadStarted = false;
|
boolean downloadStarted = false;
|
||||||
if (itemIndex == 0 && indexItems.size() > 0) {
|
if (!downloadThread.isDownloading(mapIndexItem)
|
||||||
IndexItem indexItem = indexItems.get(0);
|
&& !mapIndexItem.isDownloaded()
|
||||||
if (!downloadThread.isDownloading(indexItem)
|
&& !mapDownloadCancelled) {
|
||||||
&& !indexItem.isDownloaded()
|
validationManager.startDownload(getActivity(), mapIndexItem);
|
||||||
&& !firstMapDownloadCancelled) {
|
|
||||||
validationManager.startDownload(getActivity(), indexItem);
|
|
||||||
downloadStarted = true;
|
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;
|
return downloadStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDownloadedItems() {
|
private void updateDownloadedItem() {
|
||||||
int i = 0;
|
|
||||||
final View firstRowLayout = view.findViewById(R.id.map_downloading_layout);
|
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 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 redownloadButton = (ImageButton) view.findViewById(R.id.map_redownload_button);
|
||||||
final ImageButton redownloadButton2 = (ImageButton) view.findViewById(R.id.map2_redownload_button);
|
if (mapIndexItem.isDownloaded()) {
|
||||||
for (IndexItem indexItem : indexItems) {
|
if (progressLayout.getVisibility() == View.VISIBLE) {
|
||||||
if (indexItem.isDownloaded()) {
|
|
||||||
if (i == 0 && progressLayout.getVisibility() == View.VISIBLE) {
|
|
||||||
final TextView mapDescriptionTextView = (TextView) view.findViewById(R.id.map_downloading_desc);
|
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);
|
view.findViewById(R.id.map_download_padding).setVisibility(View.VISIBLE);
|
||||||
progressLayout.setVisibility(View.GONE);
|
progressLayout.setVisibility(View.GONE);
|
||||||
firstRowLayout.setClickable(true);
|
firstRowLayout.setClickable(true);
|
||||||
final LatLon mapCenter = getMapCenter(indexItem);
|
final LatLon mapCenter = getMapCenter();
|
||||||
final int mapZoom = getMapZoom(indexItem);
|
final int mapZoom = getMapZoom();
|
||||||
firstRowLayout.setOnClickListener(new View.OnClickListener() {
|
firstRowLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showOnMap(mapCenter, mapZoom);
|
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 {
|
} else {
|
||||||
if (downloadThread.isDownloading(indexItem)) {
|
if (downloadThread.isDownloading(mapIndexItem)) {
|
||||||
if (i == 0 && !firstMapDownloadCancelled) {
|
if (!mapDownloadCancelled) {
|
||||||
if (progressLayout.getVisibility() == View.GONE) {
|
if (progressLayout.getVisibility() == View.GONE) {
|
||||||
progressLayout.setVisibility(View.VISIBLE);
|
progressLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -603,33 +503,23 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
redownloadButton.setVisibility(View.GONE);
|
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;
|
final LatLon mapCenter;
|
||||||
if (indexItem == localMapIndexItem && localDownloadRegion != null) {
|
if (mapDownloadRegion != null) {
|
||||||
mapCenter = localDownloadRegion.getRegionCenter();
|
mapCenter = mapDownloadRegion.getRegionCenter();
|
||||||
} else {
|
} else {
|
||||||
mapCenter = new LatLon(48, 17);
|
mapCenter = new LatLon(48, 17);
|
||||||
}
|
}
|
||||||
return mapCenter;
|
return mapCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getMapZoom(IndexItem indexItem) {
|
private int getMapZoom() {
|
||||||
final int mapZoom;
|
final int mapZoom;
|
||||||
if (indexItem == localMapIndexItem && localDownloadRegion != null) {
|
if (mapDownloadRegion != null) {
|
||||||
mapZoom = 13;
|
mapZoom = 13;
|
||||||
} else {
|
} else {
|
||||||
mapZoom = 3;
|
mapZoom = 3;
|
||||||
|
@ -691,19 +581,17 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
if (!Algorithms.isEmpty(selectedFullName)) {
|
if (!Algorithms.isEmpty(selectedFullName)) {
|
||||||
WorldRegion downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
WorldRegion downloadRegion = osmandRegions.getRegionData(selectedFullName);
|
||||||
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
if (downloadRegion != null && downloadRegion.isRegionMapDownload()) {
|
||||||
localDownloadRegion = downloadRegion;
|
FirstUsageWizardFragment.mapDownloadRegion = downloadRegion;
|
||||||
List<IndexItem> indexItems = new LinkedList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
List<IndexItem> indexItems = new LinkedList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||||
for (IndexItem item : indexItems) {
|
for (IndexItem item : indexItems) {
|
||||||
if (item.getType() == DownloadActivityType.NORMAL_FILE) {
|
if (item.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||||
localMapIndexItem = item;
|
mapIndexItem = item;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
baseMapIndexItem = downloadThread.getIndexes().getWorldBaseMapItem();
|
if (mapIndexItem != null) {
|
||||||
|
|
||||||
if (localMapIndexItem != null || baseMapIndexItem != null) {
|
|
||||||
showMapFoundFragment(getActivity());
|
showMapFoundFragment(getActivity());
|
||||||
} else {
|
} else {
|
||||||
closeWizard();
|
closeWizard();
|
||||||
|
@ -740,9 +628,8 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
||||||
activity.getSupportFragmentManager().beginTransaction()
|
activity.getSupportFragmentManager().beginTransaction()
|
||||||
.remove(FirstUsageWizardFragment.this).commit();
|
.remove(FirstUsageWizardFragment.this).commit();
|
||||||
location = null;
|
location = null;
|
||||||
localDownloadRegion = null;
|
mapDownloadRegion = null;
|
||||||
localMapIndexItem = null;
|
mapIndexItem = null;
|
||||||
baseMapIndexItem = null;
|
|
||||||
wizardClosed = true;
|
wizardClosed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,6 +639,19 @@ public class ResourceManager {
|
||||||
}
|
}
|
||||||
File liveDir = context.getAppPath(IndexConstants.LIVE_INDEX_DIR);
|
File liveDir = context.getAppPath(IndexConstants.LIVE_INDEX_DIR);
|
||||||
depthContours = false;
|
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) {
|
for (File f : files) {
|
||||||
progress.startTask(context.getString(R.string.indexing_map) + " " + f.getName(), -1); //$NON-NLS-1$
|
progress.startTask(context.getString(R.string.indexing_map) + " " + f.getName(), -1); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
|
@ -1043,7 +1056,8 @@ public class ResourceManager {
|
||||||
File[] maps = dir.listFiles(new FileFilter() {
|
File[] maps = dir.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File pathname) {
|
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;
|
return maps != null && maps.length > 0;
|
||||||
|
|
Loading…
Reference in a new issue