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-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; } 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 @@ + + + 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-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. 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 可用。 diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index d38fc5f8c3..f3edba5b32 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -20,6 +20,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 @@ -2237,4 +2239,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/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) { 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); } }