Fix crash on taping "Upload" in My places.

This commit is contained in:
Dima-1 2020-11-16 16:55:06 +02:00
parent 596cb99f66
commit 77a7b03144
2 changed files with 30 additions and 13 deletions

View file

@ -1,5 +1,6 @@
package net.osmand.plus.osmedit.dialogs;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
@ -24,6 +25,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.dialogs.ProgressDialogFragment;
import net.osmand.plus.osmedit.OsmNotesPoint;
import net.osmand.plus.osmedit.OsmPoint;
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
@ -171,9 +173,16 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
@Override
protected void onRightBottomButtonClick() {
ProgressDialogPoiUploader progressDialogPoiUploader;
progressDialogPoiUploader = new SimpleProgressDialogPoiUploader((MapActivity) getActivity());
progressDialogPoiUploader.showProgressDialog(poi, false, uploadAnonymously.isChecked());
ProgressDialogPoiUploader progressDialogPoiUploader = null;
Activity activity = getActivity();
if (activity instanceof MapActivity) {
progressDialogPoiUploader = new SimpleProgressDialogPoiUploader((MapActivity) activity);
} else if (getParentFragment() instanceof ProgressDialogFragment) {
progressDialogPoiUploader = (ProgressDialogPoiUploader) getParentFragment();
}
if (progressDialogPoiUploader != null) {
progressDialogPoiUploader.showProgressDialog(poi, false, uploadAnonymously.isChecked());
}
dismiss();
}

View file

@ -1,5 +1,6 @@
package net.osmand.plus.osmedit.dialogs;
import android.app.Activity;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
import android.view.View;
@ -20,6 +21,7 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.dialogs.ProgressDialogFragment;
import net.osmand.plus.osmedit.OpenstreetmapPoint;
import net.osmand.plus.osmedit.OsmPoint;
import net.osmand.plus.settings.backend.OsmandSettings;
@ -109,19 +111,25 @@ public class SendPoiBottomSheetFragment extends MenuBottomSheetDialogFragment {
@Override
protected void onRightBottomButtonClick() {
final ProgressDialogPoiUploader progressDialogPoiUploader;
progressDialogPoiUploader = new SimpleProgressDialogPoiUploader((MapActivity) getActivity());
String comment = messageEditText.getText().toString();
if (comment.length() > 0) {
for (OsmPoint osmPoint : poi) {
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
((OpenstreetmapPoint) osmPoint).setComment(comment);
break;
ProgressDialogPoiUploader progressDialogPoiUploader = null;
Activity activity = getActivity();
if (activity instanceof MapActivity) {
progressDialogPoiUploader = new SimpleProgressDialogPoiUploader((MapActivity) activity);
} else if (getParentFragment() instanceof ProgressDialogFragment) {
progressDialogPoiUploader = (ProgressDialogPoiUploader) getParentFragment();
}
if (progressDialogPoiUploader != null) {
String comment = messageEditText.getText().toString();
if (comment.length() > 0) {
for (OsmPoint osmPoint : poi) {
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
((OpenstreetmapPoint) osmPoint).setComment(comment);
break;
}
}
}
progressDialogPoiUploader.showProgressDialog(poi, closeChangeSet.isChecked(), false);
}
progressDialogPoiUploader.showProgressDialog(poi, closeChangeSet.isChecked(), false);
dismiss();
}