Merge branch 'feature_dots'

This commit is contained in:
unknown 2014-06-15 23:17:52 +03:00
commit b0625fbeab
69 changed files with 535 additions and 625 deletions

View file

@ -114,6 +114,7 @@
<activity android:name="net.osmand.plus.activities.SettingsNavigationActivity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name="net.osmand.plus.monitoring.SettingsMonitoringActivity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name="net.osmand.plus.rastermaps.SettingsRasterMapsActivity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".routesteps.RouteStepsActivity"/>
<activity android:name="net.osmand.plus.osmedit.SettingsOsmEditingActivity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name="net.osmand.plus.development.SettingsDevelopmentActivity" android:configChanges="keyboardHidden|orientation"></activity>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dip" >
<TextView android:id="@+id/index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:focusable="false"
android:focusableInTouchMode="false"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/checkBox1"
android:layout_alignBottom="@+id/checkBox1"
android:layout_toRightOf="@+id/checkBox1"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/checkBox1"
android:layout_alignBottom="@+id/checkBox1"
android:layout_alignParentRight="true"/>
</RelativeLayout>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:padding="10dp"
android:text="@string/all_route_points" android:textSize="20sp" />
<Button android:id="@+id/done"
android:layout_width="wrap_content"
android:layout_marginRight="6dp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:text="done"/>
</RelativeLayout>
<ListView android:id="@+id/pointsListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/one"
android:title="@string/route_step_menu_mark_as_next"/>
<item
android:id="@+id/two"
android:title="@string/route_step_menu_show_on_map"/>
</menu>

View file

@ -877,6 +877,8 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="map_widget_right_stack">Right panel:</string>
<string name="map_widget_left_stack">Left panel:</string>
<string name="map_widget_parking">Parking</string>
<string name="map_widget_route_steps">Route steps</string>
<string name="all_route_points">All route points</string>
<string name="map_widget_monitoring">GPX recording</string>
<string name="map_widget_speed">Speed</string>
<string name="map_widget_distance">Destination</string>
@ -1874,4 +1876,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="av_photo_play_sound">Play sound on photo shot</string>
<string name="av_photo_play_sound_descr">Choose whether to play a sound when shooting photos</string>
<string name="navigation_intent_invalid">Invalid format: %s</string>
<string name="route_step_menu_mark_as_next">Mark as next</string>
<string name="route_step_menu_show_on_map">Show on map</string>
</resources>

View file

@ -85,8 +85,9 @@ public abstract class OsmandPlugin {
installedPlugins.add(parking);
}
final RouteStepsPlugin routeSteps = new RouteStepsPlugin(app);
installPlugin(ROUTE_STEPS_PLUGIN_COMPONENT, RouteStepsPlugin.ID, app, routeSteps);
//final RouteStepsPlugin routeSteps = new RouteStepsPlugin(app);
//installPlugin(ROUTE_STEPS_PLUGIN_COMPONENT, RouteStepsPlugin.ID, app, routeSteps);
installedPlugins.add(new RouteStepsPlugin(app));
installPlugin(OSMODROID_PLUGIN_COMPONENT, OsMoDroidPlugin.ID, app, new OsMoDroidPlugin(app));
installedPlugins.add(new OsmEditingPlugin(app));

View file

