toggle hilshade fix

This commit is contained in:
androiddevkotlin 2021-02-02 14:15:42 +02:00
parent dedea0c45e
commit bc63b01ad2
6 changed files with 23 additions and 15 deletions

View file

@ -8,7 +8,7 @@
android:layout_weight="1"> android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/tab_title" android:id="@+id/center_button"
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"

View file

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

View file

@ -8,7 +8,7 @@
android:layout_weight="1"> android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/tab_title" android:id="@+id/left_button"
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"

View file

@ -8,7 +8,7 @@
android:layout_weight="1"> android:layout_weight="1">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/tab_title" android:id="@+id/right_button"
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"

View file

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

View file

@ -573,8 +573,12 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid
} else { } else {
layoutId = tripleTabsLayoutIds[position]; 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()); tab.setTag(tabTypes[position].name());
TextView title = (TextView) tab.getChildAt(0);
if (title != null) {
title.setText(getPageTitle(position));
}
return tab; return tab;
} }