BUGFIX: An icon on the MapInfoLayer adjusted. Y-position of an parking icon on a map tuned. DEVELOPMENT: A Choose Parking Type dialog added, dialog layouts added.
This commit is contained in:
parent
a7e3866a14
commit
268116a3c9
7 changed files with 73 additions and 25 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
7
OsmAnd/res/drawable/parking_limit_button.xml
Normal file
7
OsmAnd/res/drawable/parking_limit_button.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item android:drawable="@drawable/poi_parking_pos_limit_menu_pushed" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/poi_parking_pos_limit_menu"/>
|
||||
|
||||
</selector>
|
7
OsmAnd/res/drawable/parking_no_limit_button.xml
Normal file
7
OsmAnd/res/drawable/parking_no_limit_button.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item android:drawable="@drawable/poi_parking_pos_no_limit_menu_pushed" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/poi_parking_pos_no_limit_menu"/>
|
||||
|
||||
</selector>
|
27
OsmAnd/res/layout/choose_type_of_parking.xml
Normal file
27
OsmAnd/res/layout/choose_type_of_parking.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/parking_no_lim_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:contentDescription="@string/osmand_parking_time_no_limit"
|
||||
android:background="@drawable/parking_no_limit_button" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/parking_lim_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:contentDescription="@string/osmand_parking_time_limit"
|
||||
android:layout_toRightOf="@+id/parking_no_lim_button"
|
||||
android:background="@drawable/parking_limit_button" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -9,12 +9,14 @@
|
|||
1. All your modified/created strings are in the top of the file (to make easier find what's translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="osmand_parking_time_limit">Time-limited parking</string>
|
||||
<string name="osmand_parking_time_no_limit">Time-unlimited parking</string>
|
||||
<string name="osmand_parking_position_description">The position of your parked car.</string>
|
||||
<string name="osmand_parking_position_name">Parking point</string>
|
||||
<string name="osmand_parking_plugin_description">This plugin allows to store the location of your parked car.</string>
|
||||
<string name="osmand_parking_plugin_name">Parking Position Plugin</string>
|
||||
<string name="context_menu_item_add_parking_point">Add location of a parked car</string>
|
||||
<string name="context_menu_item_delete_parking_point">Delete location of a parked car</string>
|
||||
<string name="context_menu_item_add_parking_point">Mark as a parking position</string>
|
||||
<string name="context_menu_item_delete_parking_point">Delete a parking marker</string>
|
||||
|
||||
<string name="offline_navigation_not_available">Osmand offline navigation is temporarily not available.</string>
|
||||
<string name="left_side_navigation">Left-Hand Driving</string>
|
||||
|
|
|
@ -120,7 +120,8 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
|
|||
double longitude = parkingPoint.getLongitude();
|
||||
if (isLocationVisible(latitude, longitude)) {
|
||||
int marginX = parkingNoLimitIcon.getWidth() / 2;
|
||||
int marginY = 2 * parkingNoLimitIcon.getHeight() / 3;
|
||||
// TODO tune y
|
||||
int marginY = 5 * parkingNoLimitIcon.getHeight() / 6;
|
||||
int locationX = view.getMapXForPoint(longitude);
|
||||
int locationY = view.getMapYForPoint(latitude);
|
||||
canvas.rotate(-view.getRotate(), locationX, locationY);
|
||||
|
|
|
@ -11,7 +11,8 @@ import net.osmand.plus.views.OsmandMapTileView;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.DialogInterface;
|
||||
import android.widget.Button;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -91,33 +92,36 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
* Method creates confirmation dialog for deletion of a parking location
|
||||
*/
|
||||
public void showAddParkingDialog(final MapActivity mapActivity, final double latitude, final double longitude) {
|
||||
final View addParking = mapActivity.getLayoutInflater().inflate(R.layout.choose_type_of_parking, null);
|
||||
Builder choose = new AlertDialog.Builder(mapActivity);
|
||||
choose.setTitle("Add parking location");
|
||||
// choose.setMessage("Choose the type of your parking (time-limited or unlimited)?");
|
||||
|
||||
// Button limitButton= (Button)mapActivity.findViewById();
|
||||
// limitButton.setBackgroundResource(R.drawable.poi_parking_pos_no_limit_menu_pushed);
|
||||
// Button unLimitButton= (Button)mapActivity.findViewById();
|
||||
|
||||
choose.setItems(
|
||||
new String[]{ "Time-limited parking position", "Time-unlimited parking position"},
|
||||
new DialogInterface.OnClickListener() {
|
||||
choose.setView(addParking);
|
||||
choose.setTitle("Choose the type of parking");
|
||||
|
||||
ImageButton limitButton= (ImageButton) addParking.findViewById(R.id.parking_lim_button);
|
||||
limitButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == 1) {
|
||||
settings.setParkingPosition(latitude, longitude);
|
||||
if (mapActivity.getMapView().getLayers().contains(parkingLayer))
|
||||
parkingLayer.setParkingPoint(settings.getParkingPosition());
|
||||
} else if (which == 0) {
|
||||
// TODO
|
||||
|
||||
}
|
||||
public void onClick(View v) {
|
||||
settings.setParkingPosition(latitude, longitude);
|
||||
settings.setParkingTimeLimit(1);
|
||||
if (mapActivity.getMapView().getLayers().contains(parkingLayer))
|
||||
parkingLayer.setParkingPoint(settings.getParkingPosition());
|
||||
}
|
||||
});
|
||||
|
||||
ImageButton noLimitButton= (ImageButton)addParking.findViewById(R.id.parking_no_lim_button);
|
||||
noLimitButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
settings.setParkingPosition(latitude, longitude);
|
||||
settings.setParkingTimeLimit(-1);
|
||||
if (mapActivity.getMapView().getLayers().contains(parkingLayer))
|
||||
parkingLayer.setParkingPoint(settings.getParkingPosition());
|
||||
}
|
||||
});
|
||||
// choose.setPositiveButton(R.string.default_buttons_yes, null);
|
||||
// choose.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||
choose.create();
|
||||
choose.show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue