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_marginBottom="@dimen/content_padding"
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:paddingRight="@dimen/content_padding_small"
android:textColor="?android:textColorPrimary"

View file

@ -3942,7 +3942,6 @@
<string name="subscription_on_hold_title">اشتراك OsmAnd Live معلق</string>
<string name="login_open_street_map">تسجيل الدخول إلى خريطة الشارع المفتوح</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">تحتاج إلى تسجيل الدخول لرفع التغييرات الجديدة أو المعدلة.
\n
\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_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="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_org">Ingresar a OpenStreetMap.org</string>
<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_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="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="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.

View file

@ -3932,7 +3932,6 @@
<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_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="use_login_password">Utiliser un identifiant et un mot de passe</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="login_open_street_map">כניסה ל־OpenStreetMap</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="login_account">חשבון</string>
<string name="user_login">כניסה</string>

View file

@ -3961,7 +3961,7 @@
<string name="user_login">Login</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="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.
\n
\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="login_open_street_map">Entrar para OpenStreetMap</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.
\n
\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>
<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="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="login_account">Conta</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="login_open_street_map">OpenStreetMap\'te 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.
\n
\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="login_open_street_map">Увійти до 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">Увійдіть, щоб вивантажити нові або внесені зміни.
\n
\nВи можете увійти, за допомогою безпечного методу OAuth, або скористатися своїм ім\'ям та паролем.</string>

View file

@ -3950,7 +3950,6 @@
<string name="subscription_on_hold_title">OsmAnd Live 訂閱已暫停</string>
<string name="login_open_street_map">登入到 OpenStreetMap</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">您必須登入以上傳新的或修正過的變更。
\n
\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_edit_comment_note">Comment 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_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>

View file

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

View file

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

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,
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) {
activity.getContextMenu().close();
BugBottomSheetDialog.showInstance(activity.getSupportFragmentManager(), getOsmbugsUtil(bug), local, text,
titleTextId, posButtonTextId, action, bug, point, getHandleBugListener());
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 {
((EditText) view.findViewById(R.id.user_name_field)).setText(getUserName());
((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();
authorizationAdapter.resetToken();
authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
} else {
settings.USER_NAME.resetToDefault();
settings.USER_PASSWORD.resetToDefault();
@ -196,7 +195,6 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
@Override
public void authorizationCompleted() {
authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
updateAllSettings();
}
}

View file

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

View file

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

View file

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

View file

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