@ -0,0 +1,363 @@
package net.osmand.plus.routesteps;
import alice.tuprolog.Int;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.*;
import android.widget.*;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import net.osmand.CallbackWithObject;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.views.ContextMenuLayer;
import java.io.File;
import java.util.*;
/**
* Created by Bars on 13.06.2014.
*/
public class RouteStepsActivity extends SherlockFragmentActivity {
private static final String VISITED_KEY = "IsVisited";
private static final String POINT_KEY = "Point";
private static final String CURRENT_ROUTE_KEY = "CurrentRoute";
private File file;
private GPXUtilities.GPXFile gpx;
private OsmandApplication app;
private GPXUtilities.Route currentRoute;
private List<GPXUtilities.WptPt> pointsList;
private List<Long> pointsStatus;
//saves indexed of sorted list
private List<Integer> pointsIndex;
//needed to save user selection
private List<Boolean> pointsChangedState;
private List<Boolean> pointsStartState;
private RouteStepsPlugin plugin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.setContentView(R.layout.route_steps_main);
this.app = (OsmandApplication) getApplication();
getPlugin();
getGpx();
if (gpx != null){
preparePoints();
}
Button done = (Button) findViewById(R.id.done);
done.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
saveStatus();
}
});
super.onCreate(savedInstanceState);
}
private void getPlugin(){
List<OsmandPlugin> plugins = OsmandPlugin.getEnabledPlugins();
for (OsmandPlugin plugin: plugins){
if (plugin instanceof RouteStepsPlugin){
this.plugin = (RouteStepsPlugin) plugin;
}
}
}
private void getGpx(){
if (plugin.getGpx() != null){
this.gpx = plugin.getGpx();
} else {
GpxUiHelper.selectGPXFile(this,false,false, new CallbackWithObject<GPXUtilities.GPXFile[]>() {
@Override
public boolean processResult(GPXUtilities.GPXFile[] result) {
gpx = result[0];
preparePoints();
plugin.setGpx(gpx);
return false;
}
});
}
}
private void preparePoints(){
loadCurrentRoute();
pointsList = currentRoute.points;
sortPoints();
pointsStatus = getAllPointsStatus();
pointsStartState = getPointsState();
pointsChangedState = new ArrayList<Boolean>(pointsStartState);
displayListView();
}
private void displayListView() {
ArrayList<PointItem> pointItemsList = new ArrayList<PointItem>();
for (int i = 0; i < pointsList.size(); i++) {
String pointName = pointsList.get(i).name;
if (pointsStatus.get(i) != 0) {
String dateString= DateFormat.format("MM/dd/yyyy", new Date(pointsStatus.get(i))).toString();
pointItemsList.add(new PointItem(true, pointName, dateString));
} else {
pointItemsList.add(new PointItem(false, pointName, ""));
}
}
PointItemAdapter adapter = new PointItemAdapter(this, R.layout.route_point_info, pointItemsList);
final ListView listView = (ListView) findViewById(R.id.pointsListView);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
final PopupMenu menu = new PopupMenu(RouteStepsActivity.this, view);
menu.getMenuInflater().inflate(R.menu.route_step_menu, menu.getMenu());
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
if (menuItem.getTitle().equals("Mark as next")){
} else {
//AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
///int position = info.position;
//GPXUtilities.WptPt point = pointsList.get(position);
//app.getSettings().setMapLocationToShow();
}
return true;
}
});
menu.show();
}
});
}
private void loadCurrentRoute() {
if (gpx.routes.size() < 1) {
return;
}
Map<String, String> map = gpx.getExtensionsToRead();
if (map.containsKey(CURRENT_ROUTE_KEY)) {
String routeName = map.get(CURRENT_ROUTE_KEY);
for (GPXUtilities.Route route : gpx.routes) {
if (route.name.equals(routeName)) {
currentRoute = route;
return;
}
}
}
currentRoute = gpx.routes.get(0);
}
private List<Long> getAllPointsStatus() {
List<Long> pointsStatus = new ArrayList<Long>();
for (int i = 0; i < pointsList.size(); i++) {
pointsStatus.add(getPointStatus(pointsIndex.get(i)));
}
return pointsStatus;
}
private void saveStatus(){
for (int i = 0; i < pointsChangedState.size(); i++) {
boolean newValue = pointsChangedState.get(i);
//if values is the same - there's no need to save data
if (newValue != pointsStartState.get(i)) {
int indexToWrite = pointsIndex.get(i);
setPointStatus(indexToWrite, newValue);
}
}
saveGPXFile();
finish();
}
private void sortPoints(){
List<GPXUtilities.WptPt> listToSort = new ArrayList<GPXUtilities.WptPt>();
List<Integer> indexItemsAtTheEnd = new ArrayList<Integer>();
pointsIndex = new ArrayList<Integer>();
for (int i =0; i< pointsList.size(); i++){
long status = getPointStatus(i);
if (status == 0L){
listToSort.add(pointsList.get(i));
pointsIndex.add(i);
} else{
indexItemsAtTheEnd.add(i);
}
}
for (int i : indexItemsAtTheEnd){
listToSort.add(pointsList.get(i));
pointsIndex.add(i);
}
pointsList = listToSort;
}
private void saveGPXFile() {
GPXUtilities.writeGpxFile(new File(gpx.path), gpx, app);
}
private long getPointStatus(int numberOfPoint) {
Map<String, String> map = currentRoute.getExtensionsToRead();
String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
if (map.containsKey(mapKey)) {
String value = map.get(mapKey);
return (Long.valueOf(value));
}
return 0L;
}
//saves point status value to gpx extention file
private void setPointStatus(int numberOfPoint, boolean status) {
Map<String, String> map = currentRoute.getExtensionsToWrite();
String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
if (status) {
//value is current time
Calendar c = Calendar.getInstance();
long number = c.getTimeInMillis();
map.put(mapKey, String.valueOf(number));
} else if (map.containsKey(mapKey)) {
map.remove(mapKey);
}
}
public List<Boolean> getPointsState() {
List<Boolean> status = new ArrayList<Boolean>();
for (int i = 0; i < pointsStatus.size(); i++) {
if (pointsStatus.get(i) == 0) {
status.add(false);
} else {
status.add(true);
}
}
return status;
}
private boolean[] toPrimitiveArray(final List<Boolean> booleanList) {
final boolean[] primitives = new boolean[booleanList.size()];
int index = 0;
for (Boolean object : booleanList) {
primitives[index++] = object;
}
return primitives;
}
private class PointItemAdapter extends ArrayAdapter<PointItem> {
private RouteStepsActivity ctx;
private ArrayList<PointItem> pointsList;
public PointItemAdapter(Context context, int textViewResourceId, ArrayList<PointItem> pointsList) {
super(context, textViewResourceId, pointsList);
ctx = (RouteStepsActivity) context;
this.pointsList = new ArrayList<PointItem>();
this.pointsList.addAll(pointsList);
}
private class ViewHolder {
TextView index;
TextView name;
TextView date;
CheckBox visited;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
Log.v("ConvertView", String.valueOf(position));
if (convertView == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.route_point_info, null);
holder = new ViewHolder();
holder.index = (TextView) convertView.findViewById(R.id.index);
holder.date = (TextView) convertView.findViewById(R.id.date);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.visited = (CheckBox) convertView.findViewById(R.id.checkBox1);
convertView.setTag(holder);
holder.visited.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CheckBox ch = (CheckBox) view;
RelativeLayout parent = (RelativeLayout) ch.getParent();
TextView text = (TextView) parent.getChildAt(0);
pointsChangedState.set(Integer.parseInt(text.getText().toString()), ch.isChecked());
}
});
} else {
holder = (ViewHolder) convertView.getTag();
}
PointItem point = pointsList.get(position);
holder.index.setText(String.valueOf(position));
holder.visited.setChecked(point.isSelected());
String pointName = point.getName();
int pos = pointName.indexOf(":");
holder.name.setText(pointName.substring(0, pos));
if (point.isSelected()){
holder.date.setText(String.valueOf(point.getTime()));
} else{
holder.date.setText("");
}
return convertView;
}
}
private class PointItem {
private boolean visited;
private String name;
private String time;
public PointItem(boolean visited, String name, String time) {
this.visited = visited;
this.name = name;
this.time = time;
}
public String getName() {
return name;
}
public String getTime() {
return time;
}
public boolean isSelected() {
return visited;
}
public void setSelected(boolean selected) {
this.visited = selected;
}
}
}

