Merge pull request #10727 from osmandapp/fix-name-altitude

Fix altitude
This commit is contained in:
Vitaliy 2021-02-01 12:40:25 +02:00 committed by GitHub
commit 7fa01ec95d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 12 deletions

View file

@ -1,19 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/center_button_container" android:id="@+id/center_button_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/center_button" android:id="@+id/tab_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:text="@string/altitude"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium"
tools:text="@string/altitude" />
</FrameLayout> </FrameLayout>

View file

@ -1,19 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/left_button_container" android:id="@+id/left_button_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/left_button" android:id="@+id/tab_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:text="@string/shared_string_overview"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium"
tools:text="@string/shared_string_overview" />
</FrameLayout> </FrameLayout>

View file

@ -1,19 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/right_button_container" android:id="@+id/right_button_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/right_button" android:id="@+id/tab_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:text="@string/map_widget_speed"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" /> osmand:typeface="@string/font_roboto_medium"
tools:text="@string/map_widget_speed" />
</FrameLayout> </FrameLayout>

View file

@ -455,12 +455,10 @@ public class UiUtilities {
int radius = AndroidUtils.dpToPx(app, 4); int radius = AndroidUtils.dpToPx(app, 4);
boolean isLayoutRtl = AndroidUtils.isLayoutRtl(app); boolean isLayoutRtl = AndroidUtils.isLayoutRtl(app);
TextView startButtonText = buttonsView.findViewById(R.id.left_button);
View startButtonContainer = buttonsView.findViewById(R.id.left_button_container); View startButtonContainer = buttonsView.findViewById(R.id.left_button_container);
TextView centerButtonText = buttonsView.findViewById(R.id.center_button);
View centerButtonContainer = buttonsView.findViewById(R.id.center_button_container); View centerButtonContainer = buttonsView.findViewById(R.id.center_button_container);
TextView endButtonText = buttonsView.findViewById(R.id.right_button);
View endButtonContainer = buttonsView.findViewById(R.id.right_button_container); View endButtonContainer = buttonsView.findViewById(R.id.right_button_container);
GradientDrawable background = new GradientDrawable(); GradientDrawable background = new GradientDrawable();
background.setColor(UiUtilities.getColorWithAlpha(activeColor, 0.1f)); background.setColor(UiUtilities.getColorWithAlpha(activeColor, 0.1f));
background.setStroke(AndroidUtils.dpToPx(app, 1), UiUtilities.getColorWithAlpha(activeColor, 0.5f)); background.setStroke(AndroidUtils.dpToPx(app, 1), UiUtilities.getColorWithAlpha(activeColor, 0.5f));
@ -470,25 +468,32 @@ public class UiUtilities {
} else { } else {
background.setCornerRadii(new float[]{radius, radius, 0, 0, 0, 0, radius, radius}); background.setCornerRadii(new float[]{radius, radius, 0, 0, 0, 0, radius, radius});
} }
TextView startButtonText = startButtonContainer.findViewById(R.id.tab_title);
TextView endButtonText = endButtonContainer.findViewById(R.id.tab_title);
endButtonContainer.setBackgroundColor(Color.TRANSPARENT); endButtonContainer.setBackgroundColor(Color.TRANSPARENT);
endButtonText.setTextColor(activeColor); endButtonText.setTextColor(activeColor);
startButtonContainer.setBackgroundDrawable(background); startButtonContainer.setBackgroundDrawable(background);
startButtonText.setTextColor(textColor); startButtonText.setTextColor(textColor);
if (centerButtonContainer != null) { if (centerButtonContainer != null) {
TextView centerButtonText = centerButtonContainer.findViewById(R.id.tab_title);
centerButtonText.setTextColor(activeColor); centerButtonText.setTextColor(activeColor);
centerButtonContainer.setBackgroundColor(Color.TRANSPARENT); centerButtonContainer.setBackgroundColor(Color.TRANSPARENT);
} }
} else if (buttonType == CustomRadioButtonType.CENTER) { } else if (buttonType == CustomRadioButtonType.CENTER) {
background.setCornerRadii(new float[] {0, 0, 0, 0, 0, 0, 0, 0}); background.setCornerRadii(new float[] {0, 0, 0, 0, 0, 0, 0, 0});
centerButtonContainer.setBackgroundDrawable(background); centerButtonContainer.setBackgroundDrawable(background);
TextView centerButtonText = centerButtonContainer.findViewById(R.id.tab_title);
centerButtonText.setTextColor(textColor); centerButtonText.setTextColor(textColor);
if (endButtonContainer != null) { if (endButtonContainer != null) {
TextView endButtonText = endButtonContainer.findViewById(R.id.tab_title);
endButtonText.setTextColor(activeColor); endButtonText.setTextColor(activeColor);
endButtonContainer.setBackgroundColor(Color.TRANSPARENT); endButtonContainer.setBackgroundColor(Color.TRANSPARENT);
} }
if (startButtonContainer != null) { if (startButtonContainer != null) {
TextView startButtonText = startButtonContainer.findViewById(R.id.tab_title);
startButtonText.setTextColor(activeColor); startButtonText.setTextColor(activeColor);
startButtonContainer.setBackgroundColor(Color.TRANSPARENT); startButtonContainer.setBackgroundColor(Color.TRANSPARENT);
} }
@ -498,12 +503,16 @@ public class UiUtilities {
} else { } else {
background.setCornerRadii(new float[]{0, 0, radius, radius, radius, radius, 0, 0}); background.setCornerRadii(new float[]{0, 0, radius, radius, radius, radius, 0, 0});
} }
TextView startButtonText = startButtonContainer.findViewById(R.id.tab_title);
TextView endButtonText = endButtonContainer.findViewById(R.id.tab_title);
endButtonContainer.setBackgroundDrawable(background); endButtonContainer.setBackgroundDrawable(background);
endButtonText.setTextColor(textColor); endButtonText.setTextColor(textColor);
startButtonContainer.setBackgroundColor(Color.TRANSPARENT); startButtonContainer.setBackgroundColor(Color.TRANSPARENT);
startButtonText.setTextColor(activeColor); startButtonText.setTextColor(activeColor);
if (centerButtonContainer != null) { if (centerButtonContainer != null) {
TextView centerButtonText = centerButtonContainer.findViewById(R.id.tab_title);
centerButtonText.setTextColor(activeColor); centerButtonText.setTextColor(activeColor);
centerButtonContainer.setBackgroundColor(Color.TRANSPARENT); centerButtonContainer.setBackgroundColor(Color.TRANSPARENT);
} }