Added localization for working with OSB and POI
git-svn-id: https://osmand.googlecode.com/svn/trunk@175 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
68616c48c1
commit
12c977b0ba
8 changed files with 134 additions and 50 deletions
|
@ -5,7 +5,7 @@
|
||||||
android:layout_height="fill_parent" android:orientation="vertical">
|
android:layout_height="fill_parent" android:orientation="vertical">
|
||||||
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
|
<TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView android:text="Name" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
<TextView android:text="@string/poi_dialog_name" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
<EditText android:text="" android:id="@+id/Name" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
<EditText android:text="" android:id="@+id/Name" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
@ -14,18 +14,18 @@
|
||||||
<!-- <EditText android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"/> -->
|
<!-- <EditText android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"/> -->
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView android:text="Opening hours" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
<TextView android:text="@string/poi_dialog_opening_hours" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
<EditText android:text="" android:hint="Mo-Su 08:00-18:00" android:id="@+id/OpeningHours" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
<EditText android:text="" android:hint="Mo-Su 08:00-20:00" android:id="@+id/OpeningHours" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView android:text="Comment" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
<TextView android:text="@string/poi_dialog_comment" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
<EditText android:text="POI changing" android:id="@+id/Comment" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
<EditText android:text="@string/poi_dialog_comment_default" android:id="@+id/Comment" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
<TextView android:text="All other tags are preserved" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
<TextView android:text="@string/poi_dialog_other_tags_message" android:id="@+id/TextView" android:layout_marginLeft="5dp" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"
|
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"
|
||||||
android:gravity="bottom|center">
|
android:gravity="bottom|center">
|
||||||
<Button android:layout_width="125dp" android:layout_height="wrap_content" android:text="Commit" android:id="@+id/Commit"></Button>
|
<Button android:layout_width="125dp" android:layout_height="wrap_content" android:text="@string/default_buttons_commit" android:id="@+id/Commit"></Button>
|
||||||
<Button android:layout_width="125dp" android:layout_height="wrap_content" android:text="Cancel" android:id="@+id/Cancel"></Button>
|
<Button android:layout_width="125dp" android:layout_height="wrap_content" android:text="@string/default_buttons_cancel" android:id="@+id/Cancel"></Button>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView android:id="@+id/TextView" android:layout_marginLeft="5dp"
|
<TextView android:id="@+id/TextView" android:layout_marginLeft="5dp"
|
||||||
android:layout_height="wrap_content" android:text="Message"></TextView>
|
android:layout_height="wrap_content" android:text="@string/osb_comment_dialog_message"></TextView>
|
||||||
<EditText android:text="" android:id="@+id/BugMessage" android:layout_marginLeft="5dp" android:layout_marginRight="5dp"
|
<EditText android:text="" android:id="@+id/BugMessage" android:layout_marginLeft="5dp" android:layout_marginRight="5dp"
|
||||||
android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView android:text="Author name" android:id="@+id/TextView" android:layout_marginLeft="5dp"
|
<TextView android:id="@+id/TextView" android:layout_marginLeft="5dp"
|
||||||
android:layout_height="wrap_content"></TextView>
|
android:layout_height="wrap_content" android:text="@string/osb_comment_dialog_author"></TextView>
|
||||||
<EditText android:text="NoName" android:id="@+id/AuthorName" android:layout_marginLeft="5dp" android:layout_marginRight="5dp"
|
<EditText android:id="@+id/AuthorName" android:layout_marginLeft="5dp" android:layout_marginRight="5dp"
|
||||||
android:layout_height="wrap_content" android:layout_weight="1"></EditText>
|
android:layout_height="wrap_content" android:layout_weight="1" android:text="NoName"></EditText>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginTop="3dp" android:layout_marginRight="3dp">
|
<LinearLayout android:id="@+id/LinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginTop="3dp" android:layout_marginRight="3dp">
|
||||||
<EditText android:text="" android:id="@+id/SearchText" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="text|textFilter|textPhonetic"></EditText>
|
<EditText android:text="" android:id="@+id/SearchText" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="text|textFilter|textPhonetic"></EditText>
|
||||||
<Button android:text="Reset" android:id="@+id/ResetButton" android:layout_width="wrap_content" android:layout_height="wrap_content"
|
<Button android:id="@+id/ResetButton" android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
android:layout_weight="0"></Button>
|
android:layout_weight="0" android:text="@string/default_buttons_reset"></Button>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,12 @@
|
||||||
<string name="search_activity">Поиск</string>
|
<string name="search_activity">Поиск</string>
|
||||||
<color name="color_white">#FFFFFF</color>
|
<color name="color_white">#FFFFFF</color>
|
||||||
<color name="color_red">#FF0000</color>
|
<color name="color_red">#FF0000</color>
|
||||||
<string name="searchpoi_activity">Choose poi</string>
|
<string name="searchpoi_activity">Выберите poi</string>
|
||||||
<string name="search_POI_level_btn">Find more</string>
|
<string name="search_POI_level_btn">Найти еще</string>
|
||||||
<string name="incremental_search_city">Search city incrementally. In order to find villages input more than 3 first symbols.</string>
|
<string name="incremental_search_city">Выберите город. Чтобы найти дереавню введите как минимум 3 первых буквы.</string>
|
||||||
<string name="incremental_search_street">Search street incrementally</string>
|
<string name="incremental_search_street">Выберите улицу</string>
|
||||||
<string name="incremental_search_building">Search building incrementally</string>
|
<string name="incremental_search_building">Выберите здание</string>
|
||||||
<string name="choose_available_region">Choose region</string>
|
<string name="choose_available_region">Выберите регион</string>
|
||||||
<string name="choose_intersected_street">Выберите пересечение улиц</string>
|
<string name="choose_intersected_street">Выберите пересечение улиц</string>
|
||||||
<string name="Closest_Amenities">Closest amenities</string>
|
<string name="Closest_Amenities">Closest amenities</string>
|
||||||
<string name="app_mode_default">По умолчанию</string>
|
<string name="app_mode_default">По умолчанию</string>
|
||||||
|
@ -135,4 +135,40 @@
|
||||||
<string name="osb_add_dialog_title">Введите текст для Open Street Bug</string>
|
<string name="osb_add_dialog_title">Введите текст для Open Street Bug</string>
|
||||||
<string name="osb_add_dialog_success">Open Streen Bug был успешно создан</string>
|
<string name="osb_add_dialog_success">Open Streen Bug был успешно создан</string>
|
||||||
<string name="osb_add_dialog_error">Произошла ошибка. Open Street Bug не был создан.</string>
|
<string name="osb_add_dialog_error">Произошла ошибка. Open Street Bug не был создан.</string>
|
||||||
|
<string name="osb_comment_dialog_title">Добавление коментария к Open Street Bug</string>
|
||||||
|
<string name="osb_comment_dialog_add_button">Добавить</string>
|
||||||
|
<string name="osb_comment_dialog_success">Коментарий был успешно добавлен</string>
|
||||||
|
<string name="osb_comment_dialog_error">При добавлении коментария произошла ошибка. Коментарий не добавлен.</string>
|
||||||
|
<string name="osb_close_dialog_title">Закрыть Open Street Bug?</string>
|
||||||
|
<string name="osb_close_dialog_close_button">Закрыть</string>
|
||||||
|
<string name="osb_close_dialog_success">Open Street Bug был успешно закрыт.</string>
|
||||||
|
<string name="osb_close_dialog_error">При закрытии Open Street Bug произошла ошибка. Open Street Bug не был закрыт.</string>
|
||||||
|
<string name="osb_comment_menu_item">Добавить коментарий</string>
|
||||||
|
<string name="osb_close_menu_item">Закрыть Open Street Bug</string>
|
||||||
|
<string name="osb_comment_dialog_message">Комментарий</string>
|
||||||
|
<string name="osb_comment_dialog_author">Автор</string>
|
||||||
|
<string name="poi_edit_title">Редактирование POI</string>
|
||||||
|
<string name="poi_create_title">Добавление POI</string>
|
||||||
|
<string name="poi_error_poi_not_found">POI не найден</string>
|
||||||
|
<string name="poi_remove_confirm_template">Вы действительно хотите удалить {0}?</string>
|
||||||
|
<string name="poi_remove_title">Удаление POI</string>
|
||||||
|
<string name="default_buttons_delete">Удалить</string>
|
||||||
|
<string name="poi_remove_success">POI был успешно удален.</string>
|
||||||
|
<string name="poi_action_add">Дабавить</string>
|
||||||
|
<string name="poi_action_change">Изменить</string>
|
||||||
|
<string name="poi_action_succeded_template">Действие {0} успешно завершено.</string>
|
||||||
|
<string name="poi_error_unexpected_template">Неожиданная ошибка произошла при выполнении действия {0}.</string>
|
||||||
|
<string name="poi_error_io_error_template">Ошибка ввода/вывода произошла при выполнении действия {0}.</string>
|
||||||
|
<string name="poi_error_io_error">Произошла ошибка ввода/вывода.</string>
|
||||||
|
<string name="poi_error_info_not_loaded">Произошла ошибка при загрузке информации о POI</string>
|
||||||
|
|
||||||
|
<string name="poi_dialog_name">Имя</string>
|
||||||
|
<string name="poi_dialog_opening_hours">Время работы</string>
|
||||||
|
<string name="poi_dialog_comment">Комментарий</string>
|
||||||
|
<string name="poi_dialog_comment_default">Изменение POI</string>
|
||||||
|
<string name="poi_dialog_other_tags_message">Значения остальных тэгов POI не могут быть изменены.</string>
|
||||||
|
<string name="poi_context_menu_modify">Редактировать</string>
|
||||||
|
<string name="poi_context_menu_delete">Удалить</string>
|
||||||
|
<string name="default_buttons_commit">Сохранить</string>
|
||||||
|
<string name="default_buttons_reset">Сброс</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -139,4 +139,40 @@
|
||||||
<string name="osb_add_dialog_title">Input text of bug</string>
|
<string name="osb_add_dialog_title">Input text of bug</string>
|
||||||
<string name="osb_add_dialog_success">Bug was successfully created</string>
|
<string name="osb_add_dialog_success">Bug was successfully created</string>
|
||||||
<string name="osb_add_dialog_error">Exception occured : bug was not created</string>
|
<string name="osb_add_dialog_error">Exception occured : bug was not created</string>
|
||||||
|
<string name="osb_comment_dialog_title">Adding comment to bug</string>
|
||||||
|
<string name="osb_comment_dialog_add_button">Add comment</string>
|
||||||
|
<string name="osb_comment_dialog_success">Comment was successfully added</string>
|
||||||
|
<string name="osb_comment_dialog_error">Exception occured : comment was not added</string>
|
||||||
|
<string name="osb_close_dialog_title">Closing bug</string>
|
||||||
|
<string name="osb_close_dialog_close_button">Close bug</string>
|
||||||
|
<string name="osb_close_dialog_success">Bug was successfully added</string>
|
||||||
|
<string name="osb_close_dialog_error">Exception occured : bug was not closed</string>
|
||||||
|
<string name="osb_comment_menu_item">Add comment</string>
|
||||||
|
<string name="osb_close_menu_item">Close bug</string>
|
||||||
|
<string name="osb_comment_dialog_message">Message</string>
|
||||||
|
<string name="osb_comment_dialog_author">Author name</string>
|
||||||
|
<string name="poi_edit_title">Edit POI</string>
|
||||||
|
<string name="poi_create_title">Create POI</string>
|
||||||
|
<string name="poi_error_poi_not_found">POI hasn't found</string>
|
||||||
|
<string name="poi_remove_confirm_template">Are you sure to delete {0} (enter comment) ?</string>
|
||||||
|
<string name="poi_remove_title">Delete POI</string>
|
||||||
|
<string name="default_buttons_delete">Delete</string>
|
||||||
|
<string name="poi_remove_success">POI was successfully deleted</string>
|
||||||
|
<string name="poi_action_add">Add</string>
|
||||||
|
<string name="poi_action_change">Change</string>
|
||||||
|
<string name="poi_action_succeded_template">Action {0} completed successfully.</string>
|
||||||
|
<string name="poi_error_unexpected_template">Unexpected error occured while preforming action {0}.</string>
|
||||||
|
<string name="poi_error_io_error_template">Input/output error occured while preforming action {0}.</string>
|
||||||
|
<string name="poi_error_io_error">Input/output error occured.</string>
|
||||||
|
<string name="poi_error_info_not_loaded">Info about node was not loaded</string>
|
||||||
|
|
||||||
|
<string name="poi_dialog_name">Name</string>
|
||||||
|
<string name="poi_dialog_opening_hours">Opening hours</string>
|
||||||
|
<string name="poi_dialog_comment">Comment</string>
|
||||||
|
<string name="poi_dialog_comment_default">POI changing</string>
|
||||||
|
<string name="poi_dialog_other_tags_message">All other tags are preserved</string>
|
||||||
|
<string name="poi_context_menu_modify">Modify</string>
|
||||||
|
<string name="poi_context_menu_delete">Delete</string>
|
||||||
|
<string name="default_buttons_commit">Commit</string>
|
||||||
|
<string name="default_buttons_reset">Reset</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.io.StringWriter;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -35,6 +36,7 @@ import android.app.Dialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
@ -94,7 +96,7 @@ public class EditingPOIActivity {
|
||||||
Node n = loadNode(id);
|
Node n = loadNode(id);
|
||||||
if(n != null){
|
if(n != null){
|
||||||
dlg = new Dialog(ctx);
|
dlg = new Dialog(ctx);
|
||||||
dlg.setTitle("Edit POI");
|
dlg.setTitle(R.string.poi_edit_title);
|
||||||
showDialog(n);
|
showDialog(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,29 +106,29 @@ public class EditingPOIActivity {
|
||||||
Node n = new Node(latitude, longitude, -1);
|
Node n = new Node(latitude, longitude, -1);
|
||||||
n.putTag(OSMTagKey.AMENITY.getValue(), "");
|
n.putTag(OSMTagKey.AMENITY.getValue(), "");
|
||||||
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00");
|
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);
|
showDialog(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDeleteDialog(long id){
|
public void showDeleteDialog(long id){
|
||||||
final Node n = loadNode(id);
|
final Node n = loadNode(id);
|
||||||
if(n == null){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Builder builder = new AlertDialog.Builder(ctx);
|
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);
|
final EditText comment = new EditText(ctx);
|
||||||
comment.setText("Delete POI");
|
comment.setText(R.string.poi_remove_title);
|
||||||
builder.setView(comment);
|
builder.setView(comment);
|
||||||
builder.setNegativeButton("Cancel", null);
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
builder.setPositiveButton("Delete", new DialogInterface.OnClickListener(){
|
builder.setPositiveButton(R.string.default_buttons_delete, new DialogInterface.OnClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
String c = comment.getText().toString();
|
String c = comment.getText().toString();
|
||||||
if(commitNode(DELETE_ACTION, n, entityInfo, c)){ // NON-NLS
|
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){
|
if(view != null){
|
||||||
view.refreshMap();
|
view.refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -183,7 +185,8 @@ public class EditingPOIActivity {
|
||||||
((Button)dlg.findViewById(R.id.Commit)).setOnClickListener(new View.OnClickListener(){
|
((Button)dlg.findViewById(R.id.Commit)).setOnClickListener(new View.OnClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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;
|
String action = n.getId() == -1 ? CREATE_ACTION: MODIFY_ACTION;
|
||||||
n.putTag(a.convertToAmenityTag(), typeText.getText().toString());
|
n.putTag(a.convertToAmenityTag(), typeText.getText().toString());
|
||||||
n.putTag(OSMTagKey.NAME.getValue(), nameText.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());
|
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
|
||||||
}
|
}
|
||||||
if (commitNode(action, n, entityInfo, commentText.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){
|
if(view != null){
|
||||||
view.refreshMap();
|
view.refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -286,10 +289,10 @@ public class EditingPOIActivity {
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
log.error(userOperation + " failed", 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) {
|
} catch (IOException e) {
|
||||||
log.error(userOperation + " failed", 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;
|
return null;
|
||||||
|
|
||||||
|
@ -354,10 +357,10 @@ public class EditingPOIActivity {
|
||||||
Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
|
Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
log.error(userOperation + " failed" , 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) {
|
} catch (IOException e) {
|
||||||
log.error(userOperation + " failed" , 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;
|
return null;
|
||||||
|
@ -450,7 +453,7 @@ public class EditingPOIActivity {
|
||||||
|
|
||||||
public boolean commitNode(String action, Node n, EntityInfo info, String comment){
|
public boolean commitNode(String action, Node n, EntityInfo info, String comment){
|
||||||
if(info == null && !CREATE_ACTION.equals(action)){
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,10 +524,10 @@ public class EditingPOIActivity {
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Loading node failed" + id, 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) {
|
} catch (SAXException e) {
|
||||||
log.error("Loading node failed" + id, 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
@ -199,7 +200,11 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
int y = view.getRotatedMapYForPoint(n.getLatitude(), n.getLongitude());
|
int y = view.getRotatedMapYForPoint(n.getLatitude(), n.getLongitude());
|
||||||
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
|
if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) {
|
||||||
Builder builder = new AlertDialog.Builder(view.getContext());
|
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
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if(which == 0){
|
if(which == 0){
|
||||||
|
@ -369,12 +374,12 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
|
|
||||||
public void commentBug(final Context ctx, LayoutInflater layoutInflater, final OpenStreetBug bug){
|
public void commentBug(final Context ctx, LayoutInflater layoutInflater, final OpenStreetBug bug){
|
||||||
Builder builder = new AlertDialog.Builder(ctx);
|
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);
|
final View view = layoutInflater.inflate(R.layout.open_bug, null);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserName(ctx));
|
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserName(ctx));
|
||||||
builder.setNegativeButton("Cancel", null);
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
builder.setPositiveButton("Add comment", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
|
String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
|
||||||
|
@ -382,13 +387,13 @@ public class OsmBugsLayer implements OsmandMapLayer {
|
||||||
OsmandSettings.setUserName(ctx, author);
|
OsmandSettings.setUserName(ctx, author);
|
||||||
boolean added = addingComment(bug.getId(), text, author);
|
boolean added = addingComment(bug.getId(), text, author);
|
||||||
if (added) {
|
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();
|
clearCache();
|
||||||
if (OsmBugsLayer.this.view.getLayers().contains(OsmBugsLayer.this)) {
|
if (OsmBugsLayer.this.view.getLayers().contains(OsmBugsLayer.this)) {
|
||||||
OsmBugsLayer.this.view.refreshMap();
|
OsmBugsLayer.this.view.refreshMap();
|
||||||
}
|
}
|
||||||
} else {
|
} 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){
|
public void closeBug(final Context ctx, LayoutInflater layoutInflater, final OpenStreetBug bug){
|
||||||
Builder builder = new AlertDialog.Builder(ctx);
|
Builder builder = new AlertDialog.Builder(ctx);
|
||||||
builder.setTitle("Closing bug");
|
builder.setTitle(R.string.osb_close_dialog_title);
|
||||||
builder.setNegativeButton("Cancel", null);
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
builder.setPositiveButton("Close bug", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.osb_close_dialog_close_button, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
boolean closed = closingBug(bug.getId());
|
boolean closed = closingBug(bug.getId());
|
||||||
if (closed) {
|
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();
|
clearCache();
|
||||||
if (OsmBugsLayer.this.view.getLayers().contains(OsmBugsLayer.this)) {
|
if (OsmBugsLayer.this.view.getLayers().contains(OsmBugsLayer.this)) {
|
||||||
OsmBugsLayer.this.view.refreshMap();
|
OsmBugsLayer.this.view.refreshMap();
|
||||||
}
|
}
|
||||||
} else {
|
} 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.osmand.OsmandSettings;
|
import com.osmand.OsmandSettings;
|
||||||
import com.osmand.PoiFilter;
|
import com.osmand.PoiFilter;
|
||||||
|
import com.osmand.R;
|
||||||
import com.osmand.ResourceManager;
|
import com.osmand.ResourceManager;
|
||||||
import com.osmand.activities.EditingPOIActivity;
|
import com.osmand.activities.EditingPOIActivity;
|
||||||
import com.osmand.data.Amenity;
|
import com.osmand.data.Amenity;
|
||||||
|
@ -42,7 +43,10 @@ public class POIMapLayer implements OsmandMapLayer {
|
||||||
Context ctx = view.getContext();
|
Context ctx = view.getContext();
|
||||||
Builder builder = new AlertDialog.Builder(ctx);
|
Builder builder = new AlertDialog.Builder(ctx);
|
||||||
final EditingPOIActivity edit = new EditingPOIActivity(ctx, view);
|
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
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
Loading…
Reference in a new issue