Update stage info to include map
This commit is contained in:
parent
456eefde5a
commit
3c04c766b1
6 changed files with 3878 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
*.render.xml
|
*.render.xml
|
||||||
|
*.template_render.xml
|
||||||
*.map_styles_presets.xml
|
*.map_styles_presets.xml
|
||||||
routing*.xml
|
routing*.xml
|
||||||
rendering_types.xml
|
rendering_types.xml
|
||||||
|
|
|
@ -9,6 +9,13 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@color/color_white">
|
android:background="@color/color_white">
|
||||||
|
|
||||||
|
<net.osmand.plus.views.OsmandMapTileView
|
||||||
|
android:id="@+id/MapView"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
android:contentDescription="@string/map_view"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/Icon"
|
android:id="@+id/Icon"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -24,6 +25,7 @@ public class SherpafyStageInfoFragment extends SherlockFragment {
|
||||||
protected StageInformation stage;
|
protected StageInformation stage;
|
||||||
protected TourInformation tour;
|
protected TourInformation tour;
|
||||||
private View view;
|
private View view;
|
||||||
|
protected OsmandMapTileView osmandMapTileView;
|
||||||
|
|
||||||
public SherpafyStageInfoFragment() {
|
public SherpafyStageInfoFragment() {
|
||||||
}
|
}
|
||||||
|
@ -64,11 +66,19 @@ public class SherpafyStageInfoFragment extends SherlockFragment {
|
||||||
TextView additional = (TextView) view.findViewById(R.id.AdditionalText);
|
TextView additional = (TextView) view.findViewById(R.id.AdditionalText);
|
||||||
TextView text = (TextView) view.findViewById(R.id.Text);
|
TextView text = (TextView) view.findViewById(R.id.Text);
|
||||||
TextView header = (TextView) view.findViewById(R.id.HeaderText);
|
TextView header = (TextView) view.findViewById(R.id.HeaderText);
|
||||||
|
osmandMapTileView = (OsmandMapTileView) view.findViewById(R.id.MapView);
|
||||||
updateView(description, icon, additional, text, header);
|
updateView(description, icon, additional, text, header);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
osmandMapTileView.refreshMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void updateView(WebView description, ImageView icon, TextView additional, TextView text, TextView header) {
|
protected void updateView(WebView description, ImageView icon, TextView additional, TextView text, TextView header) {
|
||||||
if (stage.getImageBitmap() != null) {
|
if (stage.getImageBitmap() != null) {
|
||||||
icon.setImageBitmap(stage.getImageBitmap());
|
icon.setImageBitmap(stage.getImageBitmap());
|
||||||
|
|
|
@ -1,16 +1,38 @@
|
||||||
package net.osmand.plus.sherpafy;
|
package net.osmand.plus.sherpafy;
|
||||||
|
|
||||||
|
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||||
|
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.render.MapVectorLayer;
|
||||||
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
|
import net.osmand.plus.views.GPXLayer;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class SherpafyStageItineraryFragment extends SherpafyStageInfoFragment {
|
public class SherpafyStageItineraryFragment extends SherpafyStageInfoFragment implements IMapDownloaderCallback {
|
||||||
|
|
||||||
|
private static final boolean HIDE_ITINERARY_IMG = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
app.getResourceManager().getMapTileDownloader().removeDownloaderCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateView(WebView description, ImageView icon, TextView additional, TextView text, TextView header) {
|
protected void updateView(WebView description, ImageView icon, TextView additional, TextView text, TextView header) {
|
||||||
if (stage.getItineraryBitmap() != null) {
|
app.getResourceManager().getMapTileDownloader().addDownloaderCallback(this);
|
||||||
|
osmandMapTileView.setVisibility(View.VISIBLE);
|
||||||
|
MapVectorLayer mapVectorLayer = new MapVectorLayer(null);
|
||||||
|
osmandMapTileView.addLayer(mapVectorLayer, 0.5f);
|
||||||
|
osmandMapTileView.addLayer(new GPXLayer(), 0.9f);
|
||||||
|
osmandMapTileView.setMainLayer(mapVectorLayer);
|
||||||
|
mapVectorLayer.setVisible(true);
|
||||||
|
osmandMapTileView.setLatLon(stage.getStartPoint().getLatitude(), stage.getStartPoint().getLongitude());
|
||||||
|
osmandMapTileView.setIntZoom(14);
|
||||||
|
if (stage.getItineraryBitmap() != null && !HIDE_ITINERARY_IMG) {
|
||||||
icon.setImageBitmap(stage.getItineraryBitmap());
|
icon.setImageBitmap(stage.getItineraryBitmap());
|
||||||
} else {
|
} else {
|
||||||
icon.setVisibility(View.GONE);
|
icon.setVisibility(View.GONE);
|
||||||
|
@ -28,7 +50,19 @@ public class SherpafyStageItineraryFragment extends SherpafyStageInfoFragment {
|
||||||
( h == 0 ? "" : h + " " + app.getString(R.string.int_hour) + " ") +
|
( h == 0 ? "" : h + " " + app.getString(R.string.int_hour) + " ") +
|
||||||
( min == 0 ? "" : min + " " + app.getString(R.string.int_min))+ "<h4/>";
|
( min == 0 ? "" : min + " " + app.getString(R.string.int_min))+ "<h4/>";
|
||||||
}
|
}
|
||||||
description.loadData("<html><body>" + ins + stage.getItinerary() + "</body></html", "text/html; charset=utf-8",
|
String content = HIDE_ITINERARY_IMG ? "" : stage.getItinerary();
|
||||||
|
description.loadData("<html><body>" + ins + content + "</body></html", "text/html; charset=utf-8",
|
||||||
"utf-8");
|
"utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tileDownloaded(DownloadRequest request) {
|
||||||
|
if(request != null && !request.error && request.fileToSave != null){
|
||||||
|
ResourceManager mgr = app.getResourceManager();
|
||||||
|
mgr.tileDownloaded(request);
|
||||||
|
}
|
||||||
|
if(request == null || !request.error){
|
||||||
|
osmandMapTileView.tileDownloaded(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -168,7 +168,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
drawSelectedFilesSplits(canvas, tileBox, selectedGPXFiles, settings);
|
drawSelectedFilesSplits(canvas, tileBox, selectedGPXFiles, settings);
|
||||||
drawSelectedFilesPoints(canvas, tileBox, selectedGPXFiles);
|
drawSelectedFilesPoints(canvas, tileBox, selectedGPXFiles);
|
||||||
}
|
}
|
||||||
if(textLayer.isVisible()) {
|
if(textLayer != null && textLayer.isVisible()) {
|
||||||
textLayer.putData(this, cache);
|
textLayer.putData(this, cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3822
OsmAnd/src/net/osmand/render/default.render_template.xml
Normal file
3822
OsmAnd/src/net/osmand/render/default.render_template.xml
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue