diff --git a/OsmAnd/res/layout/open_bug.xml b/OsmAnd/res/layout/open_bug.xml
index b692622856..f492ffdf05 100644
--- a/OsmAnd/res/layout/open_bug.xml
+++ b/OsmAnd/res/layout/open_bug.xml
@@ -15,6 +15,12 @@
+
+
+
+
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 4c4ff26d1c..fc66e48b84 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ Please specify OSM user and password in Settings
Clear intermediate points
Keep intermediate points
You already have intermediate points set.
@@ -1479,6 +1480,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
Enter bug text
Bug successfully created
Exception occured: bug was not created
+ OSM password (optional)
Add comment
Message
Author name
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java
index 6bec2116b8..82757792cc 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java
@@ -375,16 +375,14 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
builder.setTitle(R.string.osb_add_dialog_title);
builder.setView(openBug);
builder.setNegativeButton(R.string.default_buttons_cancel, null);
+ ((EditText)view.findViewById(R.id.Password)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
+ ((EditText)view.findViewById(R.id.AuthorName)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_NAME.get());
builder.setPositiveButton(R.string.default_buttons_add, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final double latitude = args.getDouble(KEY_LATITUDE);
final double longitude = args.getDouble(KEY_LONGITUDE);
-
- final String text = ((EditText)openBug.findViewById(R.id.BugMessage)).getText().toString();
- final String author = ((EditText)openBug.findViewById(R.id.AuthorName)).getText().toString();
- // do not set name as author it is ridiculous in that case
- ((OsmandApplication) activity.getApplication()).getSettings().USER_NAME.set(author);
+ final String text = getTextAndUpdateUserPwd(openBug);
createNewBugAsync(latitude, longitude, text);
}
@@ -447,20 +445,28 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
final View view = activity.getLayoutInflater().inflate(R.layout.open_bug, null);
builder.setView(view);
((EditText)view.findViewById(R.id.AuthorName)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_NAME.get());
+ ((EditText)view.findViewById(R.id.Password)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
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) {
OpenStreetNote bug = (OpenStreetNote) args.getSerializable(KEY_BUG);
- String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
- String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString();
- ((OsmandApplication) OsmBugsLayer.this.activity.getApplication()).getSettings().USER_NAME.set(author);
+ String text = getTextAndUpdateUserPwd(view);
addingCommentAsync(bug, text);
}
});
return builder.create();
}
+ private String getTextAndUpdateUserPwd(final View view) {
+ String text = ((EditText)view.findViewById(R.id.BugMessage)).getText().toString();
+ String author = ((EditText)view.findViewById(R.id.AuthorName)).getText().toString();
+ String pwd = ((EditText)view.findViewById(R.id.Password)).getText().toString();
+ ((OsmandApplication) OsmBugsLayer.this.activity.getApplication()).getSettings().USER_NAME.set(author);
+ ((OsmandApplication) OsmBugsLayer.this.activity.getApplication()).getSettings().USER_PASSWORD.set(pwd);
+ return text;
+ }
+
public void refreshMap(){
if (view != null && view.getLayers().contains(OsmBugsLayer.this)) {
view.refreshMap();
@@ -480,6 +486,12 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
@Override
public void onClick(DialogInterface dialog, int which) {
OpenStreetNote bug = (OpenStreetNote) args.getSerializable(KEY_BUG);
+ String us = activity.getMyApplication().getSettings().USER_NAME.get();
+ String pwd = activity.getMyApplication().getSettings().USER_PASSWORD.get();
+ if(us.length() == 0 || pwd.length() == 0) {
+ AccessibleToast.makeText(activity, activity.getString(R.string.osb_author_or_password_not_specified),
+ Toast.LENGTH_SHORT).show();
+ }
closingAsync(bug, "");
}
});