Fix altitude

This commit is contained in:
androiddevkotlin 2021-02-01 12:37:56 +02:00
parent 12ecfb256b
commit 0ff4b87011
4 changed files with 24 additions and 12 deletions

View file

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

View file

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

View file

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

View file

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