map context menu with images and some other ui improvements
BIN
OsmAnd/res/drawable-hdpi/ic_background_popuplist.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 538 B |
BIN
OsmAnd/res/drawable-hdpi/list_activities_dot_marker2_pressed.png
Normal file
After Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 510 B |
After Width: | Height: | Size: 569 B |
BIN
OsmAnd/res/drawable-hdpi/list_activities_poi_labels.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
OsmAnd/res/drawable-large/list_activities_poi_labels.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 2.3 KiB |
BIN
OsmAnd/res/drawable-mdpi/list_activities_poi_labels.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
12
OsmAnd/res/drawable/orangedot_checkbox.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<!-- checked -->
|
||||
<item android:state_checked="true">
|
||||
<bitmap android:gravity="center" android:src="@drawable/list_activities_dot_marker2_pressed" />
|
||||
</item>
|
||||
<!-- unchecked -->
|
||||
<item><bitmap android:gravity="center" android:src="@drawable/list_activities_dot_marker2_unpressed" />
|
||||
</item>
|
||||
|
||||
</selector>
|
|
@ -1,31 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/LinearLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="0dip"
|
||||
android:paddingLeft="5dip"
|
||||
android:paddingRight="5dip"
|
||||
android:paddingTop="0dip" >
|
||||
android:paddingTop="0dip"
|
||||
android:weightSum="1" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/check_item"
|
||||
android:drawableLeft="@drawable/list_activities_poi"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/layer_poi"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/color_black" />
|
||||
android:textColor="@color/color_black" android:layout_weight="1"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:button="@drawable/orangedot_checkbox"
|
||||
android:focusable="false" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -69,6 +69,10 @@ public class ContextMenuAdapter {
|
|||
registerSelectedItem(stringResId, selected, icon, null, -1);
|
||||
}
|
||||
|
||||
public void registerItem(int stringResId, int icon) {
|
||||
registerSelectedItem(stringResId, -1, icon);
|
||||
}
|
||||
|
||||
public void registerItem(int stringResId) {
|
||||
registerSelectedItem(stringResId, -1, 0);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||
import net.osmand.Algoritms;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.LogUtil;
|
||||
import net.osmand.Version;
|
||||
import net.osmand.access.AccessibilityPlugin;
|
||||
|
|
|
@ -40,8 +40,10 @@ import android.app.AlertDialog;
|
|||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||
import android.content.DialogInterface.OnShowListener;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
|
@ -54,12 +56,17 @@ import android.text.Html;
|
|||
import android.util.FloatMath;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
|
@ -121,9 +128,19 @@ public class MapActivityActions implements DialogProvider {
|
|||
args.putSerializable(KEY_FAVORITE, point);
|
||||
final EditText editText = (EditText) dialog.findViewById(R.id.Name);
|
||||
editText.setText(point.getName());
|
||||
editText.requestFocus();
|
||||
final AutoCompleteTextView cat = (AutoCompleteTextView) dialog.findViewById(R.id.Category);
|
||||
cat.setText(point.getCategory());
|
||||
editText.selectAll();
|
||||
dialog.setOnShowListener(new OnShowListener() {
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
InputMethodManager imm = (InputMethodManager) mapActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected Dialog createAddFavouriteDialog(final Bundle args) {
|
||||
|
@ -678,16 +695,41 @@ public class MapActivityActions implements DialogProvider {
|
|||
Builder builder = new AlertDialog.Builder(mapActivity);
|
||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
|
||||
adapter.registerItem(R.string.context_menu_item_navigate_point);
|
||||
adapter.registerItem(R.string.context_menu_item_search);
|
||||
adapter.registerItem(R.string.context_menu_item_navigate_point, R.drawable.list_view_set_destination);
|
||||
adapter.registerItem(R.string.context_menu_item_search, R.drawable.list_view_search_near_here);
|
||||
adapter.registerItem(R.string.context_menu_item_directions);
|
||||
adapter.registerItem(R.string.context_menu_item_show_route);
|
||||
adapter.registerItem(R.string.context_menu_item_add_favorite);
|
||||
adapter.registerItem(R.string.context_menu_item_share_location);
|
||||
adapter.registerItem(R.string.context_menu_item_show_route, R.drawable.list_view_show_route_from_here);
|
||||
adapter.registerItem(R.string.context_menu_item_add_favorite, R.drawable.list_activities_favorites);
|
||||
adapter.registerItem(R.string.context_menu_item_share_location, R.drawable.list_view_share_location);
|
||||
|
||||
OsmandPlugin.registerMapContextMenu(mapActivity, latitude, longitude, adapter, selectedObj);
|
||||
|
||||
builder.setItems(adapter.getItemNames(), new DialogInterface.OnClickListener() {
|
||||
ListAdapter listadapter = new ArrayAdapter<String>(
|
||||
mapActivity,
|
||||
R.layout.layers_list_activity_item,
|
||||
R.id.title,
|
||||
adapter.getItemNames()){
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
//User super class to create the View
|
||||
View v = super.getView(position, convertView, parent);
|
||||
TextView tv = (TextView)v.findViewById(R.id.title);
|
||||
tv.setText(adapter.getItemName(position));
|
||||
|
||||
//Put the image on the TextView
|
||||
if(adapter.getImageId(position) != 0) {
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(adapter.getImageId(position), 0, 0, 0);
|
||||
} else {
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.list_activities_transparent, 0, 0, 0);
|
||||
}
|
||||
|
||||
final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item));
|
||||
ch.setVisibility(View.GONE);
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
builder.setAdapter(listadapter, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
|
|
@ -268,7 +268,7 @@ public class MapActivityLayers {
|
|||
adapter.registerSelectedItem(R.string.layer_poi, settings.SHOW_POI_OVER_MAP.get() ? 1 : 0,
|
||||
R.drawable.list_activities_poi);
|
||||
adapter.registerSelectedItem(R.string.layer_poi_label, settings.SHOW_POI_LABEL.get() ? 1 : 0,
|
||||
0);
|
||||
R.drawable.list_activities_poi_labels);
|
||||
adapter.registerSelectedItem(R.string.layer_favorites, settings.SHOW_FAVORITES.get() ? 1 : 0,
|
||||
R.drawable.list_activities_favorites);
|
||||
adapter.registerSelectedItem(R.string.layer_gpx_layer,
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package net.osmand.plus.monitoring;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import net.osmand.LogUtil;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.ProgressDialogImplementation;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.activities.ApplicationMode;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.SettingsActivity;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.preference.Preference;
|
||||
|
|
|
@ -131,8 +131,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
}
|
||||
}
|
||||
};
|
||||
adapter.registerItem(R.string.context_menu_item_create_poi, 0, listener, -1);
|
||||
adapter.registerItem(R.string.context_menu_item_open_bug, 0, listener, -1);
|
||||
adapter.registerItem(R.string.context_menu_item_create_poi, R.drawable.list_view_create_poi, listener, -1);
|
||||
adapter.registerItem(R.string.context_menu_item_open_bug, R.drawable.list_activities_osm_bugs, listener, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -222,8 +222,8 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
|||
}
|
||||
}
|
||||
};
|
||||
adapter.registerItem(R.string.context_menu_item_update_map, 0, listener, -1);
|
||||
adapter.registerItem(R.string.context_menu_item_download_map, 0, listener, -1);
|
||||
adapter.registerItem(R.string.context_menu_item_update_map, R.drawable.list_activities_update_map, listener, -1);
|
||||
adapter.registerItem(R.string.context_menu_item_download_map, R.drawable.list_activities_download_map, listener, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|