conflict in string resolved
This commit is contained in:
commit
54c16efcb0
33 changed files with 1189 additions and 213 deletions
6
OsmAnd/res/drawable/layout_bg.xml
Normal file
6
OsmAnd/res/drawable/layout_bg.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke android:width="1dp" android:color="#CCCCCC" />
|
||||||
|
<corners android:radius="6dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
6
OsmAnd/res/drawable/layout_bg_dark.xml
Normal file
6
OsmAnd/res/drawable/layout_bg_dark.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke android:width="1dp" android:color="#2F3030" />
|
||||||
|
<corners android:radius="6dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
6
OsmAnd/res/drawable/layout_bg_dark_solid.xml
Normal file
6
OsmAnd/res/drawable/layout_bg_dark_solid.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#2F3030"/>
|
||||||
|
<corners android:radius="6dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
6
OsmAnd/res/drawable/layout_bg_solid.xml
Normal file
6
OsmAnd/res/drawable/layout_bg_solid.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#F0F0F0"/>
|
||||||
|
<corners android:radius="6dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
169
OsmAnd/res/layout/send_osm_note_fragment.xml
Normal file
169
OsmAnd/res/layout/send_osm_note_fragment.xml
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="@dimen/content_padding"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingEnd="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/note_hint"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
|
||||||
|
android:hint="@string/osn_bug_name">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/note_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionDone" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/upload_anonymously_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding_small"
|
||||||
|
android:paddingBottom="@dimen/content_padding_small"
|
||||||
|
android:paddingTop="@dimen/content_padding_small"
|
||||||
|
android:paddingLeft="@dimen/content_padding_small"
|
||||||
|
android:paddingRight="@dimen/content_padding_small"
|
||||||
|
android:text="@string/upload_anonymously"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
|
osmand:typeface="@string/font_roboto_regular" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/account_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="@dimen/text_margin_small"
|
||||||
|
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/content_padding_half"
|
||||||
|
android:minHeight="@dimen/context_menu_buttons_bottom_height">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@android:id/icon"
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
|
osmand:srcCompat="@drawable/ic_action_user_account"
|
||||||
|
android:tint="@color/active_buttons_and_links_text_disabled_light"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
|
android:layout_marginStart="@dimen/content_padding" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:paddingStart="@dimen/content_padding"
|
||||||
|
android:paddingEnd="@dimen/content_padding">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/account_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/login_account"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_regular" />
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/user_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
|
android:maxLines="4"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_regular" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/sign_in_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="@dimen/text_margin_small"
|
||||||
|
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:paddingTop="@dimen/content_padding_small"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingStart="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:paddingEnd="@dimen/content_padding"
|
||||||
|
android:paddingBottom="@dimen/content_padding_small"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
|
android:text="@string/osm_login_descr" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/sign_in_button"
|
||||||
|
layout="@layout/bottom_sheet_dialog_button"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding_half"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dialog_button_height" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/login_button"
|
||||||
|
layout="@layout/bottom_sheet_dialog_button"
|
||||||
|
android:layout_marginTop="@dimen/content_padding_small"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dialog_button_height" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
123
OsmAnd/res/layout/send_poi_fragment.xml
Normal file
123
OsmAnd/res/layout/send_poi_fragment.xml
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="@dimen/content_padding"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingTop="@dimen/bottom_sheet_content_margin"
|
||||||
|
android:paddingEnd="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:text="@string/upload_poi"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
android:letterSpacing="@dimen/text_button_letter_spacing"/>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/message_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
|
||||||
|
android:hint="@string/shared_string_message">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/message_field"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionDone" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/close_change_set_checkbox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding"
|
||||||
|
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||||
|
android:text="@string/close_changeset"
|
||||||
|
android:paddingLeft="@dimen/content_padding_small"
|
||||||
|
android:paddingRight="@dimen/content_padding_small"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
|
android:letterSpacing="@dimen/text_button_letter_spacing" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/account_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="@dimen/context_menu_buttons_bottom_height"
|
||||||
|
tools:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@android:id/icon"
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
|
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
|
||||||
|
android:layout_marginRight="@dimen/bottom_sheet_icon_margin_large"
|
||||||
|
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin"
|
||||||
|
osmand:srcCompat="@drawable/ic_action_user_account"
|
||||||
|
android:tint="@color/active_buttons_and_links_text_disabled_light"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
|
android:layout_marginStart="@dimen/content_padding" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:paddingStart="@dimen/content_padding"
|
||||||
|
android:paddingEnd="@dimen/content_padding">
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/account_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
|
android:text="@string/login_account"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_regular" />
|
||||||
|
|
||||||
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
android:id="@+id/user_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
|
android:maxLines="4"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_regular" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/name_edit_text"
|
android:id="@+id/name_edit_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
<string name="register_on_openplacereviews_desc">Photos are provided by open data project OpenPlaceReviews.org. In order to upload your photos you need to sign up on website.</string>
|
<string name="register_on_openplacereviews_desc">Photos are provided by open data project OpenPlaceReviews.org. In order to upload your photos you need to sign up on website.</string>
|
||||||
<string name="register_on_openplacereviews">Register on\nOpenPlaceReviews.org</string>
|
<string name="register_on_openplacereviews">Register on\nOpenPlaceReviews.org</string>
|
||||||
<string name="shared_string_add_photo">Add photo</string>
|
<string name="shared_string_add_photo">Add photo</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_close_note">Close OSM Note</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>
|
||||||
|
|
|
@ -44,6 +44,7 @@ import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
||||||
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
|
import net.osmand.plus.osmedit.oauth.OsmOAuthHelper;
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.quickaction.QuickActionRegistry;
|
import net.osmand.plus.quickaction.QuickActionRegistry;
|
||||||
import net.osmand.plus.render.MapRenderRepositories;
|
import net.osmand.plus.render.MapRenderRepositories;
|
||||||
|
@ -455,7 +456,7 @@ public class AppInitializer implements IProgress {
|
||||||
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
|
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
|
||||||
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
|
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
|
||||||
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
|
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
|
||||||
app.mapViewTrackingUtilities = startupInit(new MapViewTrackingUtilities(app), MapViewTrackingUtilities.class);
|
app.mapViewTrackingUtilities = startupInit(new MapViewTrackingUtilities(app), MapViewTrackingUtilities.class);
|
||||||
app.travelDbHelper = new TravelDbHelper(app);
|
app.travelDbHelper = new TravelDbHelper(app);
|
||||||
if (app.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
|
if (app.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
|
||||||
app.travelDbHelper.initTravelBooks();
|
app.travelDbHelper.initTravelBooks();
|
||||||
|
@ -464,7 +465,7 @@ public class AppInitializer implements IProgress {
|
||||||
app.lockHelper = startupInit(new LockHelper(app), LockHelper.class);
|
app.lockHelper = startupInit(new LockHelper(app), LockHelper.class);
|
||||||
app.settingsHelper = startupInit(new SettingsHelper(app), SettingsHelper.class);
|
app.settingsHelper = startupInit(new SettingsHelper(app), SettingsHelper.class);
|
||||||
app.quickActionRegistry = startupInit(new QuickActionRegistry(app.getSettings()), QuickActionRegistry.class);
|
app.quickActionRegistry = startupInit(new QuickActionRegistry(app.getSettings()), QuickActionRegistry.class);
|
||||||
|
app.osmOAuthHelper = startupInit(new OsmOAuthHelper(app), OsmOAuthHelper.class);
|
||||||
|
|
||||||
initOpeningHoursParser();
|
initOpeningHoursParser();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.access.AccessibilityMode;
|
import net.osmand.plus.access.AccessibilityMode;
|
||||||
import net.osmand.plus.helpers.DayNightHelper;
|
|
||||||
import net.osmand.plus.activities.ExitActivity;
|
import net.osmand.plus.activities.ExitActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
@ -57,14 +56,16 @@ import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
import net.osmand.plus.download.DownloadService;
|
import net.osmand.plus.download.DownloadService;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||||
import net.osmand.plus.helpers.enums.DrivingRegion;
|
import net.osmand.plus.helpers.DayNightHelper;
|
||||||
import net.osmand.plus.helpers.LockHelper;
|
import net.osmand.plus.helpers.LockHelper;
|
||||||
import net.osmand.plus.helpers.enums.MetricsConstants;
|
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersHelper;
|
||||||
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
||||||
|
import net.osmand.plus.osmedit.oauth.OsmOAuthHelper;
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.quickaction.QuickActionRegistry;
|
import net.osmand.plus.quickaction.QuickActionRegistry;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
|
@ -154,6 +155,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
SettingsHelper settingsHelper;
|
SettingsHelper settingsHelper;
|
||||||
GpxDbHelper gpxDbHelper;
|
GpxDbHelper gpxDbHelper;
|
||||||
QuickActionRegistry quickActionRegistry;
|
QuickActionRegistry quickActionRegistry;
|
||||||
|
OsmOAuthHelper osmOAuthHelper;
|
||||||
|
|
||||||
private Resources localizedResources;
|
private Resources localizedResources;
|
||||||
private Map<String, Builder> customRoutingConfigs = new ConcurrentHashMap<>();
|
private Map<String, Builder> customRoutingConfigs = new ConcurrentHashMap<>();
|
||||||
|
@ -366,8 +368,12 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
return settingsHelper;
|
return settingsHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OsmOAuthHelper getOsmOAuthHelper() {
|
||||||
|
return osmOAuthHelper;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized DownloadIndexesThread getDownloadThread() {
|
public synchronized DownloadIndexesThread getDownloadThread() {
|
||||||
if(downloadIndexesThread == null) {
|
if (downloadIndexesThread == null) {
|
||||||
downloadIndexesThread = new DownloadIndexesThread(this);
|
downloadIndexesThread = new DownloadIndexesThread(this);
|
||||||
}
|
}
|
||||||
return downloadIndexesThread;
|
return downloadIndexesThread;
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.AndroidNetworkUtils;
|
import net.osmand.AndroidNetworkUtils;
|
||||||
import net.osmand.CallbackWithObject;
|
import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
|
@ -19,7 +21,6 @@ import net.osmand.plus.activities.PluginsFragment;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
||||||
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
|
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
|
||||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment;
|
import net.osmand.plus.search.QuickSearchDialogFragment;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
@ -35,6 +36,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.*;
|
||||||
|
|
||||||
public class IntentHelper {
|
public class IntentHelper {
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(IntentHelper.class);
|
private static final Log LOG = PlatformUtil.getLog(IntentHelper.class);
|
||||||
|
@ -293,13 +296,15 @@ public class IntentHelper {
|
||||||
if (intent != null && intent.getData() != null) {
|
if (intent != null && intent.getData() != null) {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
if (uri.toString().startsWith("osmand-oauth")) {
|
if (uri.toString().startsWith("osmand-oauth")) {
|
||||||
LoginBottomSheetFragment fragment = mapActivity.getLoginBottomSheetFragment();
|
String oauthVerifier = uri.getQueryParameter("oauth_verifier");
|
||||||
if (fragment != null) {
|
app.getOsmOAuthHelper().authorize(oauthVerifier);
|
||||||
String oauthVerifier = uri.getQueryParameter("oauth_verifier");
|
for (Fragment fragment : mapActivity.getSupportFragmentManager().getFragments()) {
|
||||||
fragment.authorize(oauthVerifier);
|
if (fragment instanceof OsmAuthorizationListener) {
|
||||||
mapActivity.setIntent(null);
|
((OsmAuthorizationListener) fragment).authorizationCompleted();
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
|
mapActivity.setIntent(null);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -18,31 +18,32 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities.DialogButtonType;
|
import net.osmand.plus.UiUtilities.DialogButtonType;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
import net.osmand.plus.osmedit.oauth.OsmOAuthHelper;
|
||||||
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
|
||||||
import net.osmand.plus.settings.bottomsheets.OsmLoginDataBottomSheet;
|
import net.osmand.plus.settings.bottomsheets.OsmLoginDataBottomSheet;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import static net.osmand.plus.osmedit.OsmEditingFragment.OSM_LOGIN_DATA;
|
||||||
import java.util.concurrent.ExecutionException;
|
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.*;
|
||||||
|
|
||||||
public class LoginBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
public class LoginBottomSheetFragment extends MenuBottomSheetDialogFragment implements OsmAuthorizationListener {
|
||||||
|
|
||||||
public static final String TAG = LoginBottomSheetFragment.class.getSimpleName();
|
public static final String TAG = LoginBottomSheetFragment.class.getSimpleName();
|
||||||
private static final Log log = PlatformUtil.getLog(LoginBottomSheetFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(LoginBottomSheetFragment.class);
|
||||||
private static final String OSM_LOGIN_DATA = "osm_login_data";
|
|
||||||
|
|
||||||
private OsmOAuthAuthorizationAdapter authorizationAdapter;
|
private OsmOAuthHelper osmOAuthHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
OsmandApplication app = requiredMyApplication();
|
super.onCreate(savedInstanceState);
|
||||||
authorizationAdapter = new OsmOAuthAuthorizationAdapter(app);
|
OsmandApplication app = requiredMyApplication();
|
||||||
items.add(new SimpleBottomSheetItem.Builder().setLayoutId(R.layout.bottom_sheet_login).create());
|
osmOAuthHelper = app.getOsmOAuthHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
items.add(new SimpleBottomSheetItem.Builder().setLayoutId(R.layout.bottom_sheet_login).create());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getDismissButtonTextId() {
|
protected int getDismissButtonTextId() {
|
||||||
|
@ -88,7 +89,7 @@ public class LoginBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
||||||
protected void onThirdBottomButtonClick() {
|
protected void onThirdBottomButtonClick() {
|
||||||
View view = getView();
|
View view = getView();
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
authorizationAdapter.startOAuth((ViewGroup) view);
|
osmOAuthHelper.startOAuth((ViewGroup) view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,45 +99,19 @@ public class LoginBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment targetFragment) {
|
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment targetFragment) {
|
||||||
if (!fragmentManager.isStateSaved()) {
|
try {
|
||||||
LoginBottomSheetFragment fragment = new LoginBottomSheetFragment();
|
if (!fragmentManager.isStateSaved()) {
|
||||||
fragment.setTargetFragment(targetFragment, 0);
|
LoginBottomSheetFragment fragment = new LoginBottomSheetFragment();
|
||||||
fragment.show(fragmentManager, TAG);
|
fragment.setTargetFragment(targetFragment, 0);
|
||||||
|
fragment.show(fragmentManager, TAG);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
LOG.error("showInstance", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void authorize(String oauthVerifier) {
|
@Override
|
||||||
if (authorizationAdapter != null) {
|
public void authorizationCompleted() {
|
||||||
authorizationAdapter.authorize(oauthVerifier);
|
|
||||||
updateUserName();
|
|
||||||
}
|
|
||||||
Fragment target = getTargetFragment();
|
|
||||||
if (target instanceof OsmAuthorizationListener) {
|
|
||||||
((OsmAuthorizationListener) target).authorizationCompleted();
|
|
||||||
}
|
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUserName() {
|
|
||||||
OsmandApplication app = getMyApplication();
|
|
||||||
if (app != null) {
|
|
||||||
String userName = "";
|
|
||||||
try {
|
|
||||||
userName = authorizationAdapter.getUserName();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error(e);
|
|
||||||
} catch (ExecutionException e) {
|
|
||||||
log.error(e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error(e);
|
|
||||||
} catch (XmlPullParserException e) {
|
|
||||||
log.error(e);
|
|
||||||
}
|
|
||||||
app.getSettings().USER_DISPLAY_NAME.set(userName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface OsmAuthorizationListener {
|
|
||||||
void authorizationCompleted();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
||||||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment.SimpleProgressDialogPoiUploader;
|
import net.osmand.plus.osmedit.dialogs.SendOsmNoteBottomSheetFragment;
|
||||||
|
import net.osmand.plus.osmedit.dialogs.SendPoiBottomSheetFragment;
|
||||||
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
@ -45,16 +46,24 @@ public class EditPOIMenuController extends MenuController {
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
MapActivity activity = getMapActivity();
|
MapActivity activity = getMapActivity();
|
||||||
if (plugin != null && activity != null) {
|
if (plugin != null && activity != null) {
|
||||||
|
OsmPoint point = getOsmPoint();
|
||||||
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);
|
||||||
if (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());
|
||||||
SimpleProgressDialogPoiUploader poiDialogUploader = new SimpleProgressDialogPoiUploader(activity);
|
|
||||||
poiDialogUploader.showProgressDialog(new OsmPoint[] {getOsmPoint()}, false, false);
|
if (point instanceof OpenstreetmapPoint) {
|
||||||
} else {
|
if (isLogged) {
|
||||||
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), null);
|
SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(),
|
||||||
|
new OsmPoint[]{getOsmPoint()});
|
||||||
|
} else {
|
||||||
|
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), null);
|
||||||
|
}
|
||||||
|
} else if (point instanceof OsmNotesPoint) {
|
||||||
|
SendOsmNoteBottomSheetFragment.showInstance(activity.getSupportFragmentManager(),
|
||||||
|
new OsmPoint[]{getOsmPoint()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
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 OpenStreetNote bug;
|
||||||
|
private final OsmNotesPoint point;
|
||||||
|
private final String text;
|
||||||
|
private final Action action;
|
||||||
|
private final HandleBugListener handleBugListener;
|
||||||
|
|
||||||
|
public HandleOsmNoteAsyncTask(@NonNull OsmBugsUtil osmbugsUtil, @NonNull OsmBugsUtil local,
|
||||||
|
@Nullable OpenStreetNote bug, @Nullable OsmNotesPoint point,
|
||||||
|
String text, Action action,
|
||||||
|
@Nullable HandleBugListener handleBugListener) {
|
||||||
|
this.osmbugsUtil = osmbugsUtil;
|
||||||
|
this.local = local;
|
||||||
|
this.bug = bug;
|
||||||
|
this.point = point;
|
||||||
|
this.text = text;
|
||||||
|
this.action = action;
|
||||||
|
this.handleBugListener = handleBugListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected OsmBugResult doInBackground(Void... params) {
|
||||||
|
if (bug != null) {
|
||||||
|
OsmNotesPoint pnt = new OsmNotesPoint();
|
||||||
|
pnt.setId(bug.getId());
|
||||||
|
pnt.setLatitude(bug.getLatitude());
|
||||||
|
pnt.setLongitude(bug.getLongitude());
|
||||||
|
return osmbugsUtil.commit(pnt, text, action);
|
||||||
|
} else if (point != null) {
|
||||||
|
osmbugsUtil = local;
|
||||||
|
return osmbugsUtil.modify(point, text);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPostExecute(OsmBugResult obj) {
|
||||||
|
handleBugListener.onOsmBugHandled(obj, action, bug, point, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HandleBugListener {
|
||||||
|
|
||||||
|
void onOsmBugHandled(OsmBugResult obj, Action action, OpenStreetNote bug,
|
||||||
|
OsmNotesPoint point, String text);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -25,10 +24,10 @@ import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.base.PointImageDrawable;
|
import net.osmand.plus.base.PointImageDrawable;
|
||||||
|
import net.osmand.plus.osmedit.dialogs.BugBottomSheetDialog;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.osmedit.OsmBugsUtil.OsmBugResult;
|
|
||||||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||||
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
@ -47,6 +46,8 @@ import java.net.URLConnection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static net.osmand.plus.osmedit.OsmBugsUtil.*;
|
||||||
|
|
||||||
public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider {
|
public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||||
|
|
||||||
private static final Log log = PlatformUtil.getLog(OsmBugsLayer.class);
|
private static final Log log = PlatformUtil.getLog(OsmBugsLayer.class);
|
||||||
|
@ -67,7 +68,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsmBugsUtil getOsmbugsUtil(OpenStreetNote bug) {
|
public OsmBugsUtil getOsmbugsUtil(OpenStreetNote bug) {
|
||||||
OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
|
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||||
if ((bug != null && bug.isLocal()) || settings.OFFLINE_EDITION.get()
|
if ((bug != null && bug.isLocal()) || settings.OFFLINE_EDITION.get()
|
||||||
|| !settings.isInternetConnectionAvailable(true)) {
|
|| !settings.isInternetConnectionAvailable(true)) {
|
||||||
return local;
|
return local;
|
||||||
|
@ -246,7 +247,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected List<OpenStreetNote> loadingBugs(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude) {
|
protected List<OpenStreetNote> loadingBugs(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude) {
|
||||||
final int deviceApiVersion = android.os.Build.VERSION.SDK_INT;
|
final int deviceApiVersion = android.os.Build.VERSION.SDK_INT;
|
||||||
|
|
||||||
|
@ -311,89 +311,16 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
return bugs;
|
return bugs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void asyncActionTask(final OpenStreetNote bug, final OsmNotesPoint point, final String text, final Action action) {
|
|
||||||
AsyncTask<Void, Void, OsmBugResult> task = new AsyncTask<Void, Void, OsmBugResult>() {
|
|
||||||
private OsmBugsUtil osmbugsUtil;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected OsmBugResult doInBackground(Void... params) {
|
|
||||||
if (bug != null) {
|
|
||||||
osmbugsUtil = getOsmbugsUtil(bug);
|
|
||||||
OsmNotesPoint pnt = new OsmNotesPoint();
|
|
||||||
pnt.setId(bug.getId());
|
|
||||||
pnt.setLatitude(bug.getLatitude());
|
|
||||||
pnt.setLongitude(bug.getLongitude());
|
|
||||||
return osmbugsUtil.commit(pnt, text, action);
|
|
||||||
} else if (point != null) {
|
|
||||||
osmbugsUtil = local;
|
|
||||||
return osmbugsUtil.modify(point, text);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onPostExecute(OsmBugResult obj) {
|
|
||||||
if (activity == null || activity.isFinishing() || activity.isActivityDestroyed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (obj != null && obj.warning == null) {
|
|
||||||
if (local == osmbugsUtil) {
|
|
||||||
Toast.makeText(activity, R.string.osm_changes_added_to_local_edits, Toast.LENGTH_LONG).show();
|
|
||||||
if (obj.local != null) {
|
|
||||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_OSM_BUG, obj.local.getText());
|
|
||||||
activity.getContextMenu().show(new LatLon(obj.local.getLatitude(), obj.local.getLongitude()), pd, obj.local);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (action == Action.REOPEN) {
|
|
||||||
Toast.makeText(activity, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
|
|
||||||
} else if (action == Action.MODIFY) {
|
|
||||||
Toast.makeText(activity, R.string.osb_comment_dialog_success, Toast.LENGTH_LONG).show();
|
|
||||||
} else if (action == Action.DELETE) {
|
|
||||||
Toast.makeText(activity, R.string.osn_close_dialog_success, Toast.LENGTH_LONG).show();
|
|
||||||
} else if (action == Action.CREATE) {
|
|
||||||
Toast.makeText(activity, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
clearCache();
|
|
||||||
} else {
|
|
||||||
int r = R.string.osb_comment_dialog_error;
|
|
||||||
if (action == Action.REOPEN) {
|
|
||||||
r = R.string.osn_add_dialog_error;
|
|
||||||
reopenBug(bug, text);
|
|
||||||
} else if (action == Action.DELETE) {
|
|
||||||
r = R.string.osn_close_dialog_error;
|
|
||||||
closeBug(bug, text);
|
|
||||||
} else if (action == Action.CREATE) {
|
|
||||||
r = R.string.osn_add_dialog_error;
|
|
||||||
openBug(bug.getLatitude(), bug.getLongitude(), text);
|
|
||||||
} else if (action == null) {
|
|
||||||
r = R.string.osn_modify_dialog_error;
|
|
||||||
modifyBug(point);
|
|
||||||
} else {
|
|
||||||
commentBug(bug, text);
|
|
||||||
}
|
|
||||||
Toast.makeText(activity, activity.getResources().getString(r) + "\n" + obj, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
executeTaskInBackground(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void openBug(final double latitude, final double longitude, String message) {
|
|
||||||
OpenStreetNote bug = new OpenStreetNote();
|
|
||||||
bug.setLatitude(latitude);
|
|
||||||
bug.setLongitude(longitude);
|
|
||||||
showBugDialog(bug, Action.CREATE, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openBug(final double latitude, final double longitude, String message, boolean autofill) {
|
public void openBug(final double latitude, final double longitude, String message, boolean autofill) {
|
||||||
OpenStreetNote bug = new OpenStreetNote();
|
OpenStreetNote bug = new OpenStreetNote();
|
||||||
bug.setLatitude(latitude);
|
bug.setLatitude(latitude);
|
||||||
bug.setLongitude(longitude);
|
bug.setLongitude(longitude);
|
||||||
|
if (autofill) {
|
||||||
if (autofill) asyncActionTask(bug, null, message, Action.CREATE);
|
executeTaskInBackground(new HandleOsmNoteAsyncTask(getOsmbugsUtil(bug), local, bug, null, message,
|
||||||
else showBugDialog(bug, Action.CREATE, message);
|
Action.CREATE, getHandleBugListener()));
|
||||||
|
} else {
|
||||||
|
showBugDialog(bug, Action.CREATE, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeBug(final OpenStreetNote bug, String txt) {
|
public void closeBug(final OpenStreetNote bug, String txt) {
|
||||||
|
@ -414,38 +341,45 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
|
|
||||||
private void showBugDialog(final OsmNotesPoint point) {
|
private void showBugDialog(final OsmNotesPoint point) {
|
||||||
String text = point.getText();
|
String text = point.getText();
|
||||||
createBugDialog(true, text, R.string.osn_modify_dialog_title, null, null, point);
|
createBugDialog(true, text, R.string.context_menu_item_modify_note, R.string.osn_modify_dialog_title,
|
||||||
|
null, null, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showBugDialog(final OpenStreetNote bug, final Action action, String text) {
|
private void showBugDialog(final OpenStreetNote bug, final Action action, String text) {
|
||||||
int title;
|
int posButtonTextId;
|
||||||
|
int titleTextId;
|
||||||
if (action == Action.DELETE) {
|
if (action == Action.DELETE) {
|
||||||
title = R.string.osn_close_dialog_title;
|
posButtonTextId = R.string.osn_close_dialog_title;
|
||||||
|
titleTextId = R.string.osm_edit_close_note;
|
||||||
} else if (action == Action.MODIFY) {
|
} else if (action == Action.MODIFY) {
|
||||||
title = R.string.osn_comment_dialog_title;
|
posButtonTextId = R.string.osn_comment_dialog_title;
|
||||||
|
titleTextId = R.string.osm_edit_comment_note;
|
||||||
} else if (action == Action.REOPEN) {
|
} else if (action == Action.REOPEN) {
|
||||||
title = R.string.osn_reopen_dialog_title;
|
posButtonTextId = R.string.osn_reopen_dialog_title;
|
||||||
|
titleTextId = R.string.osn_reopen_dialog_title;
|
||||||
} else {
|
} else {
|
||||||
title = R.string.osn_add_dialog_title;
|
posButtonTextId = R.string.osn_add_dialog_title;
|
||||||
|
titleTextId = R.string.context_menu_item_open_note;
|
||||||
}
|
}
|
||||||
|
|
||||||
OsmBugsUtil util = getOsmbugsUtil(bug);
|
OsmBugsUtil util = getOsmbugsUtil(bug);
|
||||||
final boolean offline = util instanceof OsmBugsLocalUtil;
|
final boolean offline = util instanceof OsmBugsLocalUtil;
|
||||||
|
|
||||||
createBugDialog(offline, text, title, action, bug, null);
|
createBugDialog(offline, text, titleTextId, posButtonTextId, action, bug, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createBugDialog(final boolean offline, String text, int posButtonTitleRes, final Action action, final OpenStreetNote bug, final OsmNotesPoint point) {
|
private void createBugDialog(final boolean offline, String text, int titleTextId, int posButtonTextId,
|
||||||
@SuppressLint("InflateParams")
|
final Action action, final OpenStreetNote bug, final OsmNotesPoint point) {
|
||||||
final View view = LayoutInflater.from(activity).inflate(R.layout.open_bug, null);
|
@SuppressLint("InflateParams") final View view = LayoutInflater.from(activity).inflate(R.layout.open_bug, null);
|
||||||
if (offline) {
|
if (offline) {
|
||||||
view.findViewById(R.id.user_name_field).setVisibility(View.GONE);
|
activity.getContextMenu().close();
|
||||||
view.findViewById(R.id.userNameEditTextLabel).setVisibility(View.GONE);
|
BugBottomSheetDialog.showInstance(activity.getSupportFragmentManager(), getOsmbugsUtil(bug), local, text,
|
||||||
view.findViewById(R.id.password_field).setVisibility(View.GONE);
|
titleTextId, posButtonTextId, action, bug, point, getHandleBugListener());
|
||||||
view.findViewById(R.id.passwordEditTextLabel).setVisibility(View.GONE);
|
return;
|
||||||
} 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(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get());
|
((EditText) view.findViewById(R.id.password_field)).setText(
|
||||||
|
activity.getMyApplication().getSettings().USER_PASSWORD.get());
|
||||||
}
|
}
|
||||||
if (!Algorithms.isEmpty(text)) {
|
if (!Algorithms.isEmpty(text)) {
|
||||||
((EditText) view.findViewById(R.id.message_field)).setText(text);
|
((EditText) view.findViewById(R.id.message_field)).setText(text);
|
||||||
|
@ -456,22 +390,76 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setTitle(R.string.shared_string_commit);
|
builder.setTitle(R.string.shared_string_commit);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.setPositiveButton(posButtonTitleRes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(posButtonTextId, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
String text = offline ? getMessageText(view) : getTextAndUpdateUserPwd(view);
|
String text = offline ? getMessageText(view) : getTextAndUpdateUserPwd(view);
|
||||||
activity.getContextMenu().close();
|
activity.getContextMenu().close();
|
||||||
if (bug != null) {
|
handleBug(text, bug, action, point);
|
||||||
asyncActionTask(bug, null, text, action);
|
|
||||||
} else if (point != null) {
|
|
||||||
asyncActionTask(null, point, text, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleBug(String text, OpenStreetNote bug, Action action, OsmNotesPoint point) {
|
||||||
|
if (bug != null || point != null) {
|
||||||
|
executeTaskInBackground(new HandleOsmNoteAsyncTask(getOsmbugsUtil(bug), local, bug, point, text, action,
|
||||||
|
getHandleBugListener()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleOsmNoteAsyncTask.HandleBugListener getHandleBugListener() {
|
||||||
|
return new HandleOsmNoteAsyncTask.HandleBugListener() {
|
||||||
|
@Override
|
||||||
|
public void onOsmBugHandled(OsmBugResult obj, Action action, OpenStreetNote bug,
|
||||||
|
OsmNotesPoint point, String text) {
|
||||||
|
if (activity == null || activity.isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (obj != null && obj.warning == null) {
|
||||||
|
if (local == getOsmbugsUtil(bug)) {
|
||||||
|
Toast.makeText(activity, R.string.osm_changes_added_to_local_edits, Toast.LENGTH_LONG).show();
|
||||||
|
if (obj.local != null) {
|
||||||
|
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_OSM_BUG, obj.local.getText());
|
||||||
|
activity.getContextMenu().show(new LatLon(obj.local.getLatitude(), obj.local.getLongitude()),
|
||||||
|
pd, obj.local);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (action == Action.REOPEN) {
|
||||||
|
Toast.makeText(activity, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
|
||||||
|
} else if (action == Action.MODIFY) {
|
||||||
|
Toast.makeText(activity, R.string.osb_comment_dialog_success, Toast.LENGTH_LONG).show();
|
||||||
|
} else if (action == Action.DELETE) {
|
||||||
|
Toast.makeText(activity, R.string.osn_close_dialog_success, Toast.LENGTH_LONG).show();
|
||||||
|
} else if (action == Action.CREATE) {
|
||||||
|
Toast.makeText(activity, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clearCache();
|
||||||
|
} else {
|
||||||
|
int r = R.string.osb_comment_dialog_error;
|
||||||
|
if (action == Action.REOPEN) {
|
||||||
|
r = R.string.osn_add_dialog_error;
|
||||||
|
reopenBug(bug, text);
|
||||||
|
} else if (action == Action.DELETE) {
|
||||||
|
r = R.string.osn_close_dialog_error;
|
||||||
|
closeBug(bug, text);
|
||||||
|
} else if (action == Action.CREATE) {
|
||||||
|
r = R.string.osn_add_dialog_error;
|
||||||
|
openBug(bug.getLatitude(), bug.getLongitude(), text, false);
|
||||||
|
} else if (action == null) {
|
||||||
|
r = R.string.osn_modify_dialog_error;
|
||||||
|
modifyBug(point);
|
||||||
|
} else {
|
||||||
|
commentBug(bug, text);
|
||||||
|
}
|
||||||
|
Toast.makeText(activity, activity.getResources().getString(r) + "\n" + obj, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private String getUserName() {
|
private String getUserName() {
|
||||||
return ((OsmandApplication) activity.getApplication()).getSettings().USER_NAME.get();
|
return ((OsmandApplication) activity.getApplication()).getSettings().USER_NAME.get();
|
||||||
}
|
}
|
||||||
|
@ -495,8 +483,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PointDescription getObjectName(Object o) {
|
public PointDescription getObjectName(Object o) {
|
||||||
if (o instanceof OpenStreetNote) {
|
if (o instanceof OpenStreetNote) {
|
||||||
|
|
|
@ -19,9 +19,9 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
||||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment.OsmAuthorizationListener;
|
|
||||||
import net.osmand.plus.osmedit.ValidateOsmLoginDetailsTask.ValidateOsmLoginListener;
|
import net.osmand.plus.osmedit.ValidateOsmLoginDetailsTask.ValidateOsmLoginListener;
|
||||||
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
||||||
|
import net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
|
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
|
||||||
|
@ -34,13 +34,14 @@ import org.apache.commons.logging.Log;
|
||||||
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
||||||
import static net.osmand.plus.osmedit.OsmEditingPlugin.OSM_EDIT_TAB;
|
import static net.osmand.plus.osmedit.OsmEditingPlugin.OSM_EDIT_TAB;
|
||||||
|
|
||||||
public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged, ValidateOsmLoginListener, OsmAuthorizationListener {
|
public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged, ValidateOsmLoginListener,
|
||||||
|
OsmAuthorizationListener {
|
||||||
|
|
||||||
private static final Log log = PlatformUtil.getLog(OsmEditingFragment.class);
|
private static final Log log = PlatformUtil.getLog(OsmEditingFragment.class);
|
||||||
|
|
||||||
private static final String OSM_LOGOUT = "osm_logout";
|
private static final String OSM_LOGOUT = "osm_logout";
|
||||||
private static final String OPEN_OSM_EDITS = "open_osm_edits";
|
private static final String OPEN_OSM_EDITS = "open_osm_edits";
|
||||||
private static final String OSM_LOGIN_DATA = "osm_login_data";
|
public static final String OSM_LOGIN_DATA = "osm_login_data";
|
||||||
private static final String OSM_EDITING_INFO = "osm_editing_info";
|
private static final String OSM_EDITING_INFO = "osm_editing_info";
|
||||||
|
|
||||||
private OsmOAuthAuthorizationAdapter authorizationAdapter;
|
private OsmOAuthAuthorizationAdapter authorizationAdapter;
|
||||||
|
@ -48,7 +49,7 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
authorizationAdapter = new OsmOAuthAuthorizationAdapter(app);
|
authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,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 = new OsmOAuthAuthorizationAdapter(app);
|
|
||||||
} else {
|
} else {
|
||||||
settings.USER_NAME.resetToDefault();
|
settings.USER_NAME.resetToDefault();
|
||||||
settings.USER_PASSWORD.resetToDefault();
|
settings.USER_PASSWORD.resetToDefault();
|
||||||
|
@ -195,7 +195,6 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void authorizationCompleted() {
|
public void authorizationCompleted() {
|
||||||
authorizationAdapter = new OsmOAuthAuthorizationAdapter(app);
|
|
||||||
updateAllSettings();
|
updateAllSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -224,7 +224,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
editPoiDialogFragment.show(mapActivity.getSupportFragmentManager(),
|
editPoiDialogFragment.show(mapActivity.getSupportFragmentManager(),
|
||||||
EditPoiDialogFragment.TAG);
|
EditPoiDialogFragment.TAG);
|
||||||
} else if (resId == R.string.context_menu_item_open_note) {
|
} else if (resId == R.string.context_menu_item_open_note) {
|
||||||
openOsmNote(mapActivity, latitude, longitude);
|
openOsmNote(mapActivity, latitude, longitude, "", false);
|
||||||
} else if (resId == R.string.context_menu_item_modify_note) {
|
} else if (resId == R.string.context_menu_item_modify_note) {
|
||||||
modifyOsmNote(mapActivity, (OsmNotesPoint) selectedObj);
|
modifyOsmNote(mapActivity, (OsmNotesPoint) selectedObj);
|
||||||
} else if (resId == R.string.poi_context_menu_modify) {
|
} else if (resId == R.string.poi_context_menu_modify) {
|
||||||
|
@ -295,13 +295,6 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openOsmNote(MapActivity mapActivity, double latitude, double longitude) {
|
|
||||||
if (osmBugsLayer == null) {
|
|
||||||
registerLayers(mapActivity);
|
|
||||||
}
|
|
||||||
osmBugsLayer.openBug(latitude, longitude, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openOsmNote(MapActivity mapActivity, double latitude, double longitude, String message, boolean autofill) {
|
public void openOsmNote(MapActivity mapActivity, double latitude, double longitude, String message, boolean autofill) {
|
||||||
if (osmBugsLayer == null) {
|
if (osmBugsLayer == null) {
|
||||||
registerLayers(mapActivity);
|
registerLayers(mapActivity);
|
||||||
|
|
|
@ -43,6 +43,8 @@ import net.osmand.osm.edit.Node;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
import net.osmand.plus.measurementtool.LoginBottomSheetFragment;
|
||||||
|
import net.osmand.plus.osmedit.dialogs.SendOsmNoteBottomSheetFragment;
|
||||||
|
import net.osmand.plus.osmedit.dialogs.SendPoiBottomSheetFragment;
|
||||||
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -621,28 +623,42 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
public OsmandApplication getMyApplication() {
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uploadItems(final OsmPoint[] items) {
|
private void uploadItems(final OsmPoint[] points) {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
OsmOAuthAuthorizationAdapter authorizationAdapter = new OsmOAuthAuthorizationAdapter(app);
|
OsmOAuthAuthorizationAdapter authorizationAdapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
|
||||||
if (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());
|
||||||
SendPoiDialogFragment.createInstance(items, PoiUploaderType.FRAGMENT)
|
if (hasPoiGroup(points)) {
|
||||||
.show(getChildFragmentManager(), SendPoiDialogFragment.TAG);
|
if (isLogged) {
|
||||||
|
SendPoiBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), points);
|
||||||
|
} else {
|
||||||
|
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), this);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LoginBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), this);
|
SendOsmNoteBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean hasPoiGroup(OsmPoint[] points) {
|
||||||
|
boolean hasPoiGroup = false;
|
||||||
|
for (OsmPoint p : points) {
|
||||||
|
if (p.getGroup() == OsmPoint.Group.POI) {
|
||||||
|
hasPoiGroup = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasPoiGroup;
|
||||||
|
}
|
||||||
|
|
||||||
public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) {
|
public void showProgressDialog(OsmPoint[] points, boolean closeChangeSet, boolean anonymously) {
|
||||||
ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(
|
ProgressDialogFragment dialog = ProgressDialogFragment.createInstance(
|
||||||
R.string.uploading,
|
R.string.uploading,
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
|
import net.osmand.plus.osmedit.HandleOsmNoteAsyncTask;
|
||||||
|
import net.osmand.plus.osmedit.OsmBugsLayer;
|
||||||
|
import net.osmand.plus.osmedit.OsmBugsUtil;
|
||||||
|
import net.osmand.plus.osmedit.OsmNotesPoint;
|
||||||
|
import net.osmand.plus.osmedit.OsmPoint;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
public class BugBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
public static final String TAG = BugBottomSheetDialog.class.getSimpleName();
|
||||||
|
private static final Log LOG = PlatformUtil.getLog(BugBottomSheetDialog.class);
|
||||||
|
|
||||||
|
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
|
||||||
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
if (app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
items.add(new TitleItem(getString(titleTextId)));
|
||||||
|
|
||||||
|
View osmNoteView = View.inflate(UiUtilities.getThemedContext(app, nightMode),
|
||||||
|
R.layout.track_name_edit_text, null);
|
||||||
|
TextInputLayout textBox = osmNoteView.findViewById(R.id.name_text_box);
|
||||||
|
int highlightColorId = nightMode ? R.color.list_background_color_dark : R.color.activity_background_color_light;
|
||||||
|
textBox.setBoxBackgroundColorResource(highlightColorId);
|
||||||
|
textBox.setHint(AndroidUtils.addColon(app, R.string.osn_bug_name));
|
||||||
|
ColorStateList colorStateList = ColorStateList.valueOf(ContextCompat
|
||||||
|
.getColor(app, nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light));
|
||||||
|
textBox.setDefaultHintTextColor(colorStateList);
|
||||||
|
noteText = osmNoteView.findViewById(R.id.name_edit_text);
|
||||||
|
noteText.setText(text);
|
||||||
|
|
||||||
|
BaseBottomSheetItem editOsmNote = new BaseBottomSheetItem.Builder()
|
||||||
|
.setCustomView(osmNoteView)
|
||||||
|
.create();
|
||||||
|
items.add(editOsmNote);
|
||||||
|
|
||||||
|
items.add(new DividerSpaceItem(app, app.getResources().getDimensionPixelSize(R.dimen.content_padding_small)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return posButtonTextId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRightBottomButtonClick() {
|
||||||
|
new HandleOsmNoteAsyncTask(osmBugsUtil, local, bug, point, noteText.getText().toString(), action,
|
||||||
|
handleBugListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getBgColorId() {
|
||||||
|
return nightMode ? R.color.activity_background_color_dark : R.color.list_background_color_light;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInstance(@NonNull FragmentManager fm, OsmBugsUtil osmBugsUtil, OsmBugsUtil local,
|
||||||
|
String text, int titleTextId, int posButtonTextId, final OsmPoint.Action action,
|
||||||
|
final OsmBugsLayer.OpenStreetNote bug, final OsmNotesPoint point,
|
||||||
|
HandleOsmNoteAsyncTask.HandleBugListener handleBugListener) {
|
||||||
|
try {
|
||||||
|
if (!fm.isStateSaved()) {
|
||||||
|
BugBottomSheetDialog fragment = new BugBottomSheetDialog();
|
||||||
|
fragment.setRetainInstance(true);
|
||||||
|
fragment.osmBugsUtil = osmBugsUtil;
|
||||||
|
fragment.local = local;
|
||||||
|
fragment.text = text;
|
||||||
|
fragment.titleTextId = titleTextId;
|
||||||
|
fragment.posButtonTextId = posButtonTextId;
|
||||||
|
fragment.action = action;
|
||||||
|
fragment.bug = bug;
|
||||||
|
fragment.point = point;
|
||||||
|
fragment.handleBugListener = handleBugListener;
|
||||||
|
fragment.show(fm, TAG);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
LOG.error("showInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,201 @@
|
||||||
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities.DialogButtonType;
|
||||||
|
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.osmedit.OsmNotesPoint;
|
||||||
|
import net.osmand.plus.osmedit.OsmPoint;
|
||||||
|
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
|
||||||
|
import net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
import net.osmand.plus.settings.bottomsheets.OsmLoginDataBottomSheet;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import static net.osmand.plus.UiUtilities.setupDialogButton;
|
||||||
|
import static net.osmand.plus.osmedit.OsmEditingFragment.OSM_LOGIN_DATA;
|
||||||
|
import static net.osmand.plus.osmedit.ValidateOsmLoginDetailsTask.*;
|
||||||
|
import static net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment.*;
|
||||||
|
|
||||||
|
public class SendOsmNoteBottomSheetFragment extends MenuBottomSheetDialogFragment implements ValidateOsmLoginListener,
|
||||||
|
OsmAuthorizationListener {
|
||||||
|
|
||||||
|
public static final String TAG = SendOsmNoteBottomSheetFragment.class.getSimpleName();
|
||||||
|
private static final Log LOG = PlatformUtil.getLog(SendOsmNoteBottomSheetFragment.class);
|
||||||
|
private OsmPoint[] poi;
|
||||||
|
|
||||||
|
protected OsmandSettings settings;
|
||||||
|
private TextView accountName;
|
||||||
|
private LinearLayout accountBlockView;
|
||||||
|
private LinearLayout signInView;
|
||||||
|
private SwitchCompat uploadAnonymously;
|
||||||
|
private OsmandApplication app;
|
||||||
|
|
||||||
|
private boolean isLoginOAuth() {
|
||||||
|
return !Algorithms.isEmpty(settings.USER_DISPLAY_NAME.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
app = getMyApplication();
|
||||||
|
if (app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
settings = app.getSettings();
|
||||||
|
poi = (OsmPoint[]) getArguments().getSerializable(OPENSTREETMAP_POINT);
|
||||||
|
|
||||||
|
items.add(new TitleItem(getString(R.string.upload_osm_note)));
|
||||||
|
|
||||||
|
final View sendOsmNoteView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||||
|
R.layout.send_osm_note_fragment, null);
|
||||||
|
|
||||||
|
TextView noteText = sendOsmNoteView.findViewById(R.id.note_text);
|
||||||
|
noteText.setText(((OsmNotesPoint) poi[0]).getText());
|
||||||
|
TextInputLayout noteHint = sendOsmNoteView.findViewById(R.id.note_hint);
|
||||||
|
noteHint.setHint(AndroidUtils.addColon(app, R.string.osn_bug_name));
|
||||||
|
accountBlockView = sendOsmNoteView.findViewById(R.id.account_container);
|
||||||
|
signInView = sendOsmNoteView.findViewById(R.id.sign_in_container);
|
||||||
|
uploadAnonymously = sendOsmNoteView.findViewById(R.id.upload_anonymously_switch);
|
||||||
|
accountName = sendOsmNoteView.findViewById(R.id.user_name);
|
||||||
|
updateAccountName();
|
||||||
|
View signInButton = sendOsmNoteView.findViewById(R.id.sign_in_button);
|
||||||
|
setupButton(signInButton, R.string.sign_in_with_open_street_map, DialogButtonType.PRIMARY,
|
||||||
|
R.drawable.ic_action_openstreetmap_logo);
|
||||||
|
signInButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
OsmandApplication app = requiredMyApplication();
|
||||||
|
app.getOsmOAuthHelper().startOAuth((ViewGroup) v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
View loginButton = sendOsmNoteView.findViewById(R.id.login_button);
|
||||||
|
setupButton(loginButton, R.string.use_login_password, DialogButtonType.SECONDARY, -1);
|
||||||
|
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
FragmentManager fragmentManager = getFragmentManager();
|
||||||
|
if (fragmentManager != null) {
|
||||||
|
OsmLoginDataBottomSheet.showInstance(fragmentManager, OSM_LOGIN_DATA,
|
||||||
|
SendOsmNoteBottomSheetFragment.this, usedOnMap, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateSignIn(uploadAnonymously.isChecked());
|
||||||
|
uploadAnonymously.setBackgroundResource(nightMode ? R.drawable.layout_bg_dark : R.drawable.layout_bg);
|
||||||
|
final int paddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||||
|
uploadAnonymously.setPadding(paddingSmall, 0, paddingSmall, 0);
|
||||||
|
uploadAnonymously.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
updateSignIn(isChecked);
|
||||||
|
if (nightMode) {
|
||||||
|
uploadAnonymously.setBackgroundResource(
|
||||||
|
isChecked ? R.drawable.layout_bg_dark_solid : R.drawable.layout_bg_dark);
|
||||||
|
} else {
|
||||||
|
uploadAnonymously.setBackgroundResource(
|
||||||
|
isChecked ? R.drawable.layout_bg_solid : R.drawable.layout_bg);
|
||||||
|
}
|
||||||
|
uploadAnonymously.setPadding(paddingSmall, 0, paddingSmall, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
final SimpleBottomSheetItem bottomSheetItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder()
|
||||||
|
.setCustomView(sendOsmNoteView)
|
||||||
|
.create();
|
||||||
|
items.add(bottomSheetItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAccountName() {
|
||||||
|
String userNameOAuth = settings.USER_DISPLAY_NAME.get();
|
||||||
|
String userNameOpenID = settings.USER_NAME.get();
|
||||||
|
String userName = isLoginOAuth() ? userNameOAuth : userNameOpenID;
|
||||||
|
accountName.setText(userName);
|
||||||
|
updateSignIn(uploadAnonymously.isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSignIn(boolean isChecked) {
|
||||||
|
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 = app.getUIUtilities().getIcon(drawableId, R.color.popup_text_color);
|
||||||
|
}
|
||||||
|
TextView buttonText = buttonView.findViewById(R.id.button_text);
|
||||||
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(buttonText, icon, null, null, null);
|
||||||
|
setupDialogButton(nightMode, buttonView, buttonType, buttonTextId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInstance(@NonNull FragmentManager fm, @NonNull OsmPoint[] points) {
|
||||||
|
try {
|
||||||
|
if (!fm.isStateSaved()) {
|
||||||
|
SendOsmNoteBottomSheetFragment fragment = new SendOsmNoteBottomSheetFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable(OPENSTREETMAP_POINT, points);
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
fragment.show(fm, TAG);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
LOG.error("showInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DialogButtonType getRightBottomButtonType() {
|
||||||
|
return (DialogButtonType.PRIMARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRightBottomButtonClick() {
|
||||||
|
ProgressDialogPoiUploader progressDialogPoiUploader;
|
||||||
|
progressDialogPoiUploader = new SimpleProgressDialogPoiUploader((MapActivity) getActivity());
|
||||||
|
progressDialogPoiUploader.showProgressDialog(poi, false, uploadAnonymously.isChecked());
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return R.string.shared_string_upload;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void authorizationCompleted() {
|
||||||
|
updateAccountName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loginValidationFinished(String warning) {
|
||||||
|
updateAccountName();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isLogged() {
|
||||||
|
OsmOAuthAuthorizationAdapter adapter = app.getOsmOAuthHelper().getAuthorizationAdapter();
|
||||||
|
return adapter.isValidToken()
|
||||||
|
|| !Algorithms.isEmpty(settings.USER_NAME.get())
|
||||||
|
&& !Algorithms.isEmpty(settings.USER_PASSWORD.get());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,235 @@
|
||||||
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.osm.PoiType;
|
||||||
|
import net.osmand.osm.edit.Entity;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
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.osmedit.OpenstreetmapPoint;
|
||||||
|
import net.osmand.plus.osmedit.OsmPoint;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment.*;
|
||||||
|
|
||||||
|
public class SendPoiBottomSheetFragment extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
public static final String TAG = SendPoiBottomSheetFragment.class.getSimpleName();
|
||||||
|
private static final Log LOG = PlatformUtil.getLog(SendPoiBottomSheetFragment.class);
|
||||||
|
private OsmPoint[] poi;
|
||||||
|
|
||||||
|
private SwitchCompat closeChangeSet;
|
||||||
|
private EditText messageEditText;
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isLoginOAuth(OsmandSettings settings) {
|
||||||
|
return !Algorithms.isEmpty(settings.USER_DISPLAY_NAME.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
if (app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
poi = (OsmPoint[]) getArguments().getSerializable(OPENSTREETMAP_POINT);
|
||||||
|
final boolean isNightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
final View sendOsmPoiView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
||||||
|
R.layout.send_poi_fragment, null);
|
||||||
|
closeChangeSet = sendOsmPoiView.findViewById(R.id.close_change_set_checkbox);
|
||||||
|
messageEditText = sendOsmPoiView.findViewById(R.id.message_field);
|
||||||
|
String defaultChangeSet = createDefaultChangeSet(app);
|
||||||
|
messageEditText.setText(defaultChangeSet);
|
||||||
|
final TextView accountName = sendOsmPoiView.findViewById(R.id.user_name);
|
||||||
|
OsmandSettings settings = app.getSettings();
|
||||||
|
String userNameOAuth = settings.USER_DISPLAY_NAME.get();
|
||||||
|
String userNameOpenID = settings.USER_NAME.get();
|
||||||
|
String userName = isLoginOAuth(settings) ? userNameOAuth : userNameOpenID;
|
||||||
|
accountName.setText(userName);
|
||||||
|
closeChangeSet.setBackgroundResource(isNightMode ? R.drawable.layout_bg_dark : R.drawable.layout_bg);
|
||||||
|
final int paddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||||
|
closeChangeSet.setPadding(paddingSmall, 0, paddingSmall, 0);
|
||||||
|
closeChangeSet.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isNightMode) {
|
||||||
|
closeChangeSet.setBackgroundResource(
|
||||||
|
isChecked ? R.drawable.layout_bg_dark_solid : R.drawable.layout_bg_dark);
|
||||||
|
} else {
|
||||||
|
closeChangeSet.setBackgroundResource(
|
||||||
|
isChecked ? R.drawable.layout_bg_solid : R.drawable.layout_bg);
|
||||||
|
}
|
||||||
|
closeChangeSet.setPadding(paddingSmall, 0, paddingSmall, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
final SimpleBottomSheetItem titleItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder()
|
||||||
|
.setCustomView(sendOsmPoiView)
|
||||||
|
.create();
|
||||||
|
items.add(titleItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInstance(@NonNull FragmentManager fm, @NonNull OsmPoint[] points) {
|
||||||
|
try {
|
||||||
|
if (!fm.isStateSaved()) {
|
||||||
|
SendPoiBottomSheetFragment fragment = new SendPoiBottomSheetFragment();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable(OPENSTREETMAP_POINT, points);
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
fragment.show(fm, TAG);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
LOG.error("showInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected UiUtilities.DialogButtonType getRightBottomButtonType() {
|
||||||
|
return (UiUtilities.DialogButtonType.PRIMARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.showProgressDialog(poi, closeChangeSet.isChecked(), false);
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return R.string.shared_string_upload;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String createDefaultChangeSet(OsmandApplication app) {
|
||||||
|
Map<String, PoiType> allTranslatedSubTypes = app.getPoiTypes().getAllTranslatedNames(true);
|
||||||
|
if (allTranslatedSubTypes == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Map<String, Integer> addGroup = new HashMap<>();
|
||||||
|
Map<String, Integer> editGroup = new HashMap<>();
|
||||||
|
Map<String, Integer> deleteGroup = new HashMap<>();
|
||||||
|
Map<String, Integer> reopenGroup = new HashMap<>();
|
||||||
|
String comment = "";
|
||||||
|
for (OsmPoint p : poi) {
|
||||||
|
if (p.getGroup() == OsmPoint.Group.POI) {
|
||||||
|
OsmPoint.Action action = p.getAction();
|
||||||
|
String type = ((OpenstreetmapPoint) p).getEntity().getTag(Entity.POI_TYPE_TAG);
|
||||||
|
if (type == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PoiType localizedPoiType = allTranslatedSubTypes.get(type.toLowerCase().trim());
|
||||||
|
if (localizedPoiType != null) {
|
||||||
|
type = Algorithms.capitalizeFirstLetter(localizedPoiType.getKeyName().replace('_', ' '));
|
||||||
|
}
|
||||||
|
if (action == OsmPoint.Action.CREATE) {
|
||||||
|
if (!addGroup.containsKey(type)) {
|
||||||
|
addGroup.put(type, 1);
|
||||||
|
} else {
|
||||||
|
addGroup.put(type, addGroup.get(type) + 1);
|
||||||
|
}
|
||||||
|
} else if (action == OsmPoint.Action.MODIFY) {
|
||||||
|
if (!editGroup.containsKey(type)) {
|
||||||
|
editGroup.put(type, 1);
|
||||||
|
} else {
|
||||||
|
editGroup.put(type, editGroup.get(type) + 1);
|
||||||
|
}
|
||||||
|
} else if (action == OsmPoint.Action.DELETE) {
|
||||||
|
if (!deleteGroup.containsKey(type)) {
|
||||||
|
deleteGroup.put(type, 1);
|
||||||
|
} else {
|
||||||
|
deleteGroup.put(type, deleteGroup.get(type) + 1);
|
||||||
|
}
|
||||||
|
} else if (action == OsmPoint.Action.REOPEN) {
|
||||||
|
if (!reopenGroup.containsKey(type)) {
|
||||||
|
reopenGroup.put(type, 1);
|
||||||
|
} else {
|
||||||
|
reopenGroup.put(type, reopenGroup.get(type) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int modifiedItemsOutOfLimit = 0;
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
String action;
|
||||||
|
Map<String, Integer> group;
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
action = getString(R.string.default_changeset_add);
|
||||||
|
group = addGroup;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
action = getString(R.string.default_changeset_edit);
|
||||||
|
group = editGroup;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
action = getString(R.string.default_changeset_delete);
|
||||||
|
group = deleteGroup;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
action = getString(R.string.default_changeset_reopen);
|
||||||
|
group = reopenGroup;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
action = "";
|
||||||
|
group = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!group.isEmpty()) {
|
||||||
|
int pos = 0;
|
||||||
|
for (Map.Entry<String, Integer> entry : group.entrySet()) {
|
||||||
|
String type = entry.getKey();
|
||||||
|
int quantity = entry.getValue();
|
||||||
|
if (comment.length() > 200) {
|
||||||
|
modifiedItemsOutOfLimit += quantity;
|
||||||
|
} else {
|
||||||
|
if (pos == 0) {
|
||||||
|
comment = comment.concat(comment.length() == 0 ? "" : "; ").concat(action).concat(" ")
|
||||||
|
.concat(quantity == 1 ? "" : quantity + " ").concat(type);
|
||||||
|
} else {
|
||||||
|
comment = comment.concat(", ").concat(quantity == 1 ? "" : quantity + " ").concat(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modifiedItemsOutOfLimit != 0) {
|
||||||
|
comment = comment.concat("; ").concat(modifiedItemsOutOfLimit + " ")
|
||||||
|
.concat(getString(R.string.items_modified)).concat(".");
|
||||||
|
} else if (!comment.equals("")) {
|
||||||
|
comment = comment.concat(".");
|
||||||
|
}
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
61
OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java
Normal file
61
OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthHelper.java
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
package net.osmand.plus.osmedit.oauth;
|
||||||
|
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public class OsmOAuthHelper {
|
||||||
|
|
||||||
|
private static final Log log = PlatformUtil.getLog(OsmOAuthHelper.class);
|
||||||
|
|
||||||
|
private final OsmandApplication app;
|
||||||
|
|
||||||
|
private final OsmOAuthAuthorizationAdapter authorizationAdapter;
|
||||||
|
|
||||||
|
public OsmOAuthHelper(@NonNull OsmandApplication app) {
|
||||||
|
this.app = app;
|
||||||
|
authorizationAdapter = new OsmOAuthAuthorizationAdapter(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startOAuth(ViewGroup view) {
|
||||||
|
authorizationAdapter.startOAuth(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void authorize(String oauthVerifier) {
|
||||||
|
authorizationAdapter.authorize(oauthVerifier);
|
||||||
|
updateUserName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OsmOAuthAuthorizationAdapter getAuthorizationAdapter() {
|
||||||
|
return authorizationAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUserName() {
|
||||||
|
String userName = "";
|
||||||
|
try {
|
||||||
|
userName = authorizationAdapter.getUserName();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error(e);
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
log.error(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e);
|
||||||
|
} catch (XmlPullParserException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
app.getSettings().USER_DISPLAY_NAME.set(userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OsmAuthorizationListener {
|
||||||
|
void authorizationCompleted();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue