\ No newline at end of file
diff --git a/OsmAnd-telegram/res/values/attrs.xml b/OsmAnd-telegram/res/values/attrs.xml
index 7bbaffc998..8eb8a22285 100644
--- a/OsmAnd-telegram/res/values/attrs.xml
+++ b/OsmAnd-telegram/res/values/attrs.xml
@@ -3,5 +3,7 @@
+
+
\ No newline at end of file
diff --git a/OsmAnd-telegram/res/values/colors.xml b/OsmAnd-telegram/res/values/colors.xml
index 90dde03d70..48222a3ade 100644
--- a/OsmAnd-telegram/res/values/colors.xml
+++ b/OsmAnd-telegram/res/values/colors.xml
@@ -1,16 +1,31 @@
- #3F51B5
- #303F9F
- #FF4081
+ #fff
- #fff
- #333b40
- #ccc
- #ff4f4f4f
+ #fff
+ #222526
- #ff8f00
+ #727272
+ #727272
- #2f7af5
+ #ff8f00
+
+ #237bff
+ #d28521
+
+ #f0f0f0
+ #17191a
+
+ #212121
+ #cccccc
+
+ #727272
+ #727272
+
+ #b3b3b3
+ #4d4d4d
+
+ #f0f0f0
+ #2d3133
diff --git a/OsmAnd-telegram/res/values/dimens.xml b/OsmAnd-telegram/res/values/dimens.xml
index b28658b4cb..24378ab076 100644
--- a/OsmAnd-telegram/res/values/dimens.xml
+++ b/OsmAnd-telegram/res/values/dimens.xml
@@ -1,10 +1,17 @@
- 8dp
- 16dp
- 32dp
- 22sp
- 24dp
- 48dp
- 48dp
+ 8dp
+ 16dp
+ 32dp
+ 22sp
+ 24dp
+ 60dp
+ 44dp
+ 48dp
+ 36dp
+ 2dp
+ 18sp
+ 16sp
+ 60dp
+
\ No newline at end of file
diff --git a/OsmAnd-telegram/res/values/strings.xml b/OsmAnd-telegram/res/values/strings.xml
index 87e368618c..3133c46467 100644
--- a/OsmAnd-telegram/res/values/strings.xml
+++ b/OsmAnd-telegram/res/values/strings.xml
@@ -1,64 +1,75 @@
- OsmAnd Telegram
- Phone number in the international format
- Password
- Authentication code
- Login to telegram
- Login
- Logout
- You are not logged in
- Initialization
- Logging out
- Closing
- Continue
- Cancel
- Location service not enabled. Turn it on?
- Settings
- App has no permission to access location data.
- Please enable GPS in the settings
- The share location service requires a location provider to be turned on.
- Background mode
- OsmAnd Telegram runs in the background with the screen off.
- Distance
- Share location
- Sharing location
- Paused
- No data
- Pause
- Start
- Stop
- OsmAnd Telegram service
- OsmAnd logo
- You need to install free or paid version of OsmAnd first
- Install OsmAnd
- Show users on map
- Active chats
+ OsmAnd Telegram
+ Phone number
+ Phone number in the international format
+ Password
+ Enter code
+ Authentication code
+ You have been sent a code by Telegram. It will be used by OsmAnd to login into your account.
+ Enter password
+ Please enter your Telegram account\'s password to finish authorization
+ Login
+ Logout
+ You are not logged in
+ Initialization
+ Logging out
+ Closing
+ Continue
+ Cancel
+ Location service not enabled. Turn it on?
+ Settings
+ App has no permission to access location data.
+ Please enable GPS in the settings
+ The share location service requires a location provider to be turned on.
+ Background mode
+ OsmAnd Telegram runs in the background with the screen off.
+ Distance
+ Share location
+ Sharing location
+ Paused
+ No data
+ Pause
+ Start
+ Stop
+ OsmAnd Telegram service
+ OsmAnd logo
+ You need to install free or paid version of OsmAnd first
+ Install OsmAnd
+ Show users on map
+ Active chats
+ Authorization
+ Please enter the phone number of your Telegram account in the international format
+ Welcome
- yd
- ft
- mi
- km
- m
- nmi
- min/m
- min/km
- nmi/h
- m/s
- km/h
- mph
- Kilometers per hour
- Miles per hour
- Meters per second
- Minutes per kilometer
- Minutes per mile
- Nautical miles per hour (knot)
- Miles/feet
- Miles/yards
- Kilometers/meters
- Nautical miles
- Miles/meters
- h
- min
+ yd
+ ft
+ mi
+ km
+ m
+ nmi
+ min/m
+ min/km
+ nmi/h
+ m/s
+ km/h
+ mph
+ Kilometers per hour
+ Miles per hour
+ Meters per second
+ Minutes per kilometer
+ Minutes per mile
+ Nautical miles per hour (knot)
+ Miles/feet
+ Miles/yards
+ Kilometers/meters
+ Nautical miles
+ Miles/meters
+ h
+ min
+ +
+ OsmAnd Location Sharing allows you to share your location and see locations of other people in the OsmAnd.
The application works on base of Telegram API. To use this app you must have a Telegram account.]]>
+ My location
+ Live now
diff --git a/OsmAnd-telegram/res/values/styles.xml b/OsmAnd-telegram/res/values/styles.xml
index 90b91cd756..95b9dc5850 100644
--- a/OsmAnd-telegram/res/values/styles.xml
+++ b/OsmAnd-telegram/res/values/styles.xml
@@ -1,19 +1,55 @@
-
-
+ @color/ctrl_active_color_light
+ @color/bg_color_light
+ @color/ctrl_active_color_light
+ @color/primary_text_color_light
+ @color/secondary_text_color_light
+ @color/description_text_color_light
-
+ @color/bg_color_light
+ @color/icon_color_light
+ @color/ctrl_active_color_light
+ @color/ctrl_color_light
+
+
+
+
+
+
+
diff --git a/OsmAnd-telegram/src/net/osmand/telegram/LoginDialogFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/LoginDialogFragment.kt
index 41abbe5289..4042c1f05a 100644
--- a/OsmAnd-telegram/src/net/osmand/telegram/LoginDialogFragment.kt
+++ b/OsmAnd-telegram/src/net/osmand/telegram/LoginDialogFragment.kt
@@ -1,18 +1,25 @@
package net.osmand.telegram
+import android.app.Dialog
import android.content.DialogInterface
+import android.os.Build
import android.os.Bundle
+import android.support.annotation.StringRes
import android.support.v4.app.DialogFragment
import android.support.v4.app.FragmentManager
+import android.support.v7.widget.AppCompatImageView
+import android.text.Html
+import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.view.inputmethod.EditorInfo
import android.widget.Button
-import android.widget.EditText
-import net.osmand.telegram.utils.AndroidUtils
+import android.widget.TextView
import net.osmand.PlatformUtil
+import net.osmand.telegram.utils.AndroidUtils
+import studio.carbonylgroup.textfieldboxes.ExtendedEditText
class LoginDialogFragment : DialogFragment() {
@@ -22,24 +29,44 @@ class LoginDialogFragment : DialogFragment() {
private const val TAG = "LoginDialogFragment"
private val LOG = PlatformUtil.getLog(LoginDialogFragment::class.java)
- private const val ENTER_PHONE_NUMBER_PARAM_KEY: String = "enter_phone_number_param_key"
- private const val ENTER_CODE_PARAM_KEY = "enter_code_param_key"
- private const val ENTER_PASSWORD_PARAM_KEY = "enter_password_param_key"
- private const val SHOW_PROGRESS_PARAM_KEY = "show_progress_param_key"
+ 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"
- fun showDialog(fragmentManager: FragmentManager, vararg loginDialogType: LoginDialogType) {
+ var welcomeDialogShown = false
+ private set
+
+ fun showWelcomeDialog(fragmentManager: FragmentManager) {
+ welcomeDialogShown = true
+ showDialog(fragmentManager, welcomeDialog = true)
+ }
+
+ fun showDialog(fragmentManager: FragmentManager, loginDialogType: LoginDialogType? = null, welcomeDialog: Boolean = false) {
try {
+
+ /*
+ mapActivity.getSupportFragmentManager().beginTransaction()
+ .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
+ .add(R.id.fragmentContainer, fragment, TAG)
+ .addToBackStack(TAG).commitAllowingStateLoss()
+ */
+
var fragment = getFragment(fragmentManager)
if (fragment == null) {
fragment = LoginDialogFragment()
val args = Bundle()
- for (t in loginDialogType) {
- args.putBoolean(t.paramKey, true)
+ if (loginDialogType != null) {
+ args.putString(LOGIN_DIALOG_TYPE_PARAM_KEY, loginDialogType.name)
}
+ args.putBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, welcomeDialog)
fragment.arguments = args
fragment.show(fragmentManager, TAG)
} else {
- fragment.updateDialog(*loginDialogType)
+ var showWelcomeDialog = welcomeDialog
+ if (fragment.showWelcomeDialog) {
+ showWelcomeDialog = fragment.showWelcomeDialog
+ }
+ fragment.updateDialog(loginDialogType, showWelcomeDialog)
}
} catch (e: RuntimeException) {
LOG.error(e)
@@ -57,15 +84,20 @@ class LoginDialogFragment : DialogFragment() {
}
}
- private var loginDialogActiveTypes: Set? = null
+ private var loginDialogActiveType: LoginDialogType? = null
+ private var showWelcomeDialog = false
+ private var showProgress = false
private var dismissedManually = false
- enum class LoginDialogType(val paramKey: String, val viewId: Int, val editorId: Int) {
- ENTER_PHONE_NUMBER(ENTER_PHONE_NUMBER_PARAM_KEY, R.id.enterPhoneNumberLayout, R.id.phoneNumberEditText),
- ENTER_CODE(ENTER_CODE_PARAM_KEY, R.id.enterCodeLayout, R.id.codeEditText),
- ENTER_PASSWORD(ENTER_PASSWORD_PARAM_KEY, R.id.enterPasswordLayout, R.id.passwordEditText),
- SHOW_PROGRESS(SHOW_PROGRESS_PARAM_KEY, R.id.progressLayout, 0);
+ enum class LoginDialogType(val viewId: Int, val editorId: Int,
+ @StringRes val titleId: Int, @StringRes val descriptionId: Int) {
+ ENTER_PHONE_NUMBER(R.id.enter_phone_number_layout, R.id.phone_number_edit_text,
+ R.string.shared_string_authorization, R.string.shared_string_authorization_descr),
+ ENTER_CODE(R.id.enter_code_layout, R.id.code_edit_text,
+ R.string.enter_code, R.string.authentication_code_descr),
+ ENTER_PASSWORD(R.id.enter_password_layout, R.id.password_edit_text,
+ R.string.enter_password, R.string.password_descr);
}
override fun onCreate(savedInstanceState: Bundle?) {
@@ -77,25 +109,30 @@ class LoginDialogFragment : DialogFragment() {
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
-
- val loginDialogActiveTypes: MutableSet = HashSet()
-
val args = savedInstanceState ?: arguments
if (args != null) {
- for (t in LoginDialogType.values()) {
- if (args.getBoolean(t.paramKey, false)) {
- loginDialogActiveTypes.add(t)
- }
+ val loginDialogTypeParam = args.getString(LOGIN_DIALOG_TYPE_PARAM_KEY)
+ if (loginDialogTypeParam != null) {
+ loginDialogActiveType = LoginDialogType.valueOf(loginDialogTypeParam)
}
+ showProgress = args.getBoolean(SHOW_PROGRESS_PARAM_KEY, false)
+ showWelcomeDialog = args.getBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, false)
}
-
- this.loginDialogActiveTypes = loginDialogActiveTypes
-
val view = inflater.inflate(R.layout.login_dialog, container)
buildDialog(view)
return view
}
+ override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
+ return object : Dialog(requireActivity(), theme) {
+ override fun onBackPressed() {
+ if (!dismissedManually) {
+ activity?.finish()
+ }
+ }
+ }
+ }
+
override fun onDismiss(dialog: DialogInterface?) {
super.onDismiss(dialog)
if (!dismissedManually) {
@@ -103,22 +140,46 @@ class LoginDialogFragment : DialogFragment() {
}
}
+ @Suppress("DEPRECATION")
private fun buildDialog(view: View?) {
- val loginDialogActiveTypes = this.loginDialogActiveTypes
- var hasProgress = false
+ if (showWelcomeDialog) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ view?.findViewById(R.id.welcome_descr)?.text = Html.fromHtml(getString(R.string.welcome_descr), android.text.Html.FROM_HTML_MODE_LEGACY)
+ } else {
+ view?.findViewById(R.id.welcome_descr)?.text = Html.fromHtml(getString(R.string.welcome_descr))
+ }
+ val continueButton = view?.findViewById