Extract getters for primary btn resources from TravelDownloadUpdateCard to BaseTravelCard
This commit is contained in:
parent
c395b380c1
commit
2c55a179ea
2 changed files with 16 additions and 18 deletions
|
@ -49,4 +49,20 @@ public abstract class BaseTravelCard {
|
|||
protected boolean isInternetAvailable() {
|
||||
return app.getSettings().isInternetConnectionAvailable();
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
protected int getPrimaryBtnBgRes(boolean enabled) {
|
||||
if (enabled) {
|
||||
return nightMode ? R.drawable.wikivoyage_primary_btn_bg_dark : R.drawable.wikivoyage_primary_btn_bg_light;
|
||||
}
|
||||
return nightMode ? R.drawable.wikivoyage_secondary_btn_bg_dark : R.drawable.wikivoyage_secondary_btn_bg_light;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getPrimaryBtnTextColorRes(boolean enabled) {
|
||||
if (enabled) {
|
||||
return nightMode ? R.color.wikivoyage_primary_btn_text_dark : R.color.wikivoyage_primary_btn_text_light;
|
||||
}
|
||||
return R.color.wikivoyage_secondary_text;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package net.osmand.plus.wikivoyage.explore.travelcards;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
|
@ -199,22 +197,6 @@ public class TravelDownloadUpdateCard extends BaseTravelCard {
|
|||
return false;
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
private int getPrimaryBtnBgRes(boolean enabled) {
|
||||
if (enabled) {
|
||||
return nightMode ? R.drawable.wikivoyage_primary_btn_bg_dark : R.drawable.wikivoyage_primary_btn_bg_light;
|
||||
}
|
||||
return nightMode ? R.drawable.wikivoyage_secondary_btn_bg_dark : R.drawable.wikivoyage_secondary_btn_bg_light;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
private int getPrimaryBtnTextColorRes(boolean enabled) {
|
||||
if (enabled) {
|
||||
return nightMode ? R.color.wikivoyage_primary_btn_text_dark : R.color.wikivoyage_primary_btn_text_light;
|
||||
}
|
||||
return R.color.wikivoyage_secondary_text;
|
||||
}
|
||||
|
||||
public interface ClickListener {
|
||||
|
||||
void onPrimaryButtonClick();
|
||||
|
|
Loading…
Reference in a new issue