Send POI, Send GPX
This commit is contained in:
parent
e14989f464
commit
26ce1f9d7b
4 changed files with 17 additions and 13 deletions
|
@ -130,8 +130,8 @@ public class LoginBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public interface LoginOsmAutorizationListener {
|
||||
void informAutorizationPrefsUpdate();
|
||||
public interface LoginOsmAuthorizationListener {
|
||||
void informAuthorizationPrefsUpdate();
|
||||
}
|
||||
|
||||
public void authorize(String oauthVerifier) {
|
||||
|
@ -139,8 +139,8 @@ public class LoginBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
|||
client.authorize(oauthVerifier);
|
||||
}
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof LoginOsmAutorizationListener) {
|
||||
((LoginOsmAutorizationListener) target).informAutorizationPrefsUpdate();
|
||||
if (target instanceof LoginOsmAuthorizationListener) {
|
||||
((LoginOsmAuthorizationListener) target).informAuthorizationPrefsUpdate();
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
|
|
@ -4,16 +4,19 @@ import android.content.DialogInterface;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
||||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
|
||||
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -39,16 +42,14 @@ public class EditPOIMenuController extends MenuController {
|
|||
@Override
|
||||
public void buttonPressed() {
|
||||
MapActivity activity = getMapActivity();
|
||||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
if (plugin != null && activity != null) {
|
||||
OsmOAuthAuthorizationAdapter client = new OsmOAuthAuthorizationAdapter(activity.getMyApplication());
|
||||
if (client.isValidToken()){
|
||||
if (client.isValidToken() || !Algorithms.isEmpty(settings.USER_NAME.get()) && !Algorithms.isEmpty(settings.USER_PASSWORD.get())){
|
||||
new SendPoiDialogFragment.SimpleProgressDialogPoiUploader(activity).
|
||||
showProgressDialog(new OsmPoint[] { getOsmPoint() }, false, false);
|
||||
}
|
||||
else {
|
||||
SendPoiDialogFragment sendPoiDialogFragment =
|
||||
SendPoiDialogFragment.createInstance(new OsmPoint[]{getOsmPoint()}, SendPoiDialogFragment.PoiUploaderType.SIMPLE);
|
||||
sendPoiDialogFragment.show(activity.getSupportFragmentManager(), SendPoiDialogFragment.TAG);
|
||||
} else {
|
||||
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), activity.getLoginBottomSheetFragment());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.commons.logging.Log;
|
|||
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
||||
import static net.osmand.plus.osmedit.OsmEditingPlugin.OSM_EDIT_TAB;
|
||||
|
||||
public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged, ValidateOsmLoginDetailsTask.ValidateOsmLoginListener, LoginBottomSheetFragment.LoginOsmAutorizationListener {
|
||||
public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged, ValidateOsmLoginDetailsTask.ValidateOsmLoginListener, LoginBottomSheetFragment.LoginOsmAuthorizationListener {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(OsmEditingFragment.class);
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void informAutorizationPrefsUpdate() {
|
||||
public void informAuthorizationPrefsUpdate() {
|
||||
client = new OsmOAuthAuthorizationAdapter(app);
|
||||
updateAllSettings();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -41,6 +43,7 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
@ -464,7 +467,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
String pwd = settings.USER_PASSWORD.get();
|
||||
String authToken = settings.USER_ACCESS_TOKEN.get();
|
||||
if ((Algorithms.isEmpty(name) || Algorithms.isEmpty(pwd)) && Algorithms.isEmpty(authToken)) {
|
||||
Toast.makeText(la, R.string.validate_gpx_upload_name_pwd, Toast.LENGTH_LONG).show();
|
||||
LoginBottomSheetFragment.showInstance(f.getFragmentManager(), f.getTargetFragment());
|
||||
return false;
|
||||
}
|
||||
AlertDialog.Builder bldr = new AlertDialog.Builder(la);
|
||||
|
|
Loading…
Reference in a new issue