This commit is contained in:
Denis 2014-12-25 11:23:21 +02:00
commit 9a450fece9
7 changed files with 131 additions and 99 deletions

View file

@ -24,7 +24,7 @@
android:layout_marginTop="0dp"
android:autoLink="web"
android:gravity="center_vertical"
android:textSize="18sp"></TextView>
android:textSize="18sp"/>
<LinearLayout
android:layout_width="fill_parent"

View file

@ -6,7 +6,7 @@
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingRight="8dp"
android:paddingLeft="8dp">
android:paddingLeft="12dp">
<LinearLayout
android:layout_width="fill_parent"
@ -30,7 +30,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/ListText.Small"></TextView>
style="@style/ListText.Small"/>
<TextView
android:id="@+id/local_index_size"
@ -38,7 +38,7 @@
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/ListText.Small"></TextView>
style="@style/ListText.Small"/>
</LinearLayout>
<TextView
@ -47,6 +47,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="25"
style="@style/ListText.Small"></TextView>
style="@style/ListText.Small"/>
</LinearLayout>

View file

@ -211,7 +211,7 @@ public class OsmandApplication extends Application {
public void onTerminate() {
super.onTerminate();
if (routingHelper != null) {
routingHelper.getVoiceRouter().onApplicationTerminate(this);
routingHelper.getVoiceRouter().onApplicationTerminate();
}
}

View file

@ -951,6 +951,7 @@ public class MapActivityActions implements DialogProvider {
if(getMyApplication().getLocationProvider().getLocationSimulation().isRouteAnimating()) {
getMyApplication().getLocationProvider().getLocationSimulation().startStopRouteAnimation(mapActivity);
}
routingHelper.getVoiceRouter().interruptRouteCommands();
routingHelper.clearCurrentRoute(null, new ArrayList<LatLon>());
routingHelper.setRoutePlanningMode(false);
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());

View file

@ -1,14 +1,18 @@
package net.osmand.plus.dashboard;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.*;
import android.widget.ImageView;
import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox;
import net.osmand.map.MapTileDownloader.DownloadRequest;
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
import net.osmand.plus.R;
import net.osmand.plus.activities.MainMenuActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.render.MapRenderRepositories;
import net.osmand.plus.render.MapVectorLayer;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.views.MapTextLayer;
@ -17,9 +21,6 @@ import net.osmand.plus.views.OsmandMapTileView;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
@ -68,7 +69,6 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
startMapActivity();
}
});
setMapImage(view);
return view;
}
@ -88,7 +88,9 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
@Override
public void onResume() {
super.onResume();
setMapImage(getView());
if (!getMyApplication().isApplicationInitializing()){
updateMapImage();
}
}
@ -110,6 +112,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
}
private void applicationInitialized(View view) {
updateMapImage();
view.findViewById(R.id.loading).setVisibility(View.GONE);
MainMenuActivity dashboardActivity = ((MainMenuActivity) getSherlockActivity());
if (dashboardActivity != null) {
@ -123,7 +126,24 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
if (request != null && !request.error && request.fileToSave != null) {
ResourceManager mgr = getMyApplication().getResourceManager();
mgr.tileDownloaded(request);
}
setMapImage(getView());
}
private void updateMapImage() {
MapRenderRepositories repositories = getMyApplication().getResourceManager().getRenderer();
LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation();
int zm = getMyApplication().getSettings().getLastKnownMapZoom();
WindowManager wm = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
int height = (int) getActivity().getResources().getDimension(R.dimen.dashMapHeight);
int width = display.getWidth();
RotatedTileBox rotatedTileBox = new RotatedTileBox.RotatedTileBoxBuilder().
setZoom(zm).setLocation(lm.getLatitude(), lm.getLongitude()).
setPixelDimensions(width, height).build();
repositories.loadMap(rotatedTileBox,
getMyApplication().getResourceManager().getMapTileDownloader().getDownloaderCallbacks());
}
}

View file

@ -484,7 +484,17 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
if (type == WaypointHelper.POI && btn.isChecked()){
running[0] = position;
thisAdapter.notifyDataSetInvalidated();
selectPoi(running, thisAdapter, type, true, ctx);
MapActivity map = (MapActivity) ctx;
final PoiFilter[] selected = new PoiFilter[1];
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);
dlg.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (selected != null) {
enableType(running, thisAdapter, type, true);
}
}
});
}
}
});
@ -493,7 +503,8 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
private void selectPoi(final int[] running, final ArrayAdapter<Object> listAdapter, final int type,
final boolean enable, Activity ctx) {
if (ctx instanceof MapActivity && !PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
if (ctx instanceof MapActivity &&
!PoiFilter.CUSTOM_FILTER_ID.equals(app.getSettings().getPoiFilterForMap())) {
MapActivity map = (MapActivity) ctx;
final PoiFilter[] selected = new PoiFilter[1];
AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected);

View file

@ -793,7 +793,7 @@ public class VoiceRouter {
// }
//}
public void onApplicationTerminate(Context ctx) {
public void onApplicationTerminate() {
if (player != null) {
player.clear();
}