fixing measurement tool textview formatting

This commit is contained in:
madwasp79 2019-04-09 17:27:45 +03:00
parent c9f1149906
commit 4c154fa504
2 changed files with 8 additions and 2 deletions

View file

@ -87,7 +87,7 @@
<TextView
android:id="@+id/distance_to_center_text_view"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/measurement_points_text_view"
@ -96,6 +96,7 @@
android:layout_toStartOf="@id/up_down_button"
android:textColor="@color/color_distance"
android:textSize="@dimen/default_list_text_size"
android:maxLines="1"
tools:text=" 700 m"/>
<TextView

View file

@ -14,6 +14,7 @@ import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.TextViewCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
@ -21,6 +22,7 @@ import android.support.v7.widget.SwitchCompat;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
@ -363,7 +365,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
public void onMeasure(float distance, float bearing) {
String distStr = OsmAndFormatter.getFormattedDistance(distance, mapActivity.getMyApplication());
String azimuthStr = OsmAndFormatter.getFormattedAzimuth(bearing, getMyApplication());
distanceToCenterTv.setText(String.format(" %s • %s", distStr, azimuthStr));
distanceToCenterTv.setText(String.format(" %1$s • %2$s", distStr, azimuthStr));
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
distanceToCenterTv, 12, 18, 2, TypedValue.COMPLEX_UNIT_SP
);
}
});