RTL issue - Applying correct text direction (ltr or rtl)
https://github.com/osmandapp/OsmAnd/issues/11212
This commit is contained in:
parent
ce475077fe
commit
eeaf45ea98
1 changed files with 51 additions and 40 deletions
|
@ -3,6 +3,8 @@ package net.osmand.plus;
|
|||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import androidx.core.text.TextUtilsCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.jwetherell.openmap.common.LatLonPoint;
|
||||
import com.jwetherell.openmap.common.MGRSPoint;
|
||||
import com.jwetherell.openmap.common.UTMPoint;
|
||||
|
@ -506,11 +508,20 @@ public class OsmAndFormatter {
|
|||
if (outputFormat == FORMAT_DEGREES_SHORT) {
|
||||
result.append(formatCoordinate(lat, outputFormat)).append(" ").append(formatCoordinate(lon, outputFormat));
|
||||
} else if (outputFormat == FORMAT_DEGREES || outputFormat == FORMAT_MINUTES || outputFormat == FORMAT_SECONDS) {
|
||||
boolean isLeftToRight = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_LTR;
|
||||
if (isLeftToRight) {
|
||||
result
|
||||
.append(formatCoordinate(lat, outputFormat)).append(" ")
|
||||
.append(lat > 0 ? NORTH : SOUTH).append(", ")
|
||||
.append(formatCoordinate(lon, outputFormat)).append(" ")
|
||||
.append(lon > 0 ? EAST : WEST);
|
||||
} else {
|
||||
result
|
||||
.append(formatCoordinate(lat, outputFormat)).append(" ")
|
||||
.append(lon > 0 ? EAST : WEST).append(" ")
|
||||
.append(formatCoordinate(lon, outputFormat)).append(", ")
|
||||
.append(lat > 0 ? NORTH : SOUTH);
|
||||
}
|
||||
} else if (outputFormat == UTM_FORMAT) {
|
||||
UTMPoint pnt = new UTMPoint(new LatLonPoint(lat, lon));
|
||||
result
|
||||
|
|
Loading…
Reference in a new issue