Merge branch 'master' into patch-21

This commit is contained in:
Allan Nordhøy 2020-01-18 21:30:37 +01:00 committed by GitHub
commit b55f1a5716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
367 changed files with 3099 additions and 1068 deletions

View file

@ -42,6 +42,8 @@ public class IndexConstants {
public static final String OSMAND_SETTINGS_FILE_EXT = ".osf"; public static final String OSMAND_SETTINGS_FILE_EXT = ".osf";
public static final String ROUTING_FILE_EXT = ".xml";
public static final String RENDERER_INDEX_EXT = ".render.xml"; //$NON-NLS-1$ public static final String RENDERER_INDEX_EXT = ".render.xml"; //$NON-NLS-1$
public final static String POI_TABLE = "poi"; //$NON-NLS-1$ public final static String POI_TABLE = "poi"; //$NON-NLS-1$

View file

@ -133,6 +133,17 @@ public class RoutingConfiguration {
} }
public String getRoutingProfileKeyByFileName(String fileName) {
if (fileName != null && routers != null) {
for (Map.Entry<String, GeneralRouter> router : routers.entrySet()) {
if (fileName.equals(router.getValue().getFilename())) {
return router.getKey();
}
}
}
return null;
}
public Map<String, GeneralRouter> getAllRouters() { public Map<String, GeneralRouter> getAllRouters() {
return routers; return routers;
} }

View file

@ -260,4 +260,7 @@
<string name="unit_of_speed_system">Unitat de velocitat</string> <string name="unit_of_speed_system">Unitat de velocitat</string>
<string name="buffer_time_descr">Temps màxim per mantenir punts a la memòria intermèdia</string> <string name="buffer_time_descr">Temps màxim per mantenir punts a la memòria intermèdia</string>
<string name="buffer_time">Temps de caducitat de la memòria intermèdia</string> <string name="buffer_time">Temps de caducitat de la memòria intermèdia</string>
<string name="shared_string_suggested">Suggeriment</string>
<string name="status_widget_title">Estat de l\'enregistrador d\'OsmAnd</string>
<string name="back_to_osmand">Torna a OsmAnd</string>
</resources> </resources>

View file

