Fixed resources in dark theme.
This commit is contained in:
parent
75d874136a
commit
aec531c381
2 changed files with 14 additions and 12 deletions
|
@ -109,7 +109,7 @@ public class ContextMenuAdapter {
|
||||||
// User super class to create the View
|
// User super class to create the View
|
||||||
final ContextMenuItem item = getItem(position);
|
final ContextMenuItem item = getItem(position);
|
||||||
int layoutId = item.getLayout();
|
int layoutId = item.getLayout();
|
||||||
layoutId = layoutId != -1 ? layoutId : DEFAULT_LAYOUT_ID;
|
layoutId = layoutId != ContextMenuItem.INVALID_ID ? layoutId : DEFAULT_LAYOUT_ID;
|
||||||
if (layoutId == R.layout.mode_toggles) {
|
if (layoutId == R.layout.mode_toggles) {
|
||||||
final Set<ApplicationMode> selected = new LinkedHashSet<>();
|
final Set<ApplicationMode> selected = new LinkedHashSet<>();
|
||||||
return AppModeDialog.prepareAppModeDrawerView((Activity) getContext(),
|
return AppModeDialog.prepareAppModeDrawerView((Activity) getContext(),
|
||||||
|
@ -153,7 +153,7 @@ public class ContextMenuAdapter {
|
||||||
tv.setCompoundDrawables(imageId, null, null, null);
|
tv.setCompoundDrawables(imageId, null, null, null);
|
||||||
tv.setCompoundDrawablePadding(paddingInPixels);
|
tv.setCompoundDrawablePadding(paddingInPixels);
|
||||||
} else {
|
} else {
|
||||||
if (item.getIcon() != -1) {
|
if (item.getIcon() != ContextMenuItem.INVALID_ID) {
|
||||||
Drawable drawable = ContextCompat.getDrawable(getContext(), item.getIcon());
|
Drawable drawable = ContextCompat.getDrawable(getContext(), item.getIcon());
|
||||||
DrawableCompat.setTint(drawable, item.getThemedColor(getContext()));
|
DrawableCompat.setTint(drawable, item.getThemedColor(getContext()));
|
||||||
((AppCompatImageView) convertView.findViewById(R.id.icon)).setImageDrawable(drawable);
|
((AppCompatImageView) convertView.findViewById(R.id.icon)).setImageDrawable(drawable);
|
||||||
|
@ -164,7 +164,7 @@ public class ContextMenuAdapter {
|
||||||
}
|
}
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
int secondaryDrawable = item.getSecondaryIcon();
|
int secondaryDrawable = item.getSecondaryIcon();
|
||||||
if (secondaryDrawable != -1) {
|
if (secondaryDrawable != ContextMenuItem.INVALID_ID) {
|
||||||
int color = ContextCompat.getColor(getContext(),
|
int color = ContextCompat.getColor(getContext(),
|
||||||
holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
holoLight ? R.color.icon_color : R.color.dashboard_subheader_text_dark);
|
||||||
Drawable drawable = ContextCompat.getDrawable(getContext(), item.getSecondaryIcon());
|
Drawable drawable = ContextCompat.getDrawable(getContext(), item.getSecondaryIcon());
|
||||||
|
@ -206,7 +206,7 @@ public class ContextMenuAdapter {
|
||||||
|
|
||||||
if (convertView.findViewById(R.id.seekbar) != null) {
|
if (convertView.findViewById(R.id.seekbar) != null) {
|
||||||
SeekBar seekBar = (SeekBar) convertView.findViewById(R.id.seekbar);
|
SeekBar seekBar = (SeekBar) convertView.findViewById(R.id.seekbar);
|
||||||
if (item.getProgress() != -1) {
|
if (item.getProgress() != ContextMenuItem.INVALID_ID) {
|
||||||
seekBar.setProgress(item.getProgress());
|
seekBar.setProgress(item.getProgress());
|
||||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,6 +10,8 @@ import android.support.annotation.StringRes;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
public class ContextMenuItem {
|
public class ContextMenuItem {
|
||||||
|
public static final int INVALID_ID = 0;
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
private final int titleId;
|
private final int titleId;
|
||||||
private String title;
|
private String title;
|
||||||
|
@ -81,7 +83,7 @@ public class ContextMenuItem {
|
||||||
|
|
||||||
@ColorRes
|
@ColorRes
|
||||||
public int getThemedColorRes(Context context) {
|
public int getThemedColorRes(Context context) {
|
||||||
if (getColorRes() != -1) {
|
if (getColorRes() != INVALID_ID) {
|
||||||
return getColorRes();
|
return getColorRes();
|
||||||
} else {
|
} else {
|
||||||
return getDefaultColorRes(context);
|
return getDefaultColorRes(context);
|
||||||
|
@ -97,7 +99,7 @@ public class ContextMenuItem {
|
||||||
public static int getDefaultColorRes(Context context) {
|
public static int getDefaultColorRes(Context context) {
|
||||||
final OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
final OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
||||||
boolean light = app.getSettings().isLightContent();
|
boolean light = app.getSettings().isLightContent();
|
||||||
return light ? R.color.icon_color : 0;
|
return light ? R.color.icon_color : R.color.color_white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
|
@ -175,18 +177,18 @@ public class ContextMenuItem {
|
||||||
private int mTitleId;
|
private int mTitleId;
|
||||||
private String mTitle;
|
private String mTitle;
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
private int mIcon = -1;
|
private int mIcon = INVALID_ID;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
private int mColor = -1;
|
private int mColor = INVALID_ID;
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
private int mSecondaryIcon = -1;
|
private int mSecondaryIcon = INVALID_ID;
|
||||||
private Boolean mSelected = null;
|
private Boolean mSelected = null;
|
||||||
private int mProgress = -1;
|
private int mProgress = INVALID_ID;
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
private int mLayout = -1;
|
private int mLayout = INVALID_ID;
|
||||||
private boolean mLoading = false;
|
private boolean mLoading = false;
|
||||||
private boolean mIsCategory = false;
|
private boolean mIsCategory = false;
|
||||||
private int mPosition = -1;
|
private int mPosition = INVALID_ID;
|
||||||
private String mDescription = null;
|
private String mDescription = null;
|
||||||
private ContextMenuAdapter.ItemClickListener mItemClickListener = null;
|
private ContextMenuAdapter.ItemClickListener mItemClickListener = null;
|
||||||
private ContextMenuAdapter.OnIntegerValueChangedListener mIntegerListener = null;
|
private ContextMenuAdapter.OnIntegerValueChangedListener mIntegerListener = null;
|
||||||
|
|
Loading…
Reference in a new issue