Merge pull request #10738 from osmandapp/togglefix

hillshade/terrain toggle fix
This commit is contained in:
Vitaliy 2021-02-02 13:36:56 +02:00 committed by GitHub
commit f6fd2fbb73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 15 deletions

View file

@ -8,7 +8,7 @@
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/tab_title"
android:id="@+id/center_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"

View file

@ -3,12 +3,12 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/custom_radio_buttons"
android:layout_width="match_parent"
android:minHeight="@dimen/dialog_button_height"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:background="?attr/btn_bg_border_inactive"
android:baselineAligned="false"
android:minHeight="@dimen/dialog_button_height"
android:orientation="horizontal"
tools:showIn="@layout/fragment_route_between_points_bottom_sheet_dialog">
@ -22,7 +22,8 @@
layout="@layout/center_button_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
android:layout_weight="1"
android:visibility="gone" />
<include
layout="@layout/right_button_container"

View file

@ -8,7 +8,7 @@
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/tab_title"
android:id="@+id/left_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"

View file

@ -8,7 +8,7 @@
android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/tab_title"
android:id="@+id/right_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"

View file

@ -51,6 +51,7 @@ import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.widgets.TextViewEx;
@ -468,8 +469,8 @@ 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);
TextView startButtonText = startButtonContainer.findViewById(R.id.left_button);
TextView endButtonText = endButtonContainer.findViewById(R.id.right_button);
endButtonContainer.setBackgroundColor(Color.TRANSPARENT);
endButtonText.setTextColor(activeColor);
@ -477,23 +478,25 @@ public class UiUtilities {
startButtonText.setTextColor(textColor);
if (centerButtonContainer != null) {
TextView centerButtonText = centerButtonContainer.findViewById(R.id.tab_title);
TextView centerButtonText = centerButtonContainer.findViewById(R.id.center_button);
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);
AndroidUiHelper.updateVisibility(centerButtonContainer, true);
TextView centerButtonText = centerButtonContainer.findViewById(R.id.center_button);
centerButtonText.setTextColor(textColor);
if (endButtonContainer != null) {
TextView endButtonText = endButtonContainer.findViewById(R.id.tab_title);
TextView endButtonText = endButtonContainer.findViewById(R.id.right_button);
endButtonText.setTextColor(activeColor);
endButtonContainer.setBackgroundColor(Color.TRANSPARENT);
}
if (startButtonContainer != null) {
TextView startButtonText = startButtonContainer.findViewById(R.id.tab_title);
TextView startButtonText = startButtonContainer.findViewById(R.id.left_button);
startButtonText.setTextColor(activeColor);
startButtonContainer.setBackgroundColor(Color.TRANSPARENT);
}
@ -503,8 +506,8 @@ 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);
TextView startButtonText = startButtonContainer.findViewById(R.id.left_button);
TextView endButtonText = endButtonContainer.findViewById(R.id.right_button);
endButtonContainer.setBackgroundDrawable(background);
endButtonText.setTextColor(textColor);
@ -512,7 +515,7 @@ public class UiUtilities {
startButtonText.setTextColor(activeColor);
if (centerButtonContainer != null) {
TextView centerButtonText = centerButtonContainer.findViewById(R.id.tab_title);
TextView centerButtonText = centerButtonContainer.findViewById(R.id.center_button);
centerButtonText.setTextColor(activeColor);
centerButtonContainer.setBackgroundColor(Color.TRANSPARENT);
}

View file

@ -573,8 +573,12 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
} else {
layoutId = tripleTabsLayoutIds[position];
}
View tab = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
ViewGroup tab = (ViewGroup) UiUtilities.getInflater(parent.getContext(), nightMode).inflate(layoutId, parent, false);
tab.setTag(tabTypes[position].name());
TextView title = (TextView) tab.getChildAt(0);
if (title != null) {
title.setText(getPageTitle(position));
}
return tab;
}