Fix review

This commit is contained in:
Dima-1 2020-11-13 16:43:33 +02:00
parent ef08e0b3a0
commit d3f4cccf41
22 changed files with 52 additions and 68 deletions

View file

@ -47,7 +47,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding" android:layout_marginBottom="@dimen/content_padding"
android:minHeight="@dimen/context_menu_buttons_bottom_height" android:minHeight="@dimen/context_menu_buttons_bottom_height"
android:text="@string/close_changset" android:text="@string/close_changeset"
android:paddingLeft="@dimen/content_padding_small" android:paddingLeft="@dimen/content_padding_small"
android:paddingRight="@dimen/content_padding_small" android:paddingRight="@dimen/content_padding_small"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"

View file

@ -3942,7 +3942,6 @@
<string name="subscription_on_hold_title">اشتراك OsmAnd Live معلق</string> <string name="subscription_on_hold_title">اشتراك OsmAnd Live معلق</string>
<string name="login_open_street_map">تسجيل الدخول إلى خريطة الشارع المفتوح</string> <string name="login_open_street_map">تسجيل الدخول إلى خريطة الشارع المفتوح</string>
<string name="login_open_street_map_org">تسجيل الدخول إلى OpenStreetMap.org</string> <string name="login_open_street_map_org">تسجيل الدخول إلى OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">تسجيل الخروج</string>
<string name="open_street_map_login_mode">تحتاج إلى تسجيل الدخول لرفع التغييرات الجديدة أو المعدلة. <string name="open_street_map_login_mode">تحتاج إلى تسجيل الدخول لرفع التغييرات الجديدة أو المعدلة.
\n \n
\nيمكنك تسجيل الدخول باستخدام طريقة التفويض الآمنة أو استخدام تسجيل الدخول وكلمة المرور.</string> \nيمكنك تسجيل الدخول باستخدام طريقة التفويض الآمنة أو استخدام تسجيل الدخول وكلمة المرور.</string>

View file

@ -3957,7 +3957,6 @@
<string name="subscription_expired_title">La suscripción a OsmAnd Live ha caducado</string> <string name="subscription_expired_title">La suscripción a OsmAnd Live ha caducado</string>
<string name="subscription_paused_title">La suscripción a OsmAnd Live se ha pausado</string> <string name="subscription_paused_title">La suscripción a OsmAnd Live se ha pausado</string>
<string name="subscription_on_hold_title">La suscripción a OsmAnd Live está en espera</string> <string name="subscription_on_hold_title">La suscripción a OsmAnd Live está en espera</string>
<string name="sing_in_with_open_street_map">Ingresar con OpenStreetMap</string>
<string name="login_open_street_map">Iniciar sesión en OpenStreetMap</string> <string name="login_open_street_map">Iniciar sesión en OpenStreetMap</string>
<string name="login_open_street_map_org">Ingresar a OpenStreetMap.org</string> <string name="login_open_street_map_org">Ingresar a OpenStreetMap.org</string>
<string name="open_street_map_login_mode">Necesitas iniciar sesión para subir cambios nuevos o modificados. <string name="open_street_map_login_mode">Necesitas iniciar sesión para subir cambios nuevos o modificados.

View file

@ -3804,7 +3804,7 @@
<string name="subscription_expired_title">OsmAnd Live tellimus on aegunud</string> <string name="subscription_expired_title">OsmAnd Live tellimus on aegunud</string>
<string name="subscription_payment_issue_title">Sinu tellimusega on üks pisikene segadus. Selleks et Google Play seadistuses makseviisi parandada, palun klõpsi seda nuppu.</string> <string name="subscription_payment_issue_title">Sinu tellimusega on üks pisikene segadus. Selleks et Google Play seadistuses makseviisi parandada, palun klõpsi seda nuppu.</string>
<string name="manage_subscription">Halda tellimusi</string> <string name="manage_subscription">Halda tellimusi</string>
<string name="sing_in_with_open_street_map">Logi sisse OpenStreetMapi kasutajakontoga</string> <string name="sign_in_with_open_street_map">Logi sisse OpenStreetMapi kasutajakontoga</string>
<string name="user_login">Kasutajanimi</string> <string name="user_login">Kasutajanimi</string>
<string name="use_login_password">Pruugi kasutajanime ja salasõna</string> <string name="use_login_password">Pruugi kasutajanime ja salasõna</string>
<string name="open_street_map_login_mode">Täienduste või muudatuste üleslaadimiseks pead sisse logima. <string name="open_street_map_login_mode">Täienduste või muudatuste üleslaadimiseks pead sisse logima.

