diff --git a/OsmAnd-telegram/res/layout/login_dialog.xml b/OsmAnd-telegram/res/layout/login_dialog.xml index c1d34e8b57..c102c53312 100644 --- a/OsmAnd-telegram/res/layout/login_dialog.xml +++ b/OsmAnd-telegram/res/layout/login_dialog.xml @@ -352,6 +352,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Мы используем Telegram (messaging app), чтобы соединять людей и чтобы вам было проще общаться с ними. + Telegram открытая платформа и OsmAnd Tracker является одним из клиентов. Ваши контакты могут использовать любой другой Telegram client. + Нажимая продолжить, вы соглашаетесь с Telegram Privacy Policy и OsmAnd Privacy Policy. Включите мониторинг, для сбора данных о перемещении в фоновом режиме. Последнее обновление в Telegram Имя устройства diff --git a/OsmAnd-telegram/res/values/colors.xml b/OsmAnd-telegram/res/values/colors.xml index a7ecf7ec06..b4752ded07 100644 --- a/OsmAnd-telegram/res/values/colors.xml +++ b/OsmAnd-telegram/res/values/colors.xml @@ -41,4 +41,6 @@ #ee5622 #78cc5c + #5959FF + diff --git a/OsmAnd-telegram/res/values/strings.xml b/OsmAnd-telegram/res/values/strings.xml index f5c0e0de4d..e55a47fba0 100644 --- a/OsmAnd-telegram/res/values/strings.xml +++ b/OsmAnd-telegram/res/values/strings.xml @@ -1,4 +1,12 @@ + Telegram + We use a Telegram (messaging app) to connect people and make it easier for you to communicate with them. + Telegram open platform and OsmAnd Tracker is one of the customers. Your contacts can use any other Telegram client. + By clicking continue you agree to the Telegram Privacy Policy and the OsmAnd Privacy Policy. + Accept + Telegram Privacy Policy + OsmAnd Privacy Policy + How it works Received GPX points: %1$s Appearance Show GPS points diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/LoginDialogFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/LoginDialogFragment.kt index d60b0a1cfa..72ef7bc5af 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/LoginDialogFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/LoginDialogFragment.kt @@ -2,17 +2,18 @@ package net.osmand.telegram.ui import android.app.Dialog import android.content.DialogInterface +import android.content.Intent import android.graphics.Rect +import android.net.Uri import android.os.Build import android.os.Bundle import android.support.annotation.StringRes import android.support.v4.app.FragmentManager import android.support.v4.content.ContextCompat import android.support.v7.widget.AppCompatImageView -import android.text.Editable -import android.text.Html -import android.text.TextUtils -import android.text.TextWatcher +import android.text.* +import android.text.style.ForegroundColorSpan +import android.text.style.StyleSpan import android.util.TypedValue import android.view.LayoutInflater import android.view.View @@ -39,7 +40,10 @@ class LoginDialogFragment : BaseDialogFragment() { private const val LOGIN_DIALOG_TYPE_PARAM_KEY = "login_dialog_type_param" private const val SHOW_PROGRESS_PARAM_KEY = "show_progress_param" private const val SHOW_WELCOME_DIALOG_PARAM_KEY = "show_welcome_dialog_param" + private const val PRIVACY_POLICY_AGREED_PARAM_KEY = "privacy_policy_agreed_param" private const val TELEGRAM_PACKAGE = "org.telegram.messenger" + private const val TELEGRAM_PRIVACY_POLICY = "https://telegram.org/privacy" + private const val OSMAND_PRIVACY_POLICY = "https://osmand.net/help-online/privacy-policy" private const val SOFT_KEYBOARD_MIN_DETECTION_SIZE = 0.15 var welcomeDialogShown = false @@ -52,7 +56,7 @@ class LoginDialogFragment : BaseDialogFragment() { showDialog(fragmentManager, welcomeDialog = true) } - fun showDialog(fragmentManager: FragmentManager, loginDialogType: LoginDialogType? = null, welcomeDialog: Boolean = false) { + fun showDialog(fragmentManager: FragmentManager, loginDialogType: LoginDialogType? = null, welcomeDialog: Boolean = false, privacyPolicyAgreed: Boolean = false) { try { /* @@ -70,6 +74,7 @@ class LoginDialogFragment : BaseDialogFragment() { args.putString(LOGIN_DIALOG_TYPE_PARAM_KEY, loginDialogType.name) } args.putBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, welcomeDialog) + args.putBoolean(PRIVACY_POLICY_AGREED_PARAM_KEY, privacyPolicyAgreed) fragment.arguments = args fragment.show(fragmentManager, TAG) } else { @@ -98,6 +103,7 @@ class LoginDialogFragment : BaseDialogFragment() { private var loginDialogActiveType: LoginDialogType? = null private var showWelcomeDialog = false + private var privacyPolicyAgreed = false private var showProgress = false private var dismissedManually = false private lateinit var continueButton: Button @@ -112,7 +118,8 @@ class LoginDialogFragment : BaseDialogFragment() { ENTER_PASSWORD(R.id.enter_password_layout, R.id.password_edit_text, R.string.enter_password, R.string.password_descr, R.string.enter_password), GET_TELEGRAM(R.id.get_telegram_layout, 0, - R.string.get_telegram_title, R.string.get_telegram_account_first, 0); + R.string.get_telegram_title, R.string.get_telegram_account_first, 0), + PRIVACY_POLICY(R.id.privacy_policy_layout, 0, R.string.how_it_works, R.string.privacy_policy_use_telegram, 0); } override fun onCreate(savedInstanceState: Bundle?) { @@ -129,6 +136,7 @@ class LoginDialogFragment : BaseDialogFragment() { } showProgress = args.getBoolean(SHOW_PROGRESS_PARAM_KEY, false) showWelcomeDialog = args.getBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, false) + privacyPolicyAgreed = args.getBoolean(PRIVACY_POLICY_AGREED_PARAM_KEY, false) } val view = inflater.inflate(R.layout.login_dialog, container) continueButton = view.findViewById(R.id.continue_button) @@ -151,12 +159,13 @@ class LoginDialogFragment : BaseDialogFragment() { return view } - private fun transformContinueButton(expanded: Boolean) { + private fun transformContinueButton(expanded: Boolean, acceptMode: Boolean = false) { val params = continueButton.layoutParams as ViewGroup.MarginLayoutParams - val margin = if (expanded) 16f else 40f + val bottomMargin = if (expanded || acceptMode) 16f else 40f val width = if (expanded) ViewGroup.LayoutParams.MATCH_PARENT else ViewGroup.LayoutParams.WRAP_CONTENT params.apply { - setMargins(leftMargin, topMargin, rightMargin, AndroidUtils.dpToPx(context!!, margin)) + val horizontalMargin = app.resources.getDimensionPixelSize(if (acceptMode) R.dimen.dialog_welcome_padding_horizontal else R.dimen.content_padding_half) + setMargins(horizontalMargin, topMargin, horizontalMargin, AndroidUtils.dpToPx(context!!, bottomMargin)) this.width = width } continueButton.requestLayout() @@ -197,7 +206,10 @@ class LoginDialogFragment : BaseDialogFragment() { val continueButton = view?.findViewById