Fix colors text

This commit is contained in:
androiddevkkotlin 2020-11-30 11:30:34 +02:00
parent 18ce71167b
commit 870986c09b

View file

@ -3,6 +3,7 @@ package net.osmand.plus.settings.bottomsheets;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -60,6 +61,8 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment {
private String on; private String on;
private String off; private String off;
private int activeColor; private int activeColor;
private int checkedColor;
private int uncheckedColor;
private int disabledColor; private int disabledColor;
private int appModeColor; private int appModeColor;
@ -95,6 +98,9 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment {
appModeColor = appMode.getIconColorInfo().getColor(nightMode); appModeColor = appMode.getIconColorInfo().getColor(nightMode);
activeColor = AndroidUtils.resolveAttribute(themedCtx, R.attr.active_color_basic); activeColor = AndroidUtils.resolveAttribute(themedCtx, R.attr.active_color_basic);
disabledColor = AndroidUtils.resolveAttribute(themedCtx, android.R.attr.textColorSecondary); disabledColor = AndroidUtils.resolveAttribute(themedCtx, android.R.attr.textColorSecondary);
checkedColor = (nightMode ? app.getResources().getColor(R.color.text_color_primary_dark) : app.getResources().getColor(R.color.text_color_primary_light));
uncheckedColor = (nightMode ? app.getResources().getColor(R.color.text_color_secondary_dark) : app.getResources().getColor(R.color.text_color_secondary_light));
items.add(new TitleItem(getString(R.string.routing_attr_height_obstacles_name))); items.add(new TitleItem(getString(R.string.routing_attr_height_obstacles_name)));
@ -214,6 +220,12 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment {
private void enableDisableReliefButtons(boolean enable) { private void enableDisableReliefButtons(boolean enable) {
for (BaseBottomSheetItem item : reliefFactorButtons) { for (BaseBottomSheetItem item : reliefFactorButtons) {
item.getView().setEnabled(enable); item.getView().setEnabled(enable);
TextView titleField = (TextView) item.getView().findViewById(R.id.title);
if (enable) {
titleField.setTextColor(checkedColor);
} else {
titleField.setTextColor(uncheckedColor);
}
item.getView().findViewById(R.id.compound_button).setEnabled(enable); item.getView().findViewById(R.id.compound_button).setEnabled(enable);
} }
} }