View file

@ -3932,7 +3932,6 @@
<string name="subscription_paused_title">L\'abonnement OsmAnd Live a été suspendu</string> <string name="subscription_paused_title">L\'abonnement OsmAnd Live a été suspendu</string>
<string name="login_open_street_map">Se connecter à OpenStreetMap</string> <string name="login_open_street_map">Se connecter à OpenStreetMap</string>
<string name="login_open_street_map_org">Se connecter à OpenStreetMap.org</string> <string name="login_open_street_map_org">Se connecter à OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">Se connecter avec OpenStreetMap</string>
<string name="user_login">Identifiant</string> <string name="user_login">Identifiant</string>
<string name="use_login_password">Utiliser un identifiant et un mot de passe</string> <string name="use_login_password">Utiliser un identifiant et un mot de passe</string>
<string name="login_account">Compte</string> <string name="login_account">Compte</string>

View file

@ -3954,7 +3954,7 @@
<string name="message_you_need_add_two_points_to_show_graphs">עליך להוסיף שתי נקודות לפחות.</string> <string name="message_you_need_add_two_points_to_show_graphs">עליך להוסיף שתי נקודות לפחות.</string>
<string name="login_open_street_map">כניסה ל־OpenStreetMap</string> <string name="login_open_street_map">כניסה ל־OpenStreetMap</string>
<string name="login_open_street_map_org">כניסה ל־OpenStreetMap.org</string> <string name="login_open_street_map_org">כניסה ל־OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">כניסה עם OpenStreetMap</string> <string name="sign_in_with_open_street_map">כניסה עם OpenStreetMap</string>
<string name="use_login_password">להשתמש בשם כניסה וססמה</string> <string name="use_login_password">להשתמש בשם כניסה וססמה</string>
<string name="login_account">חשבון</string> <string name="login_account">חשבון</string>
<string name="user_login">כניסה</string> <string name="user_login">כניסה</string>

View file

@ -3961,7 +3961,7 @@
<string name="user_login">Login</string> <string name="user_login">Login</string>
<string name="login_open_street_map">Zaloguj się do OpenStreetMap</string> <string name="login_open_street_map">Zaloguj się do OpenStreetMap</string>
<string name="login_open_street_map_org">Zaloguj się do OpenStreetMap.org</string> <string name="login_open_street_map_org">Zaloguj się do OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">Zaloguj się za pomocą OpenStreetMap</string> <string name="sign_in_with_open_street_map">Zaloguj się za pomocą OpenStreetMap</string>
<string name="open_street_map_login_mode">Musisz się zalogować, aby przesłać nowe lub zmodyfikowane zmiany. <string name="open_street_map_login_mode">Musisz się zalogować, aby przesłać nowe lub zmodyfikowane zmiany.
\n \n
\nMożesz zalogować się za pomocą bezpiecznej metody autoryzacji OAuth lub użyć swojego loginu i hasła.</string> \nMożesz zalogować się za pomocą bezpiecznej metody autoryzacji OAuth lub użyć swojego loginu i hasła.</string>

View file

@ -3950,7 +3950,6 @@
<string name="app_mode_gap">Diferença</string> <string name="app_mode_gap">Diferença</string>
<string name="login_open_street_map">Entrar para OpenStreetMap</string> <string name="login_open_street_map">Entrar para OpenStreetMap</string>
<string name="login_open_street_map_org">Entrar com OpenStreetMap.org</string> <string name="login_open_street_map_org">Entrar com OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">Entrar com OpenStreetMap</string>
<string name="open_street_map_login_mode">Você precisa entrar para enviar alterações novas ou modificadas. <string name="open_street_map_login_mode">Você precisa entrar para enviar alterações novas ou modificadas.
\n \n
\nVocê pode entrar usando o método OAuth seguro ou usar sua entrada e senha.</string> \nVocê pode entrar usando o método OAuth seguro ou usar sua entrada e senha.</string>

