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

This commit is contained in:
Chumva 2018-08-08 17:41:44 +03:00
commit 1146a2f8ee
7 changed files with 13 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -95,6 +95,7 @@
<string name="si_mi_meters">Miles/meters</string>
<string name="shared_string_hour_short">h</string>
<string name="shared_string_minute_short">min</string>
<string name="shared_string_second_short">sec</string>
<string name="plus">+</string>
<string name="welcome_descr"><![CDATA[<b>OsmAnd Location Sharing</b> allows you to share your location and see locations of other people in the OsmAnd.<br/><br/>The application works on base of Telegram API. To use this app you must have a Telegram account.]]></string>
<string name="my_location">My location</string>

View file

@ -90,7 +90,7 @@ object AndroidUtils {
val paint = Paint().apply { textSize = txtSize.toFloat() }
val maxTextWidth = titles.map { paint.measureText(it) }.max()
if (maxTextWidth != null) {
val maxItemWidth = maxTextWidth.toInt() + AndroidUtils.dpToPx(ctx, 32f)
val maxItemWidth = maxTextWidth.toInt() + AndroidUtils.dpToPx(ctx, 33f)
val minWidth = AndroidUtils.dpToPx(ctx, 100f)
return maxOf(minWidth, maxItemWidth)
}

View file

@ -1,10 +1,8 @@
package net.osmand.telegram.utils
import android.content.Context
import net.osmand.telegram.R
import net.osmand.telegram.TelegramApplication
import java.text.DecimalFormat
import java.text.MessageFormat
@ -26,19 +24,19 @@ object OsmandFormatter {
fixed2.minimumIntegerDigits = 1
}
fun getFormattedDuration(seconds: Int, ctx: TelegramApplication): String {
fun getFormattedDuration(ctx: Context, seconds: Int): String {
val hours = seconds / (60 * 60)
val minutes = seconds / 60 % 60
return if (hours > 0) {
(hours.toString() + " "
+ ctx.getString(R.string.shared_string_hour_short)
+ if (minutes > 0)
" " + minutes + " "
+ ctx.getString(R.string.shared_string_minute_short)
else
"")
} else {
minutes.toString() + " " + ctx.getString(R.string.shared_string_minute_short)
return when {
hours > 0 -> {
var res = "$hours ${ctx.getString(R.string.shared_string_hour_short)}"
if (minutes > 0) {
res += " $minutes ${ctx.getString(R.string.shared_string_minute_short)}"
}
res
}
minutes > 0 -> "$minutes ${ctx.getString(R.string.shared_string_minute_short)}"
else -> "$seconds ${ctx.getString(R.string.shared_string_second_short)}"
}
}