Merge branch 'master' of github.com:osmandapp/Osmand
This commit is contained in:
commit
9ba94d8f28
8 changed files with 325 additions and 289 deletions
|
@ -1962,4 +1962,5 @@ OsmAnd هو المصدر المفتوح و التي يجري تطويرها بن
|
|||
<string name="use_high_res_maps_descr">عدم تمدد (وطمس) تجانبيات/مربعات الخريطة على شاشات العرض عالية الكثافة</string>
|
||||
<string name="max_level_download_tile_descr">اختر مستوى التقريب الأقصى لتحميل تجانبيات/مربعات الخريطة من الإنترنت</string>
|
||||
<string name="map_tile_source_descr">اختر مصدر تجانبيات/مربعات الخريطة على الإنترنت أو المخزنة مؤقتاً</string>
|
||||
</resources>
|
||||
<string name="user_hates_app_get_feedback_long">فضلًا أخبرنا ما الذي تريد تغييره في هذا التّطبيق.</string>
|
||||
</resources>
|
||||
|
|
|
@ -924,4 +924,25 @@
|
|||
<string name="poi_maxheight">Максімальная вышыня</string>
|
||||
<string name="poi_service_times">Гадзіны абслугоўвання</string>
|
||||
<string name="poi_abandoned_poi">Закінуты аб\'ект</string>
|
||||
<string name="poi_icn_ref">Сетка вузлоў міжнародных веламаршрутаў</string>
|
||||
<string name="poi_ncn_ref">Сетка вузлоў нацыянальных веламаршрутаў</string>
|
||||
<string name="poi_rcn_ref">Сетка вузлоў рэгіянальных веламаршрутаў</string>
|
||||
<string name="poi_lcn_ref">Сетка вузлоў лякальных веламаршрутаў</string>
|
||||
<string name="poi_iwn_ref">Сетка вузлоў міжнародных пешых маршрутаў</string>
|
||||
<string name="poi_nwn_ref">Сетка вузлоў нацыянальных пешых маршрутаў</string>
|
||||
<string name="poi_rwn_ref">Сетка вузлоў рэгіянальных пешых маршрутаў</string>
|
||||
<string name="poi_lwn_ref">Сетка вузлоў лякальных пешых маршрутаў</string>
|
||||
|
||||
<string name="poi_route_hiking_iwn_poi">Міжнародны пешы маршрут</string>
|
||||
<string name="poi_route_hiking_nwn_poi">Нацыянальны пешы маршрут</string>
|
||||
<string name="poi_route_hiking_rwn_poi">Рэгіянальны пешы маршрут</string>
|
||||
<string name="poi_route_hiking_lwn_poi">Лякальны пешы маршрут</string>
|
||||
<string name="poi_conservation">Абароненая вобласьць</string>
|
||||
|
||||
<string name="poi_node_networks">Вузлы пешаходнай ці рованай сеткі</string>
|
||||
<string name="poi_hiking_routes">Пешыя маршруты</string>
|
||||
<string name="poi_traffic_enforcement">Кантроль руху</string>
|
||||
<string name="poi_collection_times">Гадзіны выманьня</string>
|
||||
<string name="poi_route_hiking_ref_poi">Абазначэньне пешага маршруту</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -900,7 +900,7 @@
|
|||
|
||||
<string name="poi_power_cable_distribution_cabinet">Elskab</string>
|
||||
<string name="poi_basin">Basin</string>
|
||||
<string name="poi_conservation">Landbevaring</string>
|
||||
<string name="poi_conservation">Beskyttet område</string>
|
||||
|
||||
<string name="poi_building_poi">Bygning</string>
|
||||
<string name="poi_crane">Kran</string>
|
||||
|
@ -927,19 +927,19 @@
|
|||
<string name="poi_rwn_ref">Regional vandrerute</string>
|
||||
<string name="poi_lwn_ref">Lokal vandrerute</string>
|
||||
|
||||
<string name="poi_collection_times">Tømnings antal</string>
|
||||
<string name="poi_collection_times">Tømningstider</string>
|
||||
<string name="poi_service_times">Service-tider</string>
|
||||
<string name="poi_brand">Varemærke</string>
|
||||
|
||||
<string name="poi_enforcement_traffic_signals">Håndhævelse: trafiksignaler</string>
|
||||
<string name="poi_enforcement_maxspeed">Håndhævelse: max hastighed</string>
|
||||
<string name="poi_enforcement_maxheight">Håndhævelse: max højde</string>
|
||||
<string name="poi_enforcement_mindistance">Håndhævelse: min afstand</string>
|
||||
<string name="poi_enforcement_check">Håndhævelse: kontrol</string>
|
||||
<string name="poi_enforcement_access">Håndhævelse: adgang</string>
|
||||
<string name="poi_enforcement_toll">Håndhævelse: vejafgift</string>
|
||||
<string name="poi_enforcement_traffic_signals">Trafiksignaler</string>
|
||||
<string name="poi_enforcement_maxspeed">Hastighedskontrol</string>
|
||||
<string name="poi_enforcement_maxheight">Højdekontrol</string>
|
||||
<string name="poi_enforcement_mindistance">Afstandskontrol</string>
|
||||
<string name="poi_enforcement_check">Trafikontrol</string>
|
||||
<string name="poi_enforcement_access">Adgangskontrol</string>
|
||||
<string name="poi_enforcement_toll">Vejafgiftskontrol</string>
|
||||
|
||||
<string name="poi_country">Land</string>
|
||||
<string name="poi_country">Landlig</string>
|
||||
<string name="poi_fee">Gebyr</string>
|
||||
|
||||
<string name="poi_abandoned_poi">Forladt objekt</string>
|
||||
|
@ -949,7 +949,7 @@
|
|||
<string name="poi_route_hiking_lwn_poi">Lokal vandrerute</string>
|
||||
<string name="poi_route_hiking_ref_poi">Vandrerute reference</string>
|
||||
|
||||
<string name="poi_node_networks">Vandrings/cyklings rutepunkter</string>
|
||||
<string name="poi_node_networks">Vandre-/cykelrutepunkter</string>
|
||||
<string name="poi_hiking_routes">Vandreruter</string>
|
||||
<string name="poi_traffic_enforcement">Trafik håndhævelse</string>
|
||||
<string name="poi_traffic_enforcement">Trafikovervågning</string>
|
||||
</resources>
|
||||
|
|
|
@ -871,14 +871,14 @@
|
|||
<string name="poi_kent_carriage_gap">Kutschendurchlass</string>
|
||||
<string name="poi_highway_crossing">Kreuzung</string>
|
||||
|
||||
<string name="poi_icn_ref">Internationale Radroute</string>
|
||||
<string name="poi_icn_ref">Internationales Fahrradknotenpunktnetzwerk</string>
|
||||
<string name="poi_ncn_ref">Nationale Radroute</string>
|
||||
<string name="poi_rcn_ref">Regionale Radroute</string>
|
||||
<string name="poi_lcn_ref">Örtliche Radroute</string>
|
||||
<string name="poi_iwn_ref">Internationale Wanderroute</string>
|
||||
<string name="poi_rcn_ref">Regionales Fahrradknotenpunktnetzwerk</string>
|
||||
<string name="poi_lcn_ref">Lokales Fahrradknotenpunktnetzwerk</string>
|
||||
<string name="poi_iwn_ref">Internationales Wanderknotenpunktnetzwerk</string>
|
||||
<string name="poi_nwn_ref">Nationale Wanderroute</string>
|
||||
<string name="poi_rwn_ref">Regionale Wanderroute</string>
|
||||
<string name="poi_lwn_ref">Örtliche Wanderroute</string>
|
||||
<string name="poi_rwn_ref">Regionales Wanderknotenpunktnetzwerk</string>
|
||||
<string name="poi_lwn_ref">Lokales Wanderknotenpunktnetzwerk</string>
|
||||
|
||||
<string name="poi_route_hiking_iwn_poi">Internationaler Wanderweg</string>
|
||||
<string name="poi_route_hiking_nwn_poi">Nationaler Wanderweg</string>
|
||||
|
@ -893,7 +893,7 @@
|
|||
<string name="poi_enforcement_maxspeed">Geschwindigkeitskontrolle</string>
|
||||
<string name="poi_enforcement_maxheight">Höhenkontrolle</string>
|
||||
<string name="poi_enforcement_mindistance">Abstandskontrolle</string>
|
||||
<string name="poi_enforcement_check">Kontrolle</string>
|
||||
<string name="poi_enforcement_check">Durchführung:Kontrolle</string>
|
||||
<string name="poi_enforcement_access">Kontrolle Berechtigung</string>
|
||||
<string name="poi_enforcement_toll">Mautkontrolle</string>
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<string name="stop_navigation_service">Unterbrechen</string>
|
||||
<string name="rendering_attr_alpineHiking_name">Alpine Tourenskala (SAC)</string>
|
||||
<string name="rendering_attr_alpineHiking_description">Wege entsprechend der SAC-Wanderskala darstellen</string>
|
||||
<string name="rendering_attr_hikingRoutesOSMC_name">Wandersymbole einblenden</string>
|
||||
<string name="rendering_attr_hikingRoutesOSMC_name">Wandersymboleinblendung</string>
|
||||
<string name="rendering_attr_hikingRoutesOSMC_description">Wandersymbole anzeigen (OSMC)</string>
|
||||
<string name="arrival_distance_factor_early">Früh</string>
|
||||
<string name="arrival_distance_factor_normally">Normal</string>
|
||||
|
|
|
@ -470,7 +470,7 @@
|
|||
<string name="tts_language_not_supported_title">該語言未支援</string>
|
||||
<string name="tts_language_not_supported">選用的語言 Android TTS 引擎未支援,您要到 Play 商場找其它引擎嗎?否則使用之前設定的語言。</string>
|
||||
<string name="tts_missing_language_data_title">資料遺失</string>
|
||||
<string name="tts_missing_language_data">您選的語言未安裝,您要到 Play 商場安裝嗎?</string>
|
||||
<string name="tts_missing_language_data">您選的語言未安裝,您要轉到 Play 商場安裝嗎?</string>
|
||||
<string name="gpx_option_reverse_route">反轉 GPX 方向</string>
|
||||
<string name="gpx_option_destination_point">使用目前的目的地</string>
|
||||
<string name="gpx_option_from_start_point">沿著整條軌跡往前</string>
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.*;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
|
||||
public class HelpActivity extends OsmandActionBarActivity {
|
||||
|
@ -27,7 +33,7 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
private static final int BACK = 2;
|
||||
private static final int FORWARD = 3;
|
||||
private static final int CLOSE = 4;
|
||||
private WebView wv;
|
||||
private WebView mWebView;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
|
@ -53,38 +59,48 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
}
|
||||
getSupportActionBar().setTitle(title);
|
||||
setContentView(R.layout.help_activity);
|
||||
wv = (WebView) findViewById(R.id.webView);
|
||||
wv.setFocusable(true);
|
||||
wv.setFocusableInTouchMode(true);
|
||||
wv.requestFocus(View.FOCUS_DOWN);
|
||||
wv.setOnTouchListener(new View.OnTouchListener() {
|
||||
mWebView = (WebView) findViewById(R.id.webView);
|
||||
mWebView.setFocusable(true);
|
||||
mWebView.setFocusableInTouchMode(true);
|
||||
mWebView.requestFocus(View.FOCUS_DOWN);
|
||||
mWebView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (!v.hasFocus()) {
|
||||
v.requestFocus();
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (!view.hasFocus()) {
|
||||
view.requestFocus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
wv.setWebViewClient(new WebViewClient() {
|
||||
|
||||
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
wv.requestFocus(View.FOCUS_DOWN);
|
||||
mWebView.requestFocus(View.FOCUS_DOWN);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadResource(WebView view, String url) {
|
||||
super.onLoadResource(view, url);
|
||||
}
|
||||
});
|
||||
wv.loadUrl(FILE_ANDROID_ASSET_HELP + url);
|
||||
if (savedInstanceState != null) {
|
||||
mWebView.restoreState(savedInstanceState);
|
||||
} else {
|
||||
mWebView.loadUrl(FILE_ANDROID_ASSET_HELP + url);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
mWebView.saveState(outState);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
public String readContent(String url) throws IOException {
|
||||
|
@ -133,16 +149,16 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
finish();
|
||||
return true;
|
||||
case HOME:
|
||||
wv.loadUrl(FILE_ANDROID_ASSET_HELP + "index.html");
|
||||
mWebView.loadUrl(FILE_ANDROID_ASSET_HELP + "index.html");
|
||||
return true;
|
||||
case BACK:
|
||||
if(wv.canGoBack()) {
|
||||
wv.goBack();
|
||||
if(mWebView.canGoBack()) {
|
||||
mWebView.goBack();
|
||||
}
|
||||
return true;
|
||||
case FORWARD:
|
||||
if(wv.canGoForward()) {
|
||||
wv.goForward();
|
||||
if(mWebView.canGoForward()) {
|
||||
mWebView.goForward();
|
||||
}
|
||||
return true;
|
||||
case CLOSE:
|
||||
|
|
|
@ -29,14 +29,13 @@ import android.widget.TableLayout;
|
|||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.MapRenderingTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.osm.edit.EntityInfo;
|
||||
import net.osmand.osm.edit.EntityParser;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.osm.edit.OSMSettings.OSMTagKey;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -62,7 +61,7 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
|
||||
public class EditingPOIDialogProvider implements DialogProvider {
|
||||
|
||||
|
||||
private final Activity activity;
|
||||
private final OsmEditingPlugin plugin;
|
||||
private OpenstreetmapUtil openstreetmapUtil;
|
||||
|
@ -86,7 +85,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public static final int DIALOG_PLUGIN = 600;
|
||||
private static final int DIALOG_CREATE_POI = DIALOG_PLUGIN + 0;
|
||||
private static final int DIALOG_EDIT_POI = DIALOG_PLUGIN + 1;
|
||||
protected static final int DIALOG_SUB_CATEGORIES = DIALOG_PLUGIN + 2;
|
||||
protected static final int DIALOG_SUB_CATEGORIES = DIALOG_PLUGIN + 2;
|
||||
protected static final int DIALOG_POI_TYPES = DIALOG_PLUGIN + 3;
|
||||
private static final int DIALOG_DELETE_POI = DIALOG_PLUGIN + 4;
|
||||
private static final int DIALOG_OPENING_HOURS = DIALOG_PLUGIN + 5;
|
||||
|
@ -99,12 +98,12 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
private MapPoiTypes poiTypes;
|
||||
private boolean isLocalEdit;
|
||||
private Map<String, PoiType> allTranslatedSubTypes;
|
||||
|
||||
|
||||
|
||||
public EditingPOIDialogProvider(MapActivity uiContext, OsmEditingPlugin plugin) {
|
||||
this.activity = uiContext;
|
||||
this.plugin = plugin;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void prepareProvider() {
|
||||
|
@ -121,10 +120,10 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
} else {
|
||||
isLocalEdit = false;
|
||||
this.openstreetmapUtil = new OpenstreetmapRemoteUtil(activity);
|
||||
this.openstreetmapUtilToLoad = openstreetmapUtil;
|
||||
this.openstreetmapUtilToLoad = openstreetmapUtil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showEditDialog(final Amenity editA){
|
||||
prepareProvider();
|
||||
new AsyncTask<Void, Void, Node>() {
|
||||
|
@ -133,7 +132,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
protected Node doInBackground(Void... params) {
|
||||
return openstreetmapUtilToLoad.loadNode(editA);
|
||||
}
|
||||
|
||||
|
||||
protected void onPostExecute(Node n) {
|
||||
if(n != null){
|
||||
showPOIDialog(DIALOG_EDIT_POI, n, editA);
|
||||
|
@ -141,43 +140,43 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
AccessibleToast.makeText(activity, activity.getString(R.string.poi_error_poi_not_found), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}.execute(new Void[0]);
|
||||
}
|
||||
|
||||
|
||||
public void showCreateDialog(double latitude, double longitude){
|
||||
prepareProvider();
|
||||
Node n = new Node(latitude, longitude, -1);
|
||||
showPOIDialog(DIALOG_CREATE_POI, n, null);
|
||||
}
|
||||
|
||||
private void showPOIDialog(int dialogID, Node n, Amenity a) {
|
||||
Amenity am;
|
||||
if(a == null) {
|
||||
am = new Amenity();
|
||||
am.setType(poiTypes.getOtherPoiCategory());
|
||||
am.setSubType("");
|
||||
am.setAdditionalInfo(OSMTagKey.OPENING_HOURS.getValue(), "");
|
||||
private void showPOIDialog(int dialogID, Node node, Amenity amenity) {
|
||||
Amenity localAmenity;
|
||||
if(amenity == null) {
|
||||
localAmenity = new Amenity();
|
||||
localAmenity.setType(poiTypes.getOtherPoiCategory());
|
||||
localAmenity.setSubType("");
|
||||
localAmenity.setAdditionalInfo(OSMTagKey.OPENING_HOURS.getValue(), "");
|
||||
} else {
|
||||
am = new Amenity();
|
||||
am.copyNames(a);
|
||||
am.setType(a.getType());
|
||||
am.setSubType(a.getSubType());
|
||||
am.setAdditionalInfo(a.getAdditionalInfo());
|
||||
localAmenity = new Amenity();
|
||||
localAmenity.copyNames(amenity);
|
||||
localAmenity.setType(amenity.getType());
|
||||
localAmenity.setSubType(amenity.getSubType());
|
||||
localAmenity.setAdditionalInfo(amenity.getAdditionalInfo());
|
||||
}
|
||||
// Amenity a = EntityParser.parseAmenity(n, n.getTags(), type, subType, MapRenderingTypes.getDefault());
|
||||
dialogBundle.putSerializable(KEY_AMENITY, a);
|
||||
dialogBundle.putSerializable(KEY_AMENITY_NODE, n);
|
||||
// Amenity amenity = EntityParser.parseAmenity(node, node.getTags(), type, subType, MapRenderingTypes.getDefault());
|
||||
dialogBundle.putSerializable(KEY_AMENITY, localAmenity);
|
||||
dialogBundle.putSerializable(KEY_AMENITY_NODE, node);
|
||||
createPOIDialog(dialogID, dialogBundle).show();
|
||||
}
|
||||
|
||||
|
||||
public void showDeleteDialog(final Amenity a){
|
||||
prepareProvider();
|
||||
new AsyncTask<Void, Void, Node>() {
|
||||
protected Node doInBackground(Void[] params) {
|
||||
return openstreetmapUtil.loadNode(a);
|
||||
};
|
||||
|
||||
|
||||
protected void onPostExecute(Node n) {
|
||||
if(n == null){
|
||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show();
|
||||
|
@ -189,13 +188,13 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
};
|
||||
}.execute(new Void[0]);
|
||||
}
|
||||
|
||||
|
||||
private void prepareDeleteDialog(Dialog dlg, Bundle args) {
|
||||
Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
dlg.setTitle(MessageFormat.format(this.activity.getResources().getString(R.string.poi_remove_confirm_template),
|
||||
dlg.setTitle(MessageFormat.format(this.activity.getResources().getString(R.string.poi_remove_confirm_template),
|
||||
OsmAndFormatter.getPoiStringWithoutType(a, settings.MAP_PREFERRED_LOCALE.get())));
|
||||
}
|
||||
|
||||
|
||||
private Dialog createDeleteDialog(final Bundle args) {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.poi_remove_title);
|
||||
|
@ -222,20 +221,20 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
String c = comment.getText().toString();
|
||||
commitNode(OsmPoint.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c,
|
||||
closeChangeset == null ? false : closeChangeset.isSelected(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
activity,R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if(activity instanceof MapActivity){
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
activity,R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if(activity instanceof MapActivity){
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
|
@ -260,28 +259,28 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
layout.setVisibility(View.GONE);
|
||||
updateType(a);
|
||||
}
|
||||
|
||||
|
||||
private void addTagValueRow(final Node n, final TableLayout layout, String tg, String vl) {
|
||||
final TableRow newTagRow = new TableRow(activity);
|
||||
TableRow.LayoutParams tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
newTagRow.setLayoutParams(tlp);
|
||||
final TableRow newTagRow = new TableRow(activity);
|
||||
TableRow.LayoutParams tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
newTagRow.setLayoutParams(tlp);
|
||||
|
||||
final AutoCompleteTextView tag = new AutoCompleteTextView(activity);
|
||||
final AutoCompleteTextView value = new AutoCompleteTextView(activity);
|
||||
final Button delete = new Button(activity);
|
||||
|
||||
tag.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
value.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
tag.setLayoutParams(tlp);
|
||||
if(tg != null) {
|
||||
tag.setText(tg);
|
||||
} else {
|
||||
tag.setHint("Tag");
|
||||
}
|
||||
final AutoCompleteTextView tag = new AutoCompleteTextView(activity);
|
||||
final AutoCompleteTextView value = new AutoCompleteTextView(activity);
|
||||
final Button delete = new Button(activity);
|
||||
|
||||
final Set<String> tagKeys = new TreeSet<String>();
|
||||
tag.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
value.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
tag.setLayoutParams(tlp);
|
||||
if(tg != null) {
|
||||
tag.setText(tg);
|
||||
} else {
|
||||
tag.setHint("Tag");
|
||||
}
|
||||
|
||||
final Set<String> tagKeys = new TreeSet<String>();
|
||||
for (OSMTagKey t : OSMTagKey.values()) {
|
||||
if ((t != OSMTagKey.NAME) && (t != OSMTagKey.OPENING_HOURS) && (t != OSMTagKey.PHONE)
|
||||
&& (t != OSMTagKey.WEBSITE)) {
|
||||
|
@ -289,9 +288,9 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
}
|
||||
ArrayAdapter<Object> adapter = new ArrayAdapter<Object>(activity, R.layout.list_textview, tagKeys.toArray());
|
||||
tag.setAdapter(adapter);
|
||||
tag.setThreshold(1);
|
||||
tag.setOnClickListener(new View.OnClickListener() {
|
||||
tag.setAdapter(adapter);
|
||||
tag.setThreshold(1);
|
||||
tag.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
|
@ -301,31 +300,31 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
tag.setText(tags[which]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
builder.create();
|
||||
builder.show();
|
||||
}
|
||||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.FILL_PARENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
value.setLayoutParams(tlp);
|
||||
if(vl != null) {
|
||||
value.setText(vl);
|
||||
} else {
|
||||
value.setHint("Value");
|
||||
}
|
||||
Set<String> subCategories = new LinkedHashSet<String>();
|
||||
// could be osm values
|
||||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.FILL_PARENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
value.setLayoutParams(tlp);
|
||||
if(vl != null) {
|
||||
value.setText(vl);
|
||||
} else {
|
||||
value.setHint("Value");
|
||||
}
|
||||
Set<String> subCategories = new LinkedHashSet<String>();
|
||||
// could be osm values
|
||||
// for (String s : poiTypes.getAllTranslatedNames().keySet()) {
|
||||
// if (!subCategories.contains(s)) {
|
||||
// subCategories.add(s);
|
||||
// }
|
||||
// } ;
|
||||
ArrayAdapter<Object> valueAdapter = new ArrayAdapter<Object>(activity, R.layout.list_textview, subCategories.toArray());
|
||||
value.setThreshold(1);
|
||||
value.setAdapter(valueAdapter);
|
||||
ArrayAdapter<Object> valueAdapter = new ArrayAdapter<Object>(activity, R.layout.list_textview, subCategories.toArray());
|
||||
value.setThreshold(1);
|
||||
value.setAdapter(valueAdapter);
|
||||
value.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
@ -343,26 +342,26 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
tlp.rightMargin = 5;
|
||||
delete.setLayoutParams(tlp);
|
||||
delete.setText("X");
|
||||
delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
layout.removeView(newTagRow);
|
||||
layout.invalidate();
|
||||
n.removeTag(tag.getText().toString());
|
||||
}
|
||||
});
|
||||
newTagRow.addView(tag);
|
||||
newTagRow.addView(value);
|
||||
newTagRow.addView(delete);
|
||||
layout.addView(newTagRow);
|
||||
layout.invalidate();
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
tlp.rightMargin = 5;
|
||||
delete.setLayoutParams(tlp);
|
||||
delete.setText("X");
|
||||
delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
layout.removeView(newTagRow);
|
||||
layout.invalidate();
|
||||
n.removeTag(tag.getText().toString());
|
||||
}
|
||||
});
|
||||
newTagRow.addView(tag);
|
||||
newTagRow.addView(value);
|
||||
newTagRow.addView(delete);
|
||||
layout.addView(newTagRow);
|
||||
layout.invalidate();
|
||||
}
|
||||
|
||||
|
||||
private Builder createPOIDialog(final int dialogID, Bundle args) {
|
||||
final View view = activity.getLayoutInflater().inflate(R.layout.editing_poi, null);
|
||||
final Builder dlg = new Builder(activity);
|
||||
|
@ -377,7 +376,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
|
||||
//dlg.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);;
|
||||
|
||||
|
||||
nameText = ((EditText)view.findViewById(R.id.Name));
|
||||
openingHours = ((EditText)view.findViewById(R.id.OpeningHours));
|
||||
typeText = ((AutoCompleteTextView)view.findViewById(R.id.Type));
|
||||
|
@ -405,64 +404,64 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
});
|
||||
linkToOsmDoc.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Node n = (Node) args.getSerializable(KEY_AMENITY_NODE);
|
||||
final Amenity amenity = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Node node = (Node) args.getSerializable(KEY_AMENITY_NODE);
|
||||
dlg.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
dlg.setPositiveButton(
|
||||
isLocalEdit ? R.string.shared_string_save :
|
||||
R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Resources resources = view.getResources();
|
||||
final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
|
||||
.getString(R.string.poi_action_change);
|
||||
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||
String subType = typeText.getText().toString().trim().toLowerCase();
|
||||
if (allTranslatedSubTypes.get(subType) != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(subType);
|
||||
n.putTag(pt.getOsmTag(), pt.getOsmValue());
|
||||
if (pt.getOsmTag2() != null) {
|
||||
n.putTag(pt.getOsmTag2(), pt.getOsmValue2());
|
||||
}
|
||||
} else {
|
||||
n.putTag(a.getType().getDefaultTag(), subType);
|
||||
}
|
||||
String name = nameText.getText().toString();
|
||||
if(name.length() > 0) {
|
||||
n.putTag(OSMTagKey.NAME.getValue(), name);
|
||||
}
|
||||
if (openingHours.getText().toString().length() == 0) {
|
||||
n.removeTag(OSMTagKey.OPENING_HOURS.getValue());
|
||||
} else {
|
||||
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
|
||||
}
|
||||
String website = websiteText.getText().toString();
|
||||
if (website.length() > 0 ){
|
||||
n.putTag(OSMTagKey.WEBSITE.getValue(),website);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.WEBSITE.getValue());
|
||||
}
|
||||
String phone = phoneText.getText().toString();
|
||||
if (phone.length() > 0 ){
|
||||
n.putTag(OSMTagKey.PHONE.getValue(),phone);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.PHONE.getValue());
|
||||
}
|
||||
String str = streetNameText.getText().toString();
|
||||
if (str .length() > 0 ){
|
||||
n.putTag(OSMTagKey.ADDR_STREET.getValue(),str);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.ADDR_STREET.getValue());
|
||||
}
|
||||
String hno = hnoText.getText().toString();
|
||||
if (hno .length() > 0 ){
|
||||
n.putTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue(),hno);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue());
|
||||
}
|
||||
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Resources resources = view.getResources();
|
||||
final String msg = node.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
|
||||
.getString(R.string.poi_action_change);
|
||||
OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||
String subType = typeText.getText().toString().trim().toLowerCase();
|
||||
if (allTranslatedSubTypes.get(subType) != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(subType);
|
||||
node.putTag(pt.getOsmTag(), pt.getOsmValue());
|
||||
if (pt.getOsmTag2() != null) {
|
||||
node.putTag(pt.getOsmTag2(), pt.getOsmValue2());
|
||||
}
|
||||
} else {
|
||||
node.putTag(amenity.getType().getDefaultTag(), subType);
|
||||
}
|
||||
String name = nameText.getText().toString();
|
||||
if(name.length() > 0) {
|
||||
node.putTag(OSMTagKey.NAME.getValue(), name);
|
||||
}
|
||||
if (openingHours.getText().toString().length() == 0) {
|
||||
node.removeTag(OSMTagKey.OPENING_HOURS.getValue());
|
||||
} else {
|
||||
node.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
|
||||
}
|
||||
String website = websiteText.getText().toString();
|
||||
if (website.length() > 0 ){
|
||||
node.putTag(OSMTagKey.WEBSITE.getValue(), website);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.WEBSITE.getValue());
|
||||
}
|
||||
String phone = phoneText.getText().toString();
|
||||
if (phone.length() > 0 ){
|
||||
node.putTag(OSMTagKey.PHONE.getValue(), phone);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.PHONE.getValue());
|
||||
}
|
||||
String str = streetNameText.getText().toString();
|
||||
if (str .length() > 0 ){
|
||||
node.putTag(OSMTagKey.ADDR_STREET.getValue(), str);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.ADDR_STREET.getValue());
|
||||
}
|
||||
String hno = hnoText.getText().toString();
|
||||
if (hno .length() > 0 ){
|
||||
node.putTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue(), hno);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue());
|
||||
}
|
||||
commitNode(action, node, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
|
@ -481,15 +480,15 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
activity.removeDialog(dialogID);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
preparePOIDialog(view, args);
|
||||
attachListeners(view, a, n);
|
||||
updateOsmTagValue(a);
|
||||
attachListeners(view, amenity, node);
|
||||
updateOsmTagValue(amenity);
|
||||
return dlg;
|
||||
}
|
||||
|
||||
|
||||
private void updateOsmTagValue(final Amenity a) {
|
||||
String subType = typeText.getText().toString().trim().toLowerCase();
|
||||
String s = "OSM ";
|
||||
|
@ -556,9 +555,9 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
activity.showDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final Button advancedModeButton = ((Button)dlg.findViewById(R.id.advancedMode));
|
||||
advancedModeButton.setOnClickListener(new View.OnClickListener() {
|
||||
advancedModeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final TableLayout layout = ((TableLayout) dlg.findViewById(R.id.advancedModeTable));
|
||||
|
@ -591,7 +590,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void showSubCategory(Amenity a) {
|
||||
|
@ -628,19 +627,19 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
subCategories.put(Algorithms.capitalizeFirstLetterAndLowercase(s.getKey()), s.getValue());
|
||||
}
|
||||
}
|
||||
ArrayAdapter<Object> adapter = new ArrayAdapter<Object>(activity, R.layout.list_textview,
|
||||
ArrayAdapter<Object> adapter = new ArrayAdapter<Object>(activity, R.layout.list_textview,
|
||||
subCategories.keySet().toArray());
|
||||
typeText.setAdapter(adapter);
|
||||
return subCategories;
|
||||
}
|
||||
|
||||
|
||||
private void updateType(Amenity a){
|
||||
typeText.setText(a.getSubType());
|
||||
typeButton.setText(a.getType().getTranslation());
|
||||
updateSubTypesAdapter(a.getType());
|
||||
updateOsmTagValue(a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Dialog createOpenHoursDlg(){
|
||||
OpeningHours time = OpeningHoursParser.parseOpenedHours(openingHours.getText().toString());
|
||||
|
@ -648,7 +647,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
AccessibleToast.makeText(activity, activity.getString(R.string.opening_hours_not_supported), Toast.LENGTH_LONG).show();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
List<BasicOpeningHourRule> simple = null;
|
||||
if(time != null){
|
||||
simple = new ArrayList<BasicOpeningHourRule>();
|
||||
|
@ -661,7 +660,7 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final OpeningHoursView v = new OpeningHoursView(activity);
|
||||
builder.setView(v.createOpeningHoursEditView(simple));
|
||||
|
@ -681,11 +680,11 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void commitNode(final OsmPoint.Action action, final Node n, final EntityInfo info, final String comment,
|
||||
final boolean closeChangeSet,
|
||||
final Runnable successAction) {
|
||||
final boolean closeChangeSet,
|
||||
final Runnable successAction) {
|
||||
if (info == null && OsmPoint.Action.CREATE != action) {
|
||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
|
@ -717,60 +716,60 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public Dialog onCreateDialog(int id) {
|
||||
Bundle args = dialogBundle;
|
||||
switch (id) {
|
||||
case DIALOG_DELETE_POI:
|
||||
return createDeleteDialog(args);
|
||||
case DIALOG_SUB_CATEGORIES: {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(a.getType(), true);
|
||||
final String[] subCats = allTranslatedNames.keySet().toArray(new String[0]);
|
||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiType poiType = allTranslatedNames.get(subCats[which]);
|
||||
typeText.setText(subCats[which]);
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_POI_TYPES: {
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final List<PoiCategory> categories = poiTypes.getCategories(false);
|
||||
String[] vals = new String[categories.size()];
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
vals[i] = categories.get(i).getTranslation();
|
||||
}
|
||||
builder.setItems(vals, new Dialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiCategory aType = categories.get(which);
|
||||
if (aType != a.getType()) {
|
||||
a.setType(aType);
|
||||
a.setSubType(""); //$NON-NLS-1$
|
||||
updateType(a);
|
||||
case DIALOG_DELETE_POI:
|
||||
return createDeleteDialog(args);
|
||||
case DIALOG_SUB_CATEGORIES: {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(a.getType(), true);
|
||||
final String[] subCats = allTranslatedNames.keySet().toArray(new String[0]);
|
||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiType poiType = allTranslatedNames.get(subCats[which]);
|
||||
typeText.setText(subCats[which]);
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_POI_TYPES: {
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final List<PoiCategory> categories = poiTypes.getCategories(false);
|
||||
String[] vals = new String[categories.size()];
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
vals[i] = categories.get(i).getTranslation();
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_OPENING_HOURS: {
|
||||
return createOpenHoursDlg();
|
||||
}
|
||||
builder.setItems(vals, new Dialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiCategory aType = categories.get(which);
|
||||
if (aType != a.getType()) {
|
||||
a.setType(aType);
|
||||
a.setSubType(""); //$NON-NLS-1$
|
||||
updateType(a);
|
||||
}
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_OPENING_HOURS: {
|
||||
return createOpenHoursDlg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -786,5 +785,4 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue