diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java index 2886fc0678..64021f2102 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java @@ -4,11 +4,15 @@ import android.graphics.drawable.Drawable; import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; import android.support.annotation.DrawableRes; +import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; +import android.support.v7.widget.RecyclerView; +import android.view.ViewGroup; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; -public class BaseTravelCard { +public abstract class BaseTravelCard { protected OsmandApplication app; protected boolean nightMode; @@ -18,16 +22,28 @@ public class BaseTravelCard { this.nightMode = nightMode; } + public abstract RecyclerView.ViewHolder createViewHolder(@NonNull ViewGroup parent); + + public abstract void bindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder); + @ColorInt protected int getResolvedColor(@ColorRes int colorId) { return ContextCompat.getColor(app, colorId); } - protected Drawable getIcon(@DrawableRes int iconId, @ColorRes int colorLightId, @ColorRes int colorDarkId) { - return getIcon(iconId, nightMode ? colorLightId : colorDarkId); + protected Drawable getContentIcon(@DrawableRes int icon) { + return getColoredIcon(icon, R.color.icon_color); } - protected Drawable getIcon(@DrawableRes int drawableRes, @ColorRes int color) { - return app.getIconsCache().getIcon(drawableRes, color); + protected Drawable getActiveIcon(@DrawableRes int icon) { + return getColoredIcon(icon, R.color.wikivoyage_active_light, R.color.wikivoyage_active_dark); + } + + protected Drawable getColoredIcon(@DrawableRes int icon, @ColorRes int colorLight, @ColorRes int colorDark) { + return getColoredIcon(icon, nightMode ? colorDark : colorLight); + } + + protected Drawable getColoredIcon(@DrawableRes int icon, @ColorRes int color) { + return app.getIconsCache().getIcon(icon, color); } }