diff --git a/OsmAnd/res/layout/editing_poi.xml b/OsmAnd/res/layout/editing_poi.xml index d95dad3376..b33c83ff7c 100644 --- a/OsmAnd/res/layout/editing_poi.xml +++ b/OsmAnd/res/layout/editing_poi.xml @@ -5,7 +5,7 @@ android:layout_height="fill_parent" android:orientation="vertical"> - + @@ -14,18 +14,18 @@ - - + + - - + + - + - - + + diff --git a/OsmAnd/res/layout/open_bug.xml b/OsmAnd/res/layout/open_bug.xml index 4d2c7bda61..345e81b226 100644 --- a/OsmAnd/res/layout/open_bug.xml +++ b/OsmAnd/res/layout/open_bug.xml @@ -5,15 +5,15 @@ android:layout_height="fill_parent"> + android:layout_height="wrap_content" android:text="@string/osb_comment_dialog_message"> - - + + diff --git a/OsmAnd/res/layout/search_by_name.xml b/OsmAnd/res/layout/search_by_name.xml index fac952d58e..5822328e89 100644 --- a/OsmAnd/res/layout/search_by_name.xml +++ b/OsmAnd/res/layout/search_by_name.xml @@ -7,8 +7,8 @@ - + diff --git a/OsmAnd/res/values-ru-rRU/strings.xml b/OsmAnd/res/values-ru-rRU/strings.xml index 2a5e126966..2c3548f451 100644 --- a/OsmAnd/res/values-ru-rRU/strings.xml +++ b/OsmAnd/res/values-ru-rRU/strings.xml @@ -73,12 +73,12 @@ Поиск #FFFFFF #FF0000 -Choose poi -Find more -Search city incrementally. In order to find villages input more than 3 first symbols. -Search street incrementally -Search building incrementally -Choose region +Выберите poi +Найти еще +Выберите город. Чтобы найти дереавню введите как минимум 3 первых буквы. +Выберите улицу +Выберите здание +Выберите регион Выберите пересечение улиц Closest amenities По умолчанию @@ -135,4 +135,40 @@ Введите текст для Open Street Bug Open Streen Bug был успешно создан Произошла ошибка. Open Street Bug не был создан. +Добавление коментария к Open Street Bug +Добавить +Коментарий был успешно добавлен +При добавлении коментария произошла ошибка. Коментарий не добавлен. +Закрыть Open Street Bug? +Закрыть +Open Street Bug был успешно закрыт. +При закрытии Open Street Bug произошла ошибка. Open Street Bug не был закрыт. +Добавить коментарий +Закрыть Open Street Bug +Комментарий +Автор +Редактирование POI +Добавление POI +POI не найден +Вы действительно хотите удалить {0}? +Удаление POI +Удалить +POI был успешно удален. +Дабавить +Изменить +Действие {0} успешно завершено. +Неожиданная ошибка произошла при выполнении действия {0}. +Ошибка ввода/вывода произошла при выполнении действия {0}. +Произошла ошибка ввода/вывода. +Произошла ошибка при загрузке информации о POI + +Имя +Время работы +Комментарий +Изменение POI +Значения остальных тэгов POI не могут быть изменены. +Редактировать +Удалить +Сохранить +Сброс diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 4bcc6b6b80..70b2d49530 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -139,4 +139,40 @@ Input text of bug Bug was successfully created Exception occured : bug was not created +Adding comment to bug +Add comment +Comment was successfully added +Exception occured : comment was not added +Closing bug +Close bug +Bug was successfully added +Exception occured : bug was not closed +Add comment +Close bug +Message +Author name +Edit POI +Create POI +POI hasn't found +Are you sure to delete {0} (enter comment) ? +Delete POI +Delete +POI was successfully deleted +Add +Change +Action {0} completed successfully. +Unexpected error occured while preforming action {0}. +Input/output error occured while preforming action {0}. +Input/output error occured. +Info about node was not loaded + +Name +Opening hours +Comment +POI changing +All other tags are preserved +Modify +Delete +Commit +Reset diff --git a/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java b/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java index 08c0dddc0c..933a6358fe 100644 --- a/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java @@ -12,6 +12,7 @@ import java.io.StringWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.text.MessageFormat; import java.util.List; import org.apache.commons.logging.Log; @@ -35,6 +36,7 @@ import android.app.Dialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; +import android.content.res.Resources; import android.util.Xml; import android.view.View; import android.widget.ArrayAdapter; @@ -94,7 +96,7 @@ public class EditingPOIActivity { Node n = loadNode(id); if(n != null){ dlg = new Dialog(ctx); - dlg.setTitle("Edit POI"); + dlg.setTitle(R.string.poi_edit_title); showDialog(n); } } @@ -104,29 +106,29 @@ public class EditingPOIActivity { Node n = new Node(latitude, longitude, -1); n.putTag(OSMTagKey.AMENITY.getValue(), ""); n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00"); - dlg.setTitle("Create POI"); + dlg.setTitle(R.string.poi_create_title); showDialog(n); } public void showDeleteDialog(long id){ final Node n = loadNode(id); if(n == null){ - Toast.makeText(ctx, "POI doesn't found", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_poi_not_found), Toast.LENGTH_LONG).show(); return; } Builder builder = new AlertDialog.Builder(ctx); - builder.setTitle("Are you sure to delete " + n.getTag(OSMTagKey.NAME)+" (enter comment) ?"); + builder.setTitle(MessageFormat.format(this.view.getResources().getString(R.string.poi_remove_confirm_template), n.getTag(OSMTagKey.NAME))); final EditText comment = new EditText(ctx); - comment.setText("Delete POI"); + comment.setText(R.string.poi_remove_title); builder.setView(comment); - builder.setNegativeButton("Cancel", null); - builder.setPositiveButton("Delete", new DialogInterface.OnClickListener(){ + builder.setNegativeButton(R.string.default_buttons_cancel, null); + builder.setPositiveButton(R.string.default_buttons_delete, new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { String c = comment.getText().toString(); if(commitNode(DELETE_ACTION, n, entityInfo, c)){ // NON-NLS - Toast.makeText(ctx, "POI was successfully deleted", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_remove_success), Toast.LENGTH_LONG).show(); if(view != null){ view.refreshMap(); } @@ -183,7 +185,8 @@ public class EditingPOIActivity { ((Button)dlg.findViewById(R.id.Commit)).setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { - String msg = n.getId() == -1 ? "added" : "changed"; + Resources resources = v.getResources(); + String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources.getString(R.string.poi_action_change); String action = n.getId() == -1 ? CREATE_ACTION: MODIFY_ACTION; n.putTag(a.convertToAmenityTag(), typeText.getText().toString()); n.putTag(OSMTagKey.NAME.getValue(), nameText.getText().toString()); @@ -193,7 +196,7 @@ public class EditingPOIActivity { n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString()); } if (commitNode(action, n, entityInfo, commentText.getText().toString())) { - Toast.makeText(ctx, "POI was successfully " + msg, Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_action_succeded_template), msg), Toast.LENGTH_LONG).show(); if(view != null){ view.refreshMap(); } @@ -286,10 +289,10 @@ public class EditingPOIActivity { } } catch (MalformedURLException e) { log.error(userOperation + " failed", e); - Toast.makeText(ctx, "Unexpected exception while " + userOperation + " ocurred", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show(); } catch (IOException e) { log.error(userOperation + " failed", e); - Toast.makeText(ctx, "Input/output exception while " + userOperation + " ocurred", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_io_error_template), userOperation), Toast.LENGTH_LONG).show(); } return null; @@ -354,10 +357,10 @@ public class EditingPOIActivity { Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show(); } catch (MalformedURLException e) { log.error(userOperation + " failed" , e); - Toast.makeText(ctx, "Unexpected exception while "+ userOperation+" ocurred", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show(); } catch (IOException e) { log.error(userOperation + " failed" , e); - Toast.makeText(ctx, "Input/output exception while "+ userOperation+" ocurred", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_io_error_template), userOperation), Toast.LENGTH_LONG).show(); } return null; @@ -450,7 +453,7 @@ public class EditingPOIActivity { public boolean commitNode(String action, Node n, EntityInfo info, String comment){ if(info == null && !CREATE_ACTION.equals(action)){ - Toast.makeText(ctx, "Info about node was not loaded", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show(); return false; } @@ -521,10 +524,10 @@ public class EditingPOIActivity { } catch (IOException e) { log.error("Loading node failed" + id, e); - Toast.makeText(ctx, "Input/output exception ocurred", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show(); } catch (SAXException e) { log.error("Loading node failed" + id, e); - Toast.makeText(ctx, "Input/output exception ocurred", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show(); } return null; } diff --git a/OsmAnd/src/com/osmand/views/OsmBugsLayer.java b/OsmAnd/src/com/osmand/views/OsmBugsLayer.java index d6d8889482..5c8815ed33 100644 --- a/OsmAnd/src/com/osmand/views/OsmBugsLayer.java +++ b/OsmAnd/src/com/osmand/views/OsmBugsLayer.java @@ -21,6 +21,7 @@ import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; +import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -199,7 +200,11 @@ public class OsmBugsLayer implements OsmandMapLayer { int y = view.getRotatedMapYForPoint(n.getLatitude(), n.getLongitude()); if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { Builder builder = new AlertDialog.Builder(view.getContext()); - builder.setItems(new String[]{"Add comment", "Close bug"}, new DialogInterface.OnClickListener(){ + Resources resources = view.getContext().getResources(); + builder.setItems(new String[]{ + resources.getString(R.string.osb_comment_menu_item), + resources.getString(R.string.osb_close_menu_item) + }, new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { if(which == 0){ @@ -369,12 +374,12 @@ public class OsmBugsLayer implements OsmandMapLayer { public void commentBug(final Context ctx, LayoutInflater layoutInflater, final OpenStreetBug bug){ Builder builder = new AlertDialog.Builder(ctx); - builder.setTitle("Adding comment to bug"); + builder.setTitle(R.string.osb_comment_dialog_title); final View view = layoutInflater.inflate(R.layout.open_bug, null); builder.setView(view); ((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserName(ctx)); - builder.setNegativeButton("Cancel", null); - builder.setPositiveButton("Add comment", new DialogInterface.OnClickListener() { + builder.setNegativeButton(R.string.default_buttons_cancel, null); + builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString(); @@ -382,13 +387,13 @@ public class OsmBugsLayer implements OsmandMapLayer { OsmandSettings.setUserName(ctx, author); boolean added = addingComment(bug.getId(), text, author); if (added) { - Toast.makeText(ctx, "Comment was successfully added", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.osb_comment_dialog_success), Toast.LENGTH_LONG).show(); clearCache(); if (OsmBugsLayer.this.view.getLayers().contains(OsmBugsLayer.this)) { OsmBugsLayer.this.view.refreshMap(); } } else { - Toast.makeText(ctx, "Exception occured : comment was not added", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.osb_comment_dialog_error), Toast.LENGTH_LONG).show(); } } }); @@ -397,20 +402,20 @@ public class OsmBugsLayer implements OsmandMapLayer { public void closeBug(final Context ctx, LayoutInflater layoutInflater, final OpenStreetBug bug){ Builder builder = new AlertDialog.Builder(ctx); - builder.setTitle("Closing bug"); - builder.setNegativeButton("Cancel", null); - builder.setPositiveButton("Close bug", new DialogInterface.OnClickListener() { + builder.setTitle(R.string.osb_close_dialog_title); + builder.setNegativeButton(R.string.default_buttons_cancel, null); + builder.setPositiveButton(R.string.osb_close_dialog_close_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { boolean closed = closingBug(bug.getId()); if (closed) { - Toast.makeText(ctx, "Bug was successfully added", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.osb_close_dialog_success), Toast.LENGTH_LONG).show(); clearCache(); if (OsmBugsLayer.this.view.getLayers().contains(OsmBugsLayer.this)) { OsmBugsLayer.this.view.refreshMap(); } } else { - Toast.makeText(ctx, "Exception occured : bug was not closed", Toast.LENGTH_LONG).show(); + Toast.makeText(ctx, ctx.getResources().getString(R.string.osb_close_dialog_error), Toast.LENGTH_LONG).show(); } } }); diff --git a/OsmAnd/src/com/osmand/views/POIMapLayer.java b/OsmAnd/src/com/osmand/views/POIMapLayer.java index 5d0c22a615..6fac7152cb 100644 --- a/OsmAnd/src/com/osmand/views/POIMapLayer.java +++ b/OsmAnd/src/com/osmand/views/POIMapLayer.java @@ -17,6 +17,7 @@ import android.widget.Toast; import com.osmand.OsmandSettings; import com.osmand.PoiFilter; +import com.osmand.R; import com.osmand.ResourceManager; import com.osmand.activities.EditingPOIActivity; import com.osmand.data.Amenity; @@ -42,7 +43,10 @@ public class POIMapLayer implements OsmandMapLayer { Context ctx = view.getContext(); Builder builder = new AlertDialog.Builder(ctx); final EditingPOIActivity edit = new EditingPOIActivity(ctx, view); - builder.setItems(new String[]{"Modify", "Delete"}, new DialogInterface.OnClickListener(){ + builder.setItems(new String[]{ + this.view.getResources().getString(R.string.poi_context_menu_modify), + this.view.getResources().getString(R.string.poi_context_menu_delete) + }, new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) {