From 02fff71197c0bcb32c6b0bd8fb7601d4933985d5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 19 Feb 2016 17:52:16 +0200 Subject: [PATCH 1/6] Fix spen --- OsmAnd-java/src/net/osmand/OsmAndCollator.java | 2 +- OsmAnd/AndroidManifest.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/OsmAndCollator.java b/OsmAnd-java/src/net/osmand/OsmAndCollator.java index 1ba11f3d60..334f49abe7 100644 --- a/OsmAnd-java/src/net/osmand/OsmAndCollator.java +++ b/OsmAnd-java/src/net/osmand/OsmAndCollator.java @@ -5,7 +5,7 @@ import java.util.Locale; public class OsmAndCollator { public static net.osmand.Collator primaryCollator() { - // romanian locale encounters diacritics as differnet symbols + // romanian locale encounters diacritics as different symbols final java.text.Collator instance = Locale.getDefault().getLanguage().equals("ro") || Locale.getDefault().getLanguage().equals("sk")? java.text.Collator.getInstance(Locale.US) : java.text.Collator.getInstance(); diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index c0aa8be30f..5b17a3f816 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -37,6 +37,8 @@ + + Date: Fri, 19 Feb 2016 12:29:16 +0200 Subject: [PATCH 2/6] Disabled --- OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java index cfc9f90127..c478670155 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java @@ -58,7 +58,7 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil { @Override public OsmBugResult commit(OsmNotesPoint point, String text, Action action) { - return commit(point, text, action, true); + return commit(point, text, action, false); } public OsmBugResult commit(OsmNotesPoint point, String text, Action action, boolean anonymous) { From 68fbf8adbfd9d25ec011213761817ff0a5923e61 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Fri, 19 Feb 2016 18:29:22 +0200 Subject: [PATCH 3/6] New commit message dialog implemented. Closes #2114, closes #1290. --- OsmAnd/res/layout/send_poi_dialog.xml | 75 ++++++++++++++----- OsmAnd/res/values/strings.xml | 3 + .../plus/osmedit/DashOsmEditsFragment.java | 8 +- .../plus/osmedit/EditPOIMenuController.java | 4 +- .../osmand/plus/osmedit/OsmEditsFragment.java | 18 +++-- .../osmedit/OsmEditsUploadListenerHelper.java | 7 +- .../UploadOpenstreetmapPointAsyncTask.java | 8 -- .../dialogs/SendPoiDialogFragment.java | 20 ++--- 8 files changed, 93 insertions(+), 50 deletions(-) diff --git a/OsmAnd/res/layout/send_poi_dialog.xml b/OsmAnd/res/layout/send_poi_dialog.xml index f1389f7140..620009d0d6 100644 --- a/OsmAnd/res/layout/send_poi_dialog.xml +++ b/OsmAnd/res/layout/send_poi_dialog.xml @@ -1,57 +1,94 @@ + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + + + + + + + + + + + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginTop="16dp" + android:text="@string/osb_comment_dialog_message"/> + android:minLines="1"/> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:text="@string/close_changeset"/> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:text="@string/user_name"/> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"/> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:text="@string/user_password"/> + android:layout_marginBottom="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:inputType="textPassword"/> diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 9fe8064bea..9be58cf443 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -18,6 +18,8 @@ Really download {0} file(s)? This needs {1} MB permanently? Currently, there are {2} MB available. + You can upload your OSM Note anonymously of youse your OpenStreetMap.org profile. + Upload OSM Note Show Map markers topbar First Map marker Second Map marker @@ -2235,4 +2237,5 @@ If you need help with OsmAnd application, please contact our support team: suppo Number of contributors Number of edits Report for + Upload anonymously diff --git a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java index a133db2e89..d62eede901 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java @@ -80,6 +80,7 @@ public class DashOsmEditsFragment extends DashBaseFragment private void setupEditings() { View mainView = getView(); + assert mainView != null; if (plugin == null) { mainView.setVisibility(View.GONE); return; @@ -144,14 +145,15 @@ public class DashOsmEditsFragment extends DashBaseFragment b.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - showProgressDialog(new OsmPoint[] {point}, false); + showProgressDialog(new OsmPoint[] {point}, false, false); } }); b.setNegativeButton(R.string.shared_string_cancel, null); b.show(); } - public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet) { + @Override + public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) { OsmPoint[] toUpload = points; ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(R.string.uploading, R.string.local_openstreetmap_uploading, ProgressDialog.STYLE_HORIZONTAL); @@ -175,7 +177,7 @@ public class DashOsmEditsFragment extends DashBaseFragment }; dialog.show(getChildFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, - listener, plugin, toUpload.length, closeChangeSet); + listener, plugin, toUpload.length, closeChangeSet, anonymously); uploadTask.execute(toUpload); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java index 222d591fc2..24a962bb12 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java @@ -33,7 +33,7 @@ public class EditPOIMenuController extends MenuController { poiUploader = new ProgressDialogPoiUploader() { @Override - public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet) { + public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) { ProgressDialogFragment dialog = ProgressDialogFragment.createInstance( R.string.uploading, R.string.local_openstreetmap_uploading, @@ -53,7 +53,7 @@ public class EditPOIMenuController extends MenuController { }; dialog.show(mapActivity.getSupportFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( - dialog, listener, plugin, points.length, closeChangeSet); + dialog, listener, plugin, points.length, closeChangeSet, anonymously); uploadTask.execute(points); } }; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 45361d54b0..e6f867faa7 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -99,7 +99,7 @@ public class OsmEditsFragment extends OsmAndListFragment public android.widget.ArrayAdapter getAdapter() { return listAdapter; - }; + } private void selectAll() { for (int i = 0; i < listAdapter.getCount(); i++) { @@ -143,7 +143,7 @@ public class OsmEditsFragment extends OsmAndListFragment @Override public boolean onMenuItemClick(MenuItem item) { new BackupOpenstreetmapPointAsyncTask().execute( - listAdapter.dataPoints.toArray(new OsmPoint[0])); + listAdapter.dataPoints.toArray(new OsmPoint[listAdapter.dataPoints.size()])); return true; } }); @@ -170,7 +170,7 @@ public class OsmEditsFragment extends OsmAndListFragment item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - uploadItems(osmEditsSelected.toArray(new OsmPoint[0])); + uploadItems(osmEditsSelected.toArray(new OsmPoint[osmEditsSelected.size()])); mode.finish(); return true; } @@ -285,6 +285,7 @@ public class OsmEditsFragment extends OsmAndListFragment private void enableSelectionMode(boolean selectionMode) { this.selectionMode = selectionMode; + //noinspection ConstantConditions getView().findViewById(R.id.select_all).setVisibility(selectionMode ? View.VISIBLE : View.GONE); ((FavoritesActivity) getActivity()).setToolbarVisibility(!selectionMode && AndroidUiHelper.isOrientationPortrait(getActivity())); @@ -485,9 +486,9 @@ public class OsmEditsFragment extends OsmAndListFragment item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - ArrayList points = new ArrayList(); + ArrayList points = new ArrayList<>(); points.add(info); - deleteItems(new ArrayList(points)); + deleteItems(new ArrayList<>(points)); return true; } @@ -527,7 +528,7 @@ public class OsmEditsFragment extends OsmAndListFragment // UploadOsmEditsConfirmDialogFragment.TAG); } - public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet) { + public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) { ProgressDialogFragment dialog = ProgressDialogFragment.createInstance( R.string.uploading, R.string.local_openstreetmap_uploading, @@ -547,7 +548,7 @@ public class OsmEditsFragment extends OsmAndListFragment }; dialog.show(getActivity().getSupportFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( - dialog, listener, plugin, points.length, closeChangeSet); + dialog, listener, plugin, points.length, closeChangeSet, anonymously); uploadTask.execute(points); } @@ -687,10 +688,12 @@ public class OsmEditsFragment extends OsmAndListFragment public Dialog onCreateDialog(Bundle savedInstanceState) { final OsmEditsFragment parentFragment = (OsmEditsFragment) getParentFragment(); final OsmEditingPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class); + @SuppressWarnings("unchecked") final ArrayList points = (ArrayList) getArguments().getSerializable(POINTS_LIST); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + assert points != null; builder.setMessage(getString(R.string.local_osm_changes_delete_all_confirm, points.size())); builder.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() { @@ -699,6 +702,7 @@ public class OsmEditsFragment extends OsmAndListFragment Iterator it = points.iterator(); while (it.hasNext()) { OsmPoint osmPoint = it.next(); + assert plugin != null; if (osmPoint.getGroup() == OsmPoint.Group.POI) { plugin.getDBPOI().deletePOI((OpenstreetmapPoint) osmPoint); } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java index 35b3321d65..44c1c6f050 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java @@ -91,7 +91,7 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { ProgressDialog.STYLE_HORIZONTAL); dialog.show(activity.getSupportFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( - dialog, helper, plugin, toUpload.length, false); + dialog, helper, plugin, toUpload.length, false, false); uploadTask.execute(toUpload); } @@ -115,6 +115,8 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { public void onClick(@Nullable DialogInterface dialog, int id) { OsmEditingPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class); + assert point != null; + assert plugin != null; if (point.getGroup() == OsmPoint.Group.BUG) { plugin.getDBBug().deleteAllBugModifications( (OsmNotesPoint) point); @@ -150,6 +152,7 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { boolean[] hasErrors = arguments.getBooleanArray(HAS_ERROR); final OsmPoint[] points = (OsmPoint[]) arguments.getSerializable(POINTS_WITH_ERRORS); int successfulUploads = 0; + assert hasErrors != null; for (boolean hasError : hasErrors) { if (!hasError) { successfulUploads++; @@ -237,7 +240,7 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { View row = convertView; - PointHolder holder = null; + PointHolder holder; if (row == null) { LayoutInflater inflater = context.getLayoutInflater(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java b/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java index 3fd50618da..9477428426 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/UploadOpenstreetmapPointAsyncTask.java @@ -24,14 +24,6 @@ public class UploadOpenstreetmapPointAsyncTask private final boolean closeChangeSet; private final boolean loadAnonymous; - public UploadOpenstreetmapPointAsyncTask(ProgressDialogFragment progress, - OsmEditsUploadListener listener, - OsmEditingPlugin plugin, - int listSize, - boolean closeChangeSet) { - this(progress, listener, plugin, listSize, closeChangeSet, false); - } - public UploadOpenstreetmapPointAsyncTask(ProgressDialogFragment progress, OsmEditsUploadListener listener, OsmEditingPlugin plugin, diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java index 5420afbed4..8c638474e9 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java @@ -6,6 +6,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; +import android.support.v7.widget.SwitchCompat; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; @@ -33,6 +34,7 @@ public class SendPoiDialogFragment extends DialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.send_poi_dialog, null); final View messageEditTextLabel = view.findViewById(R.id.messageEditTextLabel); + final SwitchCompat uploadAnonymously = (SwitchCompat) view.findViewById(R.id.upload_anonymously_switch); final EditText messageEditText = (EditText) view.findViewById(R.id.messageEditText); final EditText userNameEditText = (EditText) view.findViewById(R.id.userNameEditText); final EditText passwordEditText = (EditText) view.findViewById(R.id.passwordEditText); @@ -44,15 +46,16 @@ public class SendPoiDialogFragment extends DialogFragment { userNameEditText.setText(settings.USER_NAME.get()); passwordEditText.setText(settings.USER_PASSWORD.get()); boolean hasOsmPOI = false; - for(OsmPoint p : poi) { + assert poi != null; + for (OsmPoint p : poi) { if (p.getGroup() == OsmPoint.Group.POI) { hasOsmPOI = true; break; } } - messageEditTextLabel.setVisibility(hasOsmPOI ? View.VISIBLE :View.GONE); - messageEditText.setVisibility(hasOsmPOI ? View.VISIBLE :View.GONE); - closeChangeSetCheckBox.setVisibility(hasOsmPOI ? View.VISIBLE :View.GONE); + messageEditTextLabel.setVisibility(hasOsmPOI ? View.VISIBLE : View.GONE); + messageEditText.setVisibility(hasOsmPOI ? View.VISIBLE : View.GONE); + closeChangeSetCheckBox.setVisibility(hasOsmPOI ? View.VISIBLE : View.GONE); final ProgressDialogPoiUploader progressDialogPoiUploader; if (poiUploader != null) { @@ -61,7 +64,7 @@ public class SendPoiDialogFragment extends DialogFragment { progressDialogPoiUploader = (ProgressDialogPoiUploader) getParentFragment(); } - builder.setTitle(R.string.shared_string_commit) + builder.setTitle(R.string.upload_osm_note) .setView(view) .setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() { @Override @@ -78,7 +81,8 @@ public class SendPoiDialogFragment extends DialogFragment { } } progressDialogPoiUploader.showProgressDialog(poi, - closeChangeSetCheckBox.isChecked()); + closeChangeSetCheckBox.isChecked(), + uploadAnonymously.isChecked()); } }) .setNegativeButton(R.string.shared_string_cancel, null); @@ -94,8 +98,6 @@ public class SendPoiDialogFragment extends DialogFragment { } public interface ProgressDialogPoiUploader { - - void showProgressDialog(OsmPoint[] points, boolean closeChangeSet); - + void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously); } } From c306af55d380c81fed876ce60f0f3c6260b14b2f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 19 Feb 2016 18:56:35 +0200 Subject: [PATCH 4/6] Add relation group tag --- OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java index 1090a20138..675cec5530 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java @@ -264,6 +264,7 @@ public abstract class MapRenderingTypes { rtype.category = parentCategory == null ? null : parentCategory.category; rtype.onlyPoint = Boolean.parseBoolean(parser.getAttributeValue("", "point")); //$NON-NLS-1$ rtype.relation = Boolean.parseBoolean(parser.getAttributeValue("", "relation")); //$NON-NLS-1$ + rtype.relationGroup = Boolean.parseBoolean(parser.getAttributeValue("", "relationGroup")); //$NON-NLS-1$ if (rtype.isMain()) { rtype.namePrefix = parser.getAttributeValue("", "namePrefix"); //$NON-NLS-1$ if (rtype.namePrefix == null) { @@ -420,6 +421,7 @@ public abstract class MapRenderingTypes { protected String category = null; protected boolean relation; + protected boolean relationGroup; // creation of only section protected boolean map = true; protected boolean poi = true; @@ -444,7 +446,6 @@ public abstract class MapRenderingTypes { return poi; } - public boolean isMap(){ return map; } @@ -542,6 +543,11 @@ public abstract class MapRenderingTypes { return relation; } + public boolean isRelationGroup() { + return relationGroup; + } + + public int getFreq() { return freq; } From bd5811c7f297790165c10329e58ee95feee58c0b Mon Sep 17 00:00:00 2001 From: ezjerry liao Date: Fri, 19 Feb 2016 17:47:36 +0100 Subject: [PATCH 5/6] Translated using Weblate (Chinese (Taiwan)) Currently translated at 99.7% (1913 of 1918 strings) --- OsmAnd/res/values-zh-rTW/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 9b22ed52ea..7c9a8de757 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -2109,4 +2109,5 @@ 第二個地圖標記 工具列 小工具 + 沒有足夠的空間!這會需要暫時空間 {3} MB 和 {1} MB 的永久空間。目前只有 {2} MB 可用。 From 20db6b703995502cf906c60b9d59f4e5342e7372 Mon Sep 17 00:00:00 2001 From: jan madsen Date: Fri, 19 Feb 2016 18:13:21 +0100 Subject: [PATCH 6/6] Translated using Weblate (Danish) Currently translated at 100.0% (1918 of 1918 strings) --- OsmAnd/res/values-da/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index d77daf09cf..cbe9060e64 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -2291,4 +2291,7 @@ Moduler Ikke nok plads! Dette skulle {3} MB midlertidigt og {1} MB permanent. I øjeblikket, er der kun {2} MB tilgængelig. Virkelig hente {0} fil(er)? Dette kræver {3} MB midlertidigt og {1} MB permanent? I øjeblikket, er der {2} MB til rådighed. + Uploade OSM Bemærk + Overfør anonymt +Du kan overføre din OSM Note anonymt af youse din OpenStreetMap.org profil.