Merge branch 'master' of ssh://github.com/osmandapp/Osmand into TravelUiImprovements

# Conflicts:
#	OsmAnd-telegram/res/values/strings.xml
This commit is contained in:
Chumva 2018-08-15 19:11:28 +03:00
commit a09dc0a280
5 changed files with 23 additions and 14 deletions

View file

@ -1,8 +1,9 @@
<resources>
<string name="logout_no_internet_msg">To properly log out from your Telegram account, the Internet is needed.</string>
<string name="shared_string_group">Group</string>
<string name="logout_no_internet_msg">To properly log out from your Telegram account, the Internet is needed.</string>
<string name="shared_string_close">Close</string>
<string name="disconnect_from_telegram_desc">To invoke access from OsmAnd, open Telegram, go to Settings - Privacy and Security - Sessions and terminate that session.</string>
<string name="disconnect_from_telegram_desc">To invoke access to your Telegram account from OsmAnd, open Telegram, go to Settings - Privacy and Security - Sessions and terminate OsmAnd Telegram session. After that, OsmAnd Location Sharing will no longer have access to your account, and you will not be able to use this app until you log in again.</string>
<string name="disconnect_from_telegram">How to disconnect OsmAnd Location Sharing from the Telegram account</string>
<string name="logout_help_desc">How to disconnect OsmAnd Location Sharing from Telegram</string>
<string name="connected_account">Connected account</string>

View file

@ -184,6 +184,11 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene
runOnUi {
val fm = supportFragmentManager
when (newTelegramAuthorizationState) {
TelegramAuthorizationState.LOGGING_OUT -> LoginDialogFragment.showWelcomeDialog(fm)
TelegramAuthorizationState.CLOSED -> {
telegramHelper.init()
telegramHelper.requestAuthorizationState()
}
TelegramAuthorizationState.READY -> LoginDialogFragment.dismiss(fm)
else -> Unit
}
@ -258,9 +263,13 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene
// FIXME: update UI
}
private fun logoutTelegram(silent: Boolean = false) {
fun logoutTelegram(silent: Boolean = false) {
if (telegramHelper.getTelegramAuthorizationState() == TelegramHelper.TelegramAuthorizationState.READY) {
telegramHelper.logout()
if (app.isInternetConnectionAvailable) {
telegramHelper.logout()
} else {
Toast.makeText(this, R.string.logout_no_internet_msg, Toast.LENGTH_SHORT).show()
}
} else if (!silent) {
Toast.makeText(this, R.string.not_logged_in, Toast.LENGTH_SHORT).show()
}

View file

@ -11,10 +11,12 @@ import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.widget.ArrayAdapter
import android.widget.ImageView
import android.widget.RadioButton
import android.widget.TextView
import net.osmand.telegram.*
import net.osmand.telegram.helpers.OsmandAidlHelper
import net.osmand.telegram.helpers.TelegramHelper
import net.osmand.telegram.helpers.TelegramUiHelper
import net.osmand.telegram.utils.AndroidUtils
import net.osmand.telegram.utils.OsmandFormatter
@ -156,12 +158,9 @@ class SettingsDialogFragment : DialogFragment() {
}
}
private fun logoutTelegram(silent: Boolean = false) {
if (telegramHelper.getTelegramAuthorizationState() == TelegramHelper.TelegramAuthorizationState.READY) {
telegramHelper.logout()
} else if (!silent) {
Toast.makeText(context, R.string.not_logged_in, Toast.LENGTH_SHORT).show()
}
private fun logoutTelegram() {
val act = activity ?: return
(act as MainActivity).logoutTelegram()
}
private inner class SendMyLocPref : DurationPref(

View file

@ -60,9 +60,9 @@
<asset source="voice/fr/fr_tts.js" destination="voice/fr-tts/fr_tts.js" mode="alwaysOverwriteOrCopy" />
<!--<asset source="voice/he/he_tts.js" destination="voice/he-tts/he_tts.js" mode="overwriteOnlyIfExists" />-->
<asset source="voice/hi/hi_tts.js" destination="voice/hi-tts/hi_tts.js" mode="overwriteOnlyIfExists" />
<!--<asset source="voice/hr/hr_tts.js" destination="voice/hr-tts/hr_tts.js" mode="overwriteOnlyIfExists" />-->
<asset source="voice/hr/hr_tts.js" destination="voice/hr-tts/hr_tts.js" mode="overwriteOnlyIfExists" />
<asset source="voice/hu/hu_tts.js" destination="voice/hu-tts/hu_tts.js" mode="overwriteOnlyIfExists" />
<!--<asset source="voice/hu-formal/hu-formal_tts.js" destination="voice/hu_formal-tts/hu-formal_tts.js" mode="overwriteOnlyIfExists" />-->
<asset source="voice/hu-formal/hu-formal_tts.js" destination="voice/hu_formal-tts/hu-formal_tts.js" mode="overwriteOnlyIfExists" />
<asset source="voice/it/it_tts.js" destination="voice/it-tts/it_tts.js" mode="alwaysOverwriteOrCopy" />
<asset source="voice/ja/ja_tts.js" destination="voice/ja-tts/ja_tts.js" mode="alwaysOverwriteOrCopy" />
<!--<asset source="voice/ko/ko_tts.js" destination="voice/ko-tts/ko_tts.js" mode="overwriteOnlyIfExists" />-->

View file

@ -120,7 +120,7 @@ public class JSTTSCommandPlayerImpl extends AbstractJSCommandPlayer {
ttsRequests = 0;
final float speechRate = cSpeechRate;
final String[] lsplit = (language + "____.").split("[_\\-]");
final String[] lsplit = (language.replaceAll("_formal", "") + "____.").split("[_\\-]");
// constructor supports lang_country_variant
Locale newLocale0 = new Locale(lsplit[0], lsplit[1], lsplit[2]);
// #3344: Try Locale builder instead of constructor (only available from API 21). Also supports script (for now supported as trailing x_x_x_Scrp)