View file

@ -3,11 +3,21 @@ package net.osmand.plus.routesteps;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Paint;
import android.view.View;
import net.osmand.data.LatLon;
import net.osmand.plus.*;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@ -18,11 +28,6 @@ public class RouteStepsPlugin extends OsmandPlugin {
public static final String ID = "osmand.route.stepsPlugin";
private static final String VISITED_KEY = "IsVisited";
private static final String POINT_KEY = "Point";
private static final String CURRENT_ROUTE_KEY = "CurrentRoute";
private OsmandApplication app;
private GPXUtilities.GPXFile gpx;
private File file;
@ -31,35 +36,35 @@ public class RouteStepsPlugin extends OsmandPlugin {
private int currentPointPos;
private RouteStepsLayer routeStepsLayer;
private List<GPXUtilities.WptPt> pointsList;
private List<Boolean> pointsStatus;
private TextInfoWidget routeStepsControl;
public RouteStepsPlugin(OsmandApplication app){
public RouteStepsPlugin(OsmandApplication app) {
ApplicationMode. regWidget("route_steps", (ApplicationMode[]) null);
this.app = app;
this.file = new File("/storage/emulated/0/osmand/tracks/","504.gpx");
gpx = GPXUtilities.loadGPXFile(app, file);
loadCurrentRoute();
pointsList = currentRoute.points;
pointsStatus = new ArrayList<Boolean>(pointsList.size());
getAllPointsStatus();
// this.file = new File("/storage/emulated/0/osmand/tracks/", "504.gpx");
// gpx = GPXUtilities.loadGPXFile(app, file);
}
public void setGpxFile(GPXUtilities.GPXFile file){ this.gpx = file;}
public void setGpxFile(GPXUtilities.GPXFile file) {
this.gpx = file;
}
public void saveGPXFile(){ GPXUtilities.writeGpxFile(file,gpx,app); }
public void setCurrentPoint(GPXUtilities.WptPt point){
public void setCurrentPoint(GPXUtilities.WptPt point) {
currentPoint = point;
int number = findPointPosition(point);
currentPointPos = number;
}
public void setCurrentPoint(int number){
public void setCurrentPoint(int number) {
currentPoint = pointsList.get(number);
currentPointPos = number;
}
public List<GPXUtilities.WptPt> getPoints() {
return currentRoute.points;
}
@Override
public String getId() {
return ID;
@ -80,149 +85,42 @@ public class RouteStepsPlugin extends OsmandPlugin {
return true;
}
@Override
public GPXUtilities.GPXFile getGpx(){ return gpx;}
public void setGpx(GPXUtilities.GPXFile gpx) { this.gpx = gpx;}
public void registerLayers(MapActivity activity) {
// remove old if existing after turn
if(routeStepsLayer != null) {
if (routeStepsLayer != null) {
activity.getMapView().removeLayer(routeStepsLayer);
}
routeStepsLayer = new RouteStepsLayer(activity, this);
activity.getMapView().addLayer(routeStepsLayer, 5.5f);
//registerWidget(activity);
registerWidget(activity);
}
public List<GPXUtilities.WptPt> getPoints() {return currentRoute.points;}
public boolean getPointStatus(int numberOfPoint) {
Map<String, String> map = currentRoute.getExtensionsToRead();
String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
if (map.containsKey(mapKey)){
String value = map.get(mapKey);
return (value.equals("true"));
private void registerWidget(MapActivity activity) {
MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
if (mapInfoLayer != null) {
routeStepsControl = createRouteStepsInfoControl(activity, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText());
mapInfoLayer.getMapInfoControls().registerSideWidget(routeStepsControl,
R.drawable.widget_parking, R.string.map_widget_route_steps, "route_steps", false, 8);
mapInfoLayer.recreateControls();
}
return false;
}
//saves point status value to gpx extention file
public void setPointStatus(int numberOfPoint, boolean status) {
Map<String, String> map = currentRoute.getExtensionsToWrite();
String mapKey = POINT_KEY + numberOfPoint + VISITED_KEY;
if (status){
map.put(mapKey, "true");
public GPXUtilities.WptPt getNextPoint() {
if (pointsList.size() > currentPointPos + 1) {
return pointsList.get(currentPointPos + 1);
} else {
map.put(mapKey, "false");
}
}
public GPXUtilities.WptPt getNextPoint(){
if (pointsList.size() > currentPointPos +1){
return pointsList.get(currentPointPos+1);
} else{
return null;
}
}
private void loadCurrentRoute() {
if (gpx.routes.size() < 1){
return;
}
Map<String,String> map = gpx.getExtensionsToRead();
if (map.containsKey(CURRENT_ROUTE_KEY)){
String routeName = map.get(CURRENT_ROUTE_KEY);
int i = 0;
for(GPXUtilities.Route route : gpx.routes){
if (route.name.equals(routeName)){
currentRoute = route;
return;
}
i++;
}
}
currentRoute = gpx.routes.get(0);
}
@Override
public void registerMapContextMenuActions(final MapActivity mapActivity,
final double latitude, final double longitude,
ContextMenuAdapter adapter, Object selectedObj) {
ContextMenuAdapter.OnContextMenuClick addListener = new ContextMenuAdapter.OnContextMenuClick() {
@Override
public void onContextMenuClick(int resId, int pos,
boolean isChecked, DialogInterface dialog) {
if (resId == R.string.context_menu_item_show_route_points) {
showStepsDialog(mapActivity);
}
}
};
adapter.item(R.string.context_menu_item_show_route_points)
.icons( R.drawable.ic_action_parking_dark, R.drawable.ic_action_parking_light).listen(addListener).reg();
}
private void getAllPointsStatus(){
for(int i=0; i< pointsList.size(); i++){
pointsStatus.add(getPointStatus(i));
}
}
private void showStepsDialog(MapActivity mapActivity){
List<String> pointNames = new ArrayList<String>();
//this array need to collect user selection during dialogue
final List<Boolean> pointsIntermediateState = new ArrayList<Boolean>(pointsStatus);
for(GPXUtilities.WptPt point : pointsList){
pointNames.add(point.name);
}
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
builder.setTitle("All available points");
builder.setMultiChoiceItems(pointNames.toArray(new String[pointNames.size()]), toPrimitiveArray(pointsIntermediateState), new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i, boolean isChecked) {
//saving user choice
pointsIntermediateState.set(i,isChecked);
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
for (int j=0; j< pointsIntermediateState.size(); j++){
boolean newValue = pointsIntermediateState.get(j);
//if values is the same - there's no need to save data
if (newValue != pointsStatus.get(j)){
setPointStatus(j,newValue);
}
}
pointsStatus = new ArrayList<Boolean>(pointsIntermediateState);
saveGPXFile();
}
});
builder.setNegativeButton("Cancel", null);
builder.show();
}
private boolean[] toPrimitiveArray(final List<Boolean> booleanList) {
final boolean[] primitives = new boolean[booleanList.size()];
int index = 0;
for (Boolean object : booleanList) {
primitives[index++] = object;
}
return primitives;
}
private int findPointPosition(GPXUtilities.WptPt point){
public int findPointPosition(GPXUtilities.WptPt point) {
int i = 0;
for (GPXUtilities.WptPt item : pointsList){
if (item.equals(point)){
for (GPXUtilities.WptPt item : pointsList) {
if (item.equals(point)) {
return i;
}
i++;
@ -230,4 +128,46 @@ public class RouteStepsPlugin extends OsmandPlugin {
return -1;
}
@Override
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
if (routeStepsLayer == null){
registerLayers(activity);
}
if (routeStepsControl == null) {
registerWidget(activity);
}
}
private TextInfoWidget createRouteStepsInfoControl(final MapActivity map, Paint paintText, Paint paintSubText) {
TextInfoWidget routeStepsControl = new TextInfoWidget(map, 0, paintText, paintSubText) {
@Override
public boolean updateInfo(OsmandMapLayer.DrawSettings drawSettings) {
if (gpx != null) {
OsmandMapTileView view = map.getMapView();
setText("test", "test");
} else {
setText("No gpx", "");
}
return true;
}
};
routeStepsControl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(app, RouteStepsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
app.startActivity(intent);
}
});
routeStepsControl.setText(null, null);
routeStepsControl.setImageDrawable(map.getResources().getDrawable(R.drawable.widget_parking));
return routeStepsControl;
}
}

View file

@ -86,7 +86,7 @@ public class StackWidgetView extends ViewGroup {
public void addStackView(BaseMapWidget v) {
stackViews.add(v);
stackViews.add(v);
v.setShadowColor(shadowColor);
StackWidgetView.this.addView(v, getChildCount());
}

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View file

@ -1,5 +0,0 @@
bin
gen
raw
obj
*.iml

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Osmand-ParkingPlugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.osmand.routeStepsPlugin"
android:versionCode="6"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="16" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"
android:xlargeScreens="true" android:anyDensity="true" />
<application
android:icon="@drawable/icon"
android:label="OsmAnd Parking" >
<activity
android:name="net.osmand.routeStepsPlugin.RouteStepsActivity"
android:label="Route Steps" >
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN" />-->
<!--<category android:name="android.intent.category.LAUNCHER" />-->
<!--</intent-filter>-->
</activity>
</application>
</manifest>

View file

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:text="@string/route_steps_plugin_installed"
android:textSize="22sp"/>
</FrameLayout>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nee</string>
<string name="default_buttons_yes">Ja</string>
<string name="osmand_app_not_found">OsmAnd is nie geïnstalleer nie</string>
<string name="app_name">OsmAnd Parkering</string>
<string name="route_steps_plugin_installed">OsmAnd Parkering inlegmodule is geïnstalleer en aangeskakel in OsmAnd verstellings.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">ليس</string>
<string name="default_buttons_yes">نعم</string>
<string name="osmand_app_not_found">لم يتم تثبيت OsmAnd</string>
<string name="app_name">وقوف السيارات</string>
<string name="route_steps_plugin_installed">يتم تثبيت البرنامج المساعد OsmAnd وقوف السيارات وتمكينها في إعدادات OsmAnd</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">Не</string>
<string name="default_buttons_yes">Да</string>
<string name="osmand_app_not_found">Приложението OsmAnd не е инсталирано</string>
<string name="app_name">Добавка Parking за OsmAnd</string>
<string name="route_steps_plugin_installed">Добавката Parking е инсталирана и включена в настройките на OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">Ne</string>
<string name="default_buttons_yes">Da</string>
<string name="osmand_app_not_found">OsmAnd is not installed</string>
<string name="app_name">OsmAnd Parking Plugin</string>
<string name="route_steps_plugin_installed">OsmAnd Parking Plugin is installed and enabled in OsmAnd settings.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_yes"></string>
<string name="default_buttons_no">No</string>
<string name="osmand_app_not_found">L\'OsmAnd no està instal·lat</string>
<string name="app_name">OsmAnd Aparcament</string>
<string name="route_steps_plugin_installed">El connector OsmAnd Aparcament està instal·lat i activat a la configuració de l\'OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">Ne</string>
<string name="default_buttons_yes">Ano</string>
<string name="osmand_app_not_found">OsmAnd není nainstalován</string>
<string name="app_name">OsmAnd parkování</string>
<string name="route_steps_plugin_installed">OsmAnd modul parkování je nainstalován a aktivován v nastavení OsmAnd.</string>
</resources>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nej</string>
<string name="default_buttons_yes">Ja</string>
<string name="osmand_app_not_found">OsmAnd er ikke installeret</string>
<string name="app_name">OsmAnd parkering</string>
<string name="route_steps_plugin_installed">OsmAnd udvidelsen Parkering er installeret og aktiveret i OsmAnd indstillinger.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nein</string>
<string name="default_buttons_yes">Ja</string>
<string name="osmand_app_not_found">OsmAnd ist nicht installiert</string>
<string name="app_name">OsmAnd Parkplatz-Plugin</string>
<string name="route_steps_plugin_installed">OsmAnd Parkplatz-Plugin wurde installiert und in den OsmAnd-Einstellungen aktiviert.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">No</string>
<string name="default_buttons_yes"></string>
<string name="osmand_app_not_found">OsmAnd no está instalado</string>
<string name="app_name">Aparcamiento de OsmAnd</string>
<string name="route_steps_plugin_installed">El Plugin Aparcamiento de OsmAnd está instalado y activado en la configuración de OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Ez</string>
<string name="default_buttons_yes">Bai</string>
<string name="osmand_app_not_found">OsmAnd ez dago instalatuta</string>
<string name="app_name">OsmAnd Parking Plugin</string>
<string name="route_steps_plugin_installed">OsmAnd Parking Plugin instalatuta eta aktibatuta dago OsmAnd-en konfigurazioan.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_yes">بله</string>
<string name="default_buttons_no">خیر</string>
<string name="osmand_app_not_found">OsmAnd نصب نشده است</string>
<string name="app_name">پارکینگ OsmAnd</string>
<string name="route_steps_plugin_installed">افزونه پارکینگ OsmAnd نصب شده و در تنظیمات OsmAnd فعال شده است.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">Ei</string>
<string name="default_buttons_yes">Kyllä</string>
<string name="osmand_app_not_found">OsmAnd ei ole asennettu</string>
<string name="app_name">OsmAnd Parking</string>
<string name="route_steps_plugin_installed">OsmAnd Parking lisäosa on asennettu ja aktivoitu OsmAnd:in asetuksista.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Non</string>
<string name="default_buttons_yes">Oui</string>
<string name="osmand_app_not_found">OsmAnd n\'est pas installé</string>
<string name="app_name">Greffon Parking pour OsmAnd</string>
<string name="route_steps_plugin_installed">Le greffon Parking est installé et activé dans les paramètres de OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">לא</string>
<string name="default_buttons_yes">כן</string>
<string name="osmand_app_not_found">התכנית OsmAnd אינה מותקנת</string>
<string name="app_name">חנייה עם OsmAnd</string>
<string name="route_steps_plugin_installed">תוסף החנייה של OsmAnd מותקן ומופעל בהגדרות של OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">नही</string>
<string name="default_buttons_yes">हा</string>
<string name="osmand_app_not_found">OsmAnd is not installed</string>
<string name="app_name">ओएसएमएएनडी पार्किंग प्लगिन</string>
<string name="route_steps_plugin_installed">OsmAnd Parking Plugin is installed and enabled in OsmAnd settings.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">Ne</string>
<string name="default_buttons_yes">Da</string>
<string name="osmand_app_not_found">OsmAnd nije instaliran</string>
<string name="app_name">OsmAnd Parkiralište</string>
<string name="route_steps_plugin_installed">OsmAnd dodatak za parkirališta je instaliran i omogućen u OsmAnd postavkama.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">Nem</string>
<string name="default_buttons_yes">Igen</string>
<string name="osmand_app_not_found">Az OsmAnd nincs feltelepítve</string>
<string name="app_name">OsmAnd Parkolás</string>
<string name="route_steps_plugin_installed">OsmAnd Parkolási Bővítmény feltelepítve és engedélyezve az OsmAnd beállításaiban.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">No</string>
<string name="default_buttons_yes">Yes</string>
<string name="osmand_app_not_found">OsmAnd is not installed</string>
<string name="app_name">OsmAnd Parking Plugin</string>
<string name="route_steps_plugin_installed">OsmAnd Parking Plugin is installed and enabled in OsmAnd settings.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">No</string>
<string name="default_buttons_yes">Yes</string>
<string name="osmand_app_not_found">OsmAnd is not installed</string>
<string name="app_name">OsmAnd Parking Plugin</string>
<string name="route_steps_plugin_installed">OsmAnd Parking Plugin is installed and enabled in OsmAnd settings.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">No</string>
<string name="default_buttons_yes">Si</string>
<string name="osmand_app_not_found">OsmAnd non è installato</string>
<string name="app_name">OsmAnd Parking</string>
<string name="route_steps_plugin_installed">Il Plugin Parcheggio per OsmAnd è installato e abilitato nelle impostazioni di OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">いいえ</string>
<string name="default_buttons_yes">はい</string>
<string name="osmand_app_not_found">OsmAndがインストールされていません</string>
<string name="app_name">OsmAnd駐車場</string>
<string name="route_steps_plugin_installed">OsmAnd駐車場プラグインはインストールされており、設定は有効です。</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">არა</string>
<string name="default_buttons_yes">დიახ</string>
<string name="osmand_app_not_found">OsmAnd ჩადგმული არაა</string>
<string name="app_name">OsmAnd პარკინგი</string>
<string name="route_steps_plugin_installed">OsmAnd-ის პარკინგის დამატება ჩადგმულია და ჩართულია პარამეტრებში.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Ne</string>
<string name="default_buttons_yes">Taip</string>
<string name="osmand_app_not_found">OsmAnd programa neįdiegta</string>
<string name="app_name">OsmAnd parkavimo įskiepis</string>
<string name="route_steps_plugin_installed">OsmAnd Parkavimo įskiepis įdiegiamas ir aktyvuojamas OsmAnd nustatymuose.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no"></string>
<string name="default_buttons_yes"></string>
<string name="osmand_app_not_found">OsmAnd nav instalēts</string>
<string name="app_name">OsmAnd Parkošanās</string>
<string name="route_steps_plugin_installed">OsmAnd parkošanās spraudnis ir instalēts un iespējots OsmAnd uzstādījumos.</string>
</resources>

View file

@ -1,3 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">नाही</string>
<string name="default_buttons_yes">हो</string>
<string name="osmand_app_not_found">ओएसएमएएनडि इन्स्टॉल केलेले नाही</string>
<string name="app_name">ओएसएमएएनडि पार्किंग</string>
<string name="route_steps_plugin_installed">ओएसएमएएनडि पार्किंग प्लगिन इन्स्टॉल आणि चालू केले आहे.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_yes">Ja</string>
<string name="default_buttons_no">Nei</string>
<string name="osmand_app_not_found">OsmAnd er ikke installert</string>
<string name="app_name">OsmAnd - parkering</string>
<string name="route_steps_plugin_installed">OsmAnd-pluginen er installert og aktivert i innstillingene for OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nee</string>
<string name="default_buttons_yes">Ja</string>
<string name="osmand_app_not_found">OsmAnd is niet geïnstalleerd</string>
<string name="app_name">OsmAnd parkeerplugin</string>
<string name="route_steps_plugin_installed">OsmAnd parkeerplugin is geïnstalleerd en geactiveerd in de OsmAnd-instellingen.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nie</string>
<string name="default_buttons_yes">Tak</string>
<string name="osmand_app_not_found">Osmand nie jest zainstalowany</string>
<string name="app_name">Wtyczka parkowania dla OsmAnd</string>
<string name="route_steps_plugin_installed">Wtyczka parkowania jest zainstalowana i włączona w ustawieniach OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Não</string>
<string name="default_buttons_yes">Sim</string>
<string name="osmand_app_not_found">Osmand não está instalado</string>
<string name="app_name">OsmAnd Parking Plugin</string>
<string name="route_steps_plugin_installed">OsmAnd Parking Plugin está instalado e activado nas opções OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nu</string>
<string name="default_buttons_yes">Da</string>
<string name="osmand_app_not_found">OsmAnd nu este instalat</string>
<string name="app_name">OsmAnd Parking</string>
<string name="route_steps_plugin_installed">Plugin-ul OsmAnd Parking este instalat și activat în setările OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">Нет</string>
<string name="default_buttons_yes">Да</string>
<string name="osmand_app_not_found">OsmAnd не установлен</string>
<string name="app_name">Плагин парковки OsmAnd</string>
<string name="route_steps_plugin_installed">Плагин парковки установлен и включен в настройках OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Nono</string>
<string name="default_buttons_yes">Eja</string>
<string name="osmand_app_not_found">OsmAnd no est installau</string>
<string name="app_name">OsmAnd Parchezu</string>
<string name="route_steps_plugin_installed">OsmAnd Parchezu est installau e insertau in sas impostaduras de OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">Nie</string>
<string name="default_buttons_yes">Áno</string>
<string name="osmand_app_not_found">Aplikácia OsmAnd nie je nainštalovaná</string>
<string name="app_name">OsmAnd parkovanie</string>
<string name="route_steps_plugin_installed">Parkovací zásuvný modul pre OsmAnd je nainštalovaný a povolený v nastaveniach aplikácie OsmAnd.</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_yes">Da</string>
<string name="default_buttons_no">Ne</string>
<string name="osmand_app_not_found">OsmAnd ni nameščen</string>
<string name="app_name">OsmAnd parkiranje</string>
<string name="route_steps_plugin_installed">Vtičnik OsmAnd parkiranje je nameščen in omogočen v OsmAnd nastavitvah.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Jo</string>
<string name="default_buttons_yes">Po</string>
<string name="osmand_app_not_found">OsmAnd nuk është instaluar</string>
<string name="app_name">OsmAnd Parkim</string>
<string name="route_steps_plugin_installed">Plugini OsmAnd Parkim është instaluar dhe aktivizuar në OsmAnd settings.</string>
</resources>

View file

@ -1,3 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_no">Nej</string>
<string name="default_buttons_yes">Ja</string>
<string name="osmand_app_not_found">OsmAnd är inte installerad</string>
<string name="app_name">OsmAnd - parkering</string>
<string name="route_steps_plugin_installed">OsmAnd-pluginen Parkering är installerad och aktiverad i inställningarna för OsmAnd.</string>
</resources>

View file

@ -1,3 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
</resources>

View file

@ -1,5 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="default_buttons_yes">Evet</string>
<string name="default_buttons_no">Hayır</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no">Ні</string>
<string name="default_buttons_yes">Так</string>
<string name="osmand_app_not_found">Osmand не встановлено</string>
<string name="app_name">Паркування OsmAnd</string>
<string name="route_steps_plugin_installed">Плагін Паркування OsmAnd встановлено та увімкнено у налаштуваннях OsmAnd.</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_yes"></string>
<string name="default_buttons_no">没有</string>
<string name="osmand_app_not_found">OsmAnd 未安装</string>
<string name="app_name">OsmAnd 停车场</string>
<string name="route_steps_plugin_installed">OsmAnd 停车场插件已安装,并已在 OsmAnd 设置中启用。</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="default_buttons_no"></string>
<string name="default_buttons_yes"></string>
<string name="osmand_app_not_found">OsmAnd 並未安裝</string>
<string name="route_steps_plugin_installed">OsmAnd 停車場外掛元件已安裝,並且已在 OsmAnd 設定裡啟用。</string>
<string name="app_name">OsmAnd 停車場</string>
</resources>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_buttons_no">No</string>
<string name="default_buttons_yes">Yes</string>
<string name="osmand_app_not_found">OsmAnd is not installed</string>
<string name="app_name">OsmAnd Route steps</string>
<string name="route_steps_plugin_installed">OsmAnd Route Steps Plugin is installed and enabled in OsmAnd settings.</string>
</resources>

View file

@ -1,61 +0,0 @@
package net.osmand.routeStepsPlugin;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import net.osmand.routeSteps.R;
public class RouteStepsActivity extends Activity {
private static final String OSMAND_COMPONENT = "net.osmand"; //$NON-NLS-1$
private static final String OSMAND_COMPONENT_PLUS = "net.osmand.plus"; //$NON-NLS-1$
private static final String OSMAND_ACTIVITY = "net.osmand.plus.activities.MainMenuActivity"; //$NON-NLS-1$
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intentPlus = new Intent();
intentPlus.setComponent(new ComponentName(OSMAND_COMPONENT_PLUS, OSMAND_ACTIVITY));
intentPlus.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
ResolveInfo resolved = getPackageManager().resolveActivity(intentPlus, PackageManager.MATCH_DEFAULT_ONLY);
if(resolved != null) {
stopService(intentPlus);
startActivity(intentPlus);
} else {
Intent intentNormal = new Intent();
intentNormal.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intentNormal.setComponent(new ComponentName(OSMAND_COMPONENT, OSMAND_ACTIVITY));
resolved = getPackageManager().resolveActivity(intentNormal, PackageManager.MATCH_DEFAULT_ONLY);
if (resolved != null) {
stopService(intentNormal);
startActivity(intentNormal);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.osmand_app_not_found));
builder.setPositiveButton(getString(R.string.default_buttons_yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + OSMAND_COMPONENT_PLUS));
try {
stopService(intent);
startActivity(intent);
} catch (ActivityNotFoundException e) {
}
}
});
builder.setNegativeButton(getString(R.string.default_buttons_no), null);
builder.show();
}
}
}
}