@ -14,7 +14,7 @@ import net.osmand.telegram.notifications.NotificationHelper
import net.osmand.telegram.utils.AndroidUtils import net.osmand.telegram.utils.AndroidUtils
import net.osmand.telegram.utils.UiUtils import net.osmand.telegram.utils.UiUtils
class TelegramApplication : Application(), OsmandHelperListener { class TelegramApplication : Application() {
val telegramHelper = TelegramHelper.instance val telegramHelper = TelegramHelper.instance
lateinit var settings: TelegramSettings private set lateinit var settings: TelegramSettings private set
@ -54,6 +54,7 @@ class TelegramApplication : Application(), OsmandHelperListener {
listOf("ic_action_location_sharing_app"), listOf("ic_action_location_sharing_app"),
listOf(-1) listOf(-1)
) )
showLocationHelper.setupMapLayer()
showLocationHelper.addDirectionContextMenuButton() showLocationHelper.addDirectionContextMenuButton()
showLocationHelper.startShowingLocation() showLocationHelper.startShowingLocation()
showLocationHelper.addOrUpdateStatusWidget(-1, false) showLocationHelper.addOrUpdateStatusWidget(-1, false)
@ -141,13 +142,6 @@ class TelegramApplication : Application(), OsmandHelperListener {
return internetConnectionAvailable return internetConnectionAvailable
} }
override fun onOsmandConnectionStateChanged(connected: Boolean) {
if (connected) {
showLocationHelper.setupMapLayer()
showLocationHelper.addDirectionContextMenuButton()
}
}
private fun startTelegramService(intent: Int, serviceOffInterval: Long = 0) { private fun startTelegramService(intent: Int, serviceOffInterval: Long = 0) {
var i = intent var i = intent
var interval = serviceOffInterval var interval = serviceOffInterval

View file

@ -35,6 +35,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
const val MIN_OSMAND_CALLBACK_VERSION_CODE = 320 const val MIN_OSMAND_CALLBACK_VERSION_CODE = 320
const val MIN_OSMAND_CREATE_IMPORT_DIRS_VERSION_CODE = 340 const val MIN_OSMAND_CREATE_IMPORT_DIRS_VERSION_CODE = 340
const val MIN_OSMAND_SHARE_WIDGET_ICON_VERSION_CODE = 356
const val MAP_CONTEXT_MENU_BUTTON_ID = 1 const val MAP_CONTEXT_MENU_BUTTON_ID = 1
const val MAP_CONTEXT_MENU_BUTTONS_PARAMS_ID = "DIRECTION" const val MAP_CONTEXT_MENU_BUTTONS_PARAMS_ID = "DIRECTION"
@ -46,6 +47,8 @@ class ShowLocationHelper(private val app: TelegramApplication) {
private const val STATUS_WIDGET_ID = "status_widget" private const val STATUS_WIDGET_ID = "status_widget"
private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night" private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night"
private const val STATUS_WIDGET_MENU_ICON_OLD = "ic_action_relative_bearing"
private const val STATUS_WIDGET_ICON_OLD = "widget_relative_bearing_day"
private const val STATUS_WIDGET_ANIM_ICON_DAY = "anim_widget_location_sharing_day" private const val STATUS_WIDGET_ANIM_ICON_DAY = "anim_widget_location_sharing_day"
private const val STATUS_WIDGET_ANIM_ICON_NIGHT = "anim_widget_location_sharing_night" private const val STATUS_WIDGET_ANIM_ICON_NIGHT = "anim_widget_location_sharing_night"
private const val STATUS_WIDGET_ON_ANIM_ICON_DAY = "anim_widget_location_sharing_on_day" private const val STATUS_WIDGET_ON_ANIM_ICON_DAY = "anim_widget_location_sharing_on_day"
@ -209,8 +212,13 @@ class ShowLocationHelper(private val app: TelegramApplication) {
} }
fun addOrUpdateStatusWidget(time: Long, isSending: Boolean) { fun addOrUpdateStatusWidget(time: Long, isSending: Boolean) {
val iconDay: String var iconDay: String
val iconNight: String var iconNight: String
val menuIcon = if (isOsmandHasStatusWidgetIcon()) {
STATUS_WIDGET_MENU_ICON
} else {
STATUS_WIDGET_MENU_ICON_OLD
}
val text = when { val text = when {
time > 0L -> { time > 0L -> {
iconDay = STATUS_WIDGET_ANIM_ICON_DAY iconDay = STATUS_WIDGET_ANIM_ICON_DAY
@ -234,6 +242,10 @@ class ShowLocationHelper(private val app: TelegramApplication) {
app.getString(R.string.shared_string_start) app.getString(R.string.shared_string_start)
} }
} }
if (!isOsmandHasStatusWidgetIcon()) {
iconDay = STATUS_WIDGET_ICON_OLD
iconNight = STATUS_WIDGET_ICON_OLD
}
val subText = when { val subText = when {
time > 0 -> { time > 0 -> {
if (text.length > 2) { if (text.length > 2) {
@ -246,7 +258,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
} }
osmandAidlHelper.addMapWidget( osmandAidlHelper.addMapWidget(
STATUS_WIDGET_ID, STATUS_WIDGET_ID,
STATUS_WIDGET_MENU_ICON, menuIcon,
app.getString(R.string.status_widget_title), app.getString(R.string.status_widget_title),
iconDay, iconDay,
iconNight, iconNight,
@ -456,6 +468,11 @@ class ShowLocationHelper(private val app: TelegramApplication) {
return version >= MIN_OSMAND_CREATE_IMPORT_DIRS_VERSION_CODE return version >= MIN_OSMAND_CREATE_IMPORT_DIRS_VERSION_CODE
} }
fun isOsmandHasStatusWidgetIcon(): Boolean {
val version = AndroidUtils.getAppVersionCode(app, app.settings.appToConnectPackage)
return version >= MIN_OSMAND_SHARE_WIDGET_ICON_VERSION_CODE
}
fun startShowMessagesTask(chatId: Long, vararg messages: TdApi.Message) { fun startShowMessagesTask(chatId: Long, vararg messages: TdApi.Message) {
if (app.settings.isShowingChatOnMap(chatId)) { if (app.settings.isShowingChatOnMap(chatId)) {
ShowMessagesTask(app).executeOnExecutor(executor, *messages) ShowMessagesTask(app).executeOnExecutor(executor, *messages)

View file

@ -323,6 +323,39 @@
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.osf" /> <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.osf" />
</intent-filter> </intent-filter>
<intent-filter
android:label="@string/app_name"
android:priority="50">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file"/>
<data android:host="*"/>
<data android:pathPattern=".*\\.xml" />
<data android:pathPattern=".*\\..*\\.xml" />
<data android:pathPattern=".*\\..*\\..*\\.xml" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.xml" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.xml" />
</intent-filter>
<intent-filter
android:label="@string/app_name"
android:priority="50">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content"/>
<data android:scheme="file"/>
<data android:scheme="data"/>
<data android:host="*"/>
<data android:mimeType="*/*"/>
<data android:pathPattern=".*\\.xml" />
<data android:pathPattern=".*\\..*\\.xml" />
<data android:pathPattern=".*\\..*\\..*\\.xml" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.xml" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.xml" />
</intent-filter>
<!--trying to handle emails--> <!--trying to handle emails-->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />

View file

@ -45,10 +45,10 @@ android {
defaultConfig { defaultConfig {
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 15 minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 15
targetSdkVersion 28 targetSdkVersion 28
versionCode 350 versionCode 356
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
multiDexEnabled true multiDexEnabled true
versionName "3.5.0" versionName "3.5.6"
versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 882 B

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 576 B

View file

Before

Width:  |  Height:  |  Size: 935 B

After

Width:  |  Height:  |  Size: 935 B

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 955 B

After

Width:  |  Height:  |  Size: 955 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View file

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 658 B

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Some files were not shown because too many files have changed in this diff Show more