View file

@ -3960,7 +3960,7 @@
\nPode entrar a usar o método seguro OAuth ou usar o seu nome de utilizador e a sua palavra-passe.</string> \nPode entrar a usar o método seguro OAuth ou usar o seu nome de utilizador e a sua palavra-passe.</string>
<string name="login_open_street_map">Fazer login ao OpenStreetMap</string> <string name="login_open_street_map">Fazer login ao OpenStreetMap</string>
<string name="login_open_street_map_org">Entrar com OpenStreetMap.org</string> <string name="login_open_street_map_org">Entrar com OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">Entrar com OpenStreetMap</string> <string name="sign_in_with_open_street_map">Entrar com OpenStreetMap</string>
<string name="use_login_password">Usar nome do utilizador e palavra-passe</string> <string name="use_login_password">Usar nome do utilizador e palavra-passe</string>
<string name="login_account">Conta</string> <string name="login_account">Conta</string>
<string name="user_login">Entrar</string> <string name="user_login">Entrar</string>

View file

@ -3905,7 +3905,6 @@
<string name="message_you_need_add_two_points_to_show_graphs">En az iki nokta eklemelisiniz</string> <string name="message_you_need_add_two_points_to_show_graphs">En az iki nokta eklemelisiniz</string>
<string name="login_open_street_map">OpenStreetMap\'te oturum aç</string> <string name="login_open_street_map">OpenStreetMap\'te oturum aç</string>
<string name="login_open_street_map_org">OpenStreetMap.org\'da oturum aç</string> <string name="login_open_street_map_org">OpenStreetMap.org\'da oturum aç</string>
<string name="sing_in_with_open_street_map">OpenStreetMap ile giriş yap</string>
<string name="open_street_map_login_mode">Yenilikleri veya değişiklikleri karşıya yüklemek için oturum açmanız gerekir. <string name="open_street_map_login_mode">Yenilikleri veya değişiklikleri karşıya yüklemek için oturum açmanız gerekir.
\n \n
\nGüvenli OAuth yöntemini kullanarak oturum açabilir veya kullanıcı adı ve parolanızı kullanabilirsiniz.</string> \nGüvenli OAuth yöntemini kullanarak oturum açabilir veya kullanıcı adı ve parolanızı kullanabilirsiniz.</string>

View file

@ -3951,7 +3951,6 @@
<string name="subscription_on_hold_title">Передплата OsmAnd Live на утриманні</string> <string name="subscription_on_hold_title">Передплата OsmAnd Live на утриманні</string>
<string name="login_open_street_map">Увійти до OpenStreetMap.org</string> <string name="login_open_street_map">Увійти до OpenStreetMap.org</string>
<string name="login_open_street_map_org">Увійти до OpenStreetMap.org</string> <string name="login_open_street_map_org">Увійти до OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">Увійти за допомогою OpenStreetMap</string>
<string name="open_street_map_login_mode">Увійдіть, щоб вивантажити нові або внесені зміни. <string name="open_street_map_login_mode">Увійдіть, щоб вивантажити нові або внесені зміни.
\n \n
\nВи можете увійти, за допомогою безпечного методу OAuth, або скористатися своїм ім\'ям та паролем.</string> \nВи можете увійти, за допомогою безпечного методу OAuth, або скористатися своїм ім\'ям та паролем.</string>

View file

@ -3950,7 +3950,6 @@
<string name="subscription_on_hold_title">OsmAnd Live 訂閱已暫停</string> <string name="subscription_on_hold_title">OsmAnd Live 訂閱已暫停</string>
<string name="login_open_street_map">登入到 OpenStreetMap</string> <string name="login_open_street_map">登入到 OpenStreetMap</string>
<string name="login_open_street_map_org">登入到 OpenStreetMap.org</string> <string name="login_open_street_map_org">登入到 OpenStreetMap.org</string>
<string name="sing_in_with_open_street_map">以 OpenStreetMap 登入</string>
<string name="open_street_map_login_mode">您必須登入以上傳新的或修正過的變更。 <string name="open_street_map_login_mode">您必須登入以上傳新的或修正過的變更。
\n \n
\n您可以使用安全的 OAuth 方法或使用您的登入與密碼來登入。</string> \n您可以使用安全的 OAuth 方法或使用您的登入與密碼來登入。</string>

View file

@ -14,7 +14,6 @@
<string name="osm_login_descr">You can log in using the safe OAuth method or use your login and password.</string> <string name="osm_login_descr">You can log in using the safe OAuth method or use your login and password.</string>
<string name="osm_edit_comment_note">Comment OSM Note</string> <string name="osm_edit_comment_note">Comment OSM Note</string>
<string name="osm_edit_close_note">Close OSM Note</string> <string name="osm_edit_close_note">Close OSM Note</string>
<string name="close_changset">Closed changset</string>
<string name="gpx_upload_trackable_visibility_descr">Trackable means that the trace will not show up in any public listings but trackpoints from it will still be available through the public GPS API with timestamps. Other users will only be able to download processed trackpoints from your trace which can\'t be associated with you directly.</string> <string name="gpx_upload_trackable_visibility_descr">Trackable means that the trace will not show up in any public listings but trackpoints from it will still be available through the public GPS API with timestamps. Other users will only be able to download processed trackpoints from your trace which can\'t be associated with you directly.</string>
<string name="gpx_upload_identifiable_visibility_descr">Identifiable means that the trace will be shown publicly in Your GPS traces and in public GPS trace listings, i.e. other users will be able to download the raw trace and associate it with your username. Data served via the trackpoints API will reference your original trace page. Timestamps of the trace points are available through the public GPS API.</string> <string name="gpx_upload_identifiable_visibility_descr">Identifiable means that the trace will be shown publicly in Your GPS traces and in public GPS trace listings, i.e. other users will be able to download the raw trace and associate it with your username. Data served via the trackpoints API will reference your original trace page. Timestamps of the trace points are available through the public GPS API.</string>
<string name="gpx_upload_private_visibility_descr">Private means that the trace will not show up in any public listings, but trackpoints from it will still be available through the public GPS API without timestamps but will not be chronologically ordered.</string> <string name="gpx_upload_private_visibility_descr">Private means that the trace will not show up in any public listings, but trackpoints from it will still be available through the public GPS API without timestamps but will not be chronologically ordered.</string>

View file

@ -50,12 +50,12 @@ public class EditPOIMenuController extends MenuController {
OsmandApplication app = activity.getMyApplication(); OsmandApplication app = activity.getMyApplication();
OsmandSettings settings = app.getSettings(); OsmandSettings settings = app.getSettings();
OsmOAuthAuthorizationAdapter client = new OsmOAuthAuthorizationAdapter(app); OsmOAuthAuthorizationAdapter client = new OsmOAuthAuthorizationAdapter(app);
boolean isLogin = client.isValidToken() boolean isLogged = client.isValidToken()
|| !Algorithms.isEmpty(settings.USER_NAME.get()) || !Algorithms.isEmpty(settings.USER_NAME.get())
&& !Algorithms.isEmpty(settings.USER_PASSWORD.get()); && !Algorithms.isEmpty(settings.USER_PASSWORD.get());
if (point instanceof OpenstreetmapPoint) { if (point instanceof OpenstreetmapPoint) {
if (isLogin) { if (isLogged) {
SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(),
new OsmPoint[]{getOsmPoint()}); new OsmPoint[]{getOsmPoint()});
} else { } else {

View file

@ -5,18 +5,23 @@ import android.os.AsyncTask;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
public class HandleOsmNoteAsyncTask extends AsyncTask<Void, Void, OsmBugsUtil.OsmBugResult> { import net.osmand.plus.osmedit.OsmPoint.Action;
import static net.osmand.plus.osmedit.OsmBugsLayer.*;
import static net.osmand.plus.osmedit.OsmBugsUtil.*;
public class HandleOsmNoteAsyncTask extends AsyncTask<Void, Void, OsmBugResult> {
private OsmBugsUtil osmbugsUtil; private OsmBugsUtil osmbugsUtil;
private final OsmBugsUtil local; private final OsmBugsUtil local;
private final OsmBugsLayer.OpenStreetNote bug; private final OpenStreetNote bug;
private final OsmNotesPoint point; private final OsmNotesPoint point;
private final String text; private final String text;
private final OsmPoint.Action action; private final Action action;
private final HandleBugListener handleBugListener; private final HandleBugListener handleBugListener;
public HandleOsmNoteAsyncTask(@NonNull OsmBugsUtil osmbugsUtil, @NonNull OsmBugsUtil local, public HandleOsmNoteAsyncTask(@NonNull OsmBugsUtil osmbugsUtil, @NonNull OsmBugsUtil local,
@Nullable OsmBugsLayer.OpenStreetNote bug, @Nullable OsmNotesPoint point, @Nullable OpenStreetNote bug, @Nullable OsmNotesPoint point,
String text, OsmPoint.Action action, String text, Action action,
@Nullable HandleBugListener handleBugListener) { @Nullable HandleBugListener handleBugListener) {
this.osmbugsUtil = osmbugsUtil; this.osmbugsUtil = osmbugsUtil;
this.local = local; this.local = local;
@ -28,7 +33,7 @@ public class HandleOsmNoteAsyncTask extends AsyncTask<Void, Void, OsmBugsUtil.Os
} }
@Override @Override
protected OsmBugsUtil.OsmBugResult doInBackground(Void... params) { protected OsmBugResult doInBackground(Void... params) {
if (bug != null) { if (bug != null) {
OsmNotesPoint pnt = new OsmNotesPoint(); OsmNotesPoint pnt = new OsmNotesPoint();
pnt.setId(bug.getId()); pnt.setId(bug.getId());
@ -42,13 +47,13 @@ public class HandleOsmNoteAsyncTask extends AsyncTask<Void, Void, OsmBugsUtil.Os
return null; return null;
} }
protected void onPostExecute(OsmBugsUtil.OsmBugResult obj) { protected void onPostExecute(OsmBugResult obj) {
handleBugListener.onOsmBugHandled(obj, action, bug, point, text); handleBugListener.onOsmBugHandled(obj, action, bug, point, text);
} }
public interface HandleBugListener { public interface HandleBugListener {
void onOsmBugHandled(OsmBugsUtil.OsmBugResult obj, OsmPoint.Action action, OsmBugsLayer.OpenStreetNote bug, void onOsmBugHandled(OsmBugResult obj, Action action, OpenStreetNote bug,
OsmNotesPoint point, String text); OsmNotesPoint point, String text);
} }
} }

View file

@ -370,18 +370,12 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
private void createBugDialog(final boolean offline, String text, int titleTextId, int posButtonTextId, private void createBugDialog(final boolean offline, String text, int titleTextId, int posButtonTextId,
final Action action, final OpenStreetNote bug, final OsmNotesPoint point) { final Action action, final OpenStreetNote bug, final OsmNotesPoint point) {
@SuppressLint("InflateParams") final View view = LayoutInflater.from(activity).inflate(R.layout.open_bug, null);
if (offline) { if (offline) {
activity.getContextMenu().close(); activity.getContextMenu().close();
BugBottomSheetDialog.showInstance(activity.getSupportFragmentManager(), getOsmbugsUtil(bug), local, text, BugBottomSheetDialog.showInstance(activity.getSupportFragmentManager(), getOsmbugsUtil(bug), local, text,
titleTextId, posButtonTextId, action, bug, point, getHandleBugListener()); titleTextId, posButtonTextId, action, bug, point, getHandleBugListener());
return; return;
}
@SuppressLint("InflateParams") final View view = LayoutInflater.from(activity).inflate(R.layout.open_bug, null);
if (offline) {
view.findViewById(R.id.user_name_field).setVisibility(View.GONE);
view.findViewById(R.id.userNameEditTextLabel).setVisibility(View.GONE);
view.findViewById(R.id.password_field).setVisibility(View.GONE);
view.findViewById(R.id.passwordEditTextLabel).setVisibility(View.GONE);
} else { } else {
((EditText) view.findViewById(R.id.user_name_field)).setText(getUserName()); ((EditText) view.findViewById(R.id.user_name_field)).setText(getUserName());
((EditText) view.findViewById(R.id.password_field)).setText( ((EditText) view.findViewById(R.id.password_field)).setText(

View file

@ -177,7 +177,6 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
settings.USER_ACCESS_TOKEN_SECRET.resetToDefault(); settings.USER_ACCESS_TOKEN_SECRET.resetToDefault();
authorizationAdapter.resetToken(); authorizationAdapter.resetToken();
authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
} else { } else {
settings.USER_NAME.resetToDefault(); settings.USER_NAME.resetToDefault();
settings.USER_PASSWORD.resetToDefault(); settings.USER_PASSWORD.resetToDefault();
@ -196,7 +195,6 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
@Override @Override
public void authorizationCompleted() { public void authorizationCompleted() {
authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
updateAllSettings(); updateAllSettings();
} }
} }

View file

@ -633,11 +633,11 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
OsmandSettings settings = app.getSettings(); OsmandSettings settings = app.getSettings();
OsmOAuthAuthorizationAdapter authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter(); OsmOAuthAuthorizationAdapter authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
boolean isLogin = authorizationAdapter.isValidToken() boolean isLogged = authorizationAdapter.isValidToken()
|| !Algorithms.isEmpty(settings.USER_NAME.get()) || !Algorithms.isEmpty(settings.USER_NAME.get())
&& !Algorithms.isEmpty(settings.USER_PASSWORD.get()); && !Algorithms.isEmpty(settings.USER_PASSWORD.get());
if (hasPoiGroup(points)) { if (hasPoiGroup(points)) {
if (isLogin) { if (isLogged) {
SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), points); SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), points);
} else { } else {
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), this); LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), this);

View file

@ -34,15 +34,15 @@ public class BugBottomSheetDialog extends MenuBottomSheetDialogFragment {
public static final String TAG = BugBottomSheetDialog.class.getSimpleName(); public static final String TAG = BugBottomSheetDialog.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(BugBottomSheetDialog.class); private static final Log LOG = PlatformUtil.getLog(BugBottomSheetDialog.class);
OsmBugsUtil osmBugsUtil; private OsmBugsUtil osmBugsUtil;
OsmBugsUtil local; private OsmBugsUtil local;
String text; private String text;
int titleTextId; private int titleTextId;
int posButtonTextId; private int posButtonTextId;
OsmPoint.Action action; private OsmPoint.Action action;
OsmBugsLayer.OpenStreetNote bug; private OsmBugsLayer.OpenStreetNote bug;
OsmNotesPoint point; private OsmNotesPoint point;
HandleOsmNoteAsyncTask.HandleBugListener handleBugListener; private HandleOsmNoteAsyncTask.HandleBugListener handleBugListener;
private TextInputEditText noteText; private TextInputEditText noteText;
@Override @Override

View file

@ -44,7 +44,6 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
public static final String TAG = SendOsmNoteBottomSheetFragment.class.getSimpleName(); public static final String TAG = SendOsmNoteBottomSheetFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(SendOsmNoteBottomSheetFragment.class); private static final Log LOG = PlatformUtil.getLog(SendOsmNoteBottomSheetFragment.class);
public static final String OPENSTREETMAP_POINT = "openstreetmap_point";
private OsmPoint[] poi; private OsmPoint[] poi;
protected OsmandSettings settings; protected OsmandSettings settings;
@ -52,6 +51,7 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
private LinearLayout accountBlockView; private LinearLayout accountBlockView;
private LinearLayout signInView; private LinearLayout signInView;
private SwitchCompat uploadAnonymously; private SwitchCompat uploadAnonymously;
private OsmandApplication app;
private boolean isLoginOAuth() { private boolean isLoginOAuth() {
return !Algorithms.isEmpty(settings.USER_DISPLAY_NAME.get()); return !Algorithms.isEmpty(settings.USER_DISPLAY_NAME.get());
@ -59,7 +59,7 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
@Override @Override
public void createMenuItems(Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
OsmandApplication app = getMyApplication(); app = getMyApplication();
if (app == null) { if (app == null) {
return; return;
} }
@ -81,7 +81,7 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
accountName = sendOsmNoteView.findViewById(R.id.user_name); accountName = sendOsmNoteView.findViewById(R.id.user_name);
updateAccountName(); updateAccountName();
View signInButton = sendOsmNoteView.findViewById(R.id.sign_in_button); View signInButton = sendOsmNoteView.findViewById(R.id.sign_in_button);
setupButton(signInButton, R.string.sing_in_with_open_street_map, DialogButtonType.PRIMARY, setupButton(signInButton, R.string.sign_in_with_open_street_map, DialogButtonType.PRIMARY,
R.drawable.ic_action_openstreetmap_logo); R.drawable.ic_action_openstreetmap_logo);
signInButton.setOnClickListener(new View.OnClickListener() { signInButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -135,15 +135,15 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
} }
private void updateSignIn(boolean isChecked) { private void updateSignIn(boolean isChecked) {
boolean isLogin = isLogin(); boolean isLogged = isLogged();
accountBlockView.setVisibility(isChecked || !isLogin ? View.GONE : View.VISIBLE); accountBlockView.setVisibility(isChecked || !isLogged ? View.GONE : View.VISIBLE);
signInView.setVisibility(isChecked || isLogin ? View.GONE : View.VISIBLE); signInView.setVisibility(isChecked || isLogged ? View.GONE : View.VISIBLE);
} }
private void setupButton(View buttonView, int buttonTextId, DialogButtonType buttonType, int drawableId) { private void setupButton(View buttonView, int buttonTextId, DialogButtonType buttonType, int drawableId) {
Drawable icon = null; Drawable icon = null;
if (drawableId != -1) { if (drawableId != -1) {
icon = getMyApplication().getUIUtilities().getIcon(drawableId, R.color.popup_text_color); icon = app.getUIUtilities().getIcon(drawableId, R.color.popup_text_color);
} }
TextView buttonText = buttonView.findViewById(R.id.button_text); TextView buttonText = buttonView.findViewById(R.id.button_text);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(buttonText, icon, null, null, null); AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(buttonText, icon, null, null, null);
@ -192,9 +192,7 @@ public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragmen
updateAccountName(); updateAccountName();
} }
private boolean isLogin() { private boolean isLogged() {
OsmandApplication app = getMyApplication();
OsmandSettings settings = app.getSettings();
OsmOAuthAuthorizationAdapter adapter = app.getOsmOAuthHelper().getAuthorizationAdapter(); OsmOAuthAuthorizationAdapter adapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
return adapter.isValidToken() return adapter.isValidToken()
|| !Algorithms.isEmpty(settings.USER_NAME.get()) || !Algorithms.isEmpty(settings.USER_NAME.get())

View file

@ -36,7 +36,6 @@ public class SendPoiBottomSheetFragment extends MenuBottomSheetDialogFragment {
public static final String TAG = SendPoiBottomSheetFragment.class.getSimpleName(); public static final String TAG = SendPoiBottomSheetFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(SendPoiBottomSheetFragment.class); private static final Log LOG = PlatformUtil.getLog(SendPoiBottomSheetFragment.class);
public static final String OPENSTREETMAP_POINT = "openstreetmap_point";
private OsmPoint[] poi; private OsmPoint[] poi;
private SwitchCompat closeChangeSet; private SwitchCompat closeChangeSet;

View file

@ -40,7 +40,6 @@ public class OsmOAuthHelper {
} }
private void updateUserName() { private void updateUserName() {
if (app != null) {
String userName = ""; String userName = "";
try { try {
userName = authorizationAdapter.getUserName(); userName = authorizationAdapter.getUserName();
@ -55,7 +54,6 @@ public class OsmOAuthHelper {
} }
app.getSettings().USER_DISPLAY_NAME.set(userName); app.getSettings().USER_DISPLAY_NAME.set(userName);
} }
}
public interface OsmAuthorizationListener { public interface OsmAuthorizationListener {
void authorizationCompleted(); void authorizationCompleted();