Fix nigth mode for cards
This commit is contained in:
parent
d190da742a
commit
fc35892883
4 changed files with 14 additions and 11 deletions
|
@ -39,9 +39,13 @@ public abstract class BaseCard {
|
|||
}
|
||||
|
||||
public BaseCard(@NonNull MapActivity mapActivity) {
|
||||
this(mapActivity, true);
|
||||
}
|
||||
|
||||
public BaseCard(@NonNull MapActivity mapActivity, boolean usedOnMap) {
|
||||
this.mapActivity = mapActivity;
|
||||
this.app = mapActivity.getMyApplication();
|
||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
nightMode = usedOnMap ? app.getDaynightHelper().isNightModeForMapControls() : !app.getSettings().isLightContent();
|
||||
}
|
||||
|
||||
public abstract int getCardLayoutId();
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SubscriptionsCard extends BaseCard {
|
|||
}
|
||||
|
||||
public SubscriptionsCard(@NonNull MapActivity mapActivity, @NonNull Fragment target, @NonNull InAppPurchaseHelper purchaseHelper) {
|
||||
super(mapActivity);
|
||||
super(mapActivity, false);
|
||||
this.target = target;
|
||||
this.purchaseHelper = purchaseHelper;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SubscriptionsListCard extends BaseCard {
|
|||
}
|
||||
|
||||
public SubscriptionsListCard(@NonNull MapActivity mapActivity, @NonNull InAppPurchaseHelper purchaseHelper) {
|
||||
super(mapActivity);
|
||||
super(mapActivity, false);
|
||||
this.purchaseHelper = purchaseHelper;
|
||||
this.dateFormat = new SimpleDateFormat("MMM d, yyyy", Locale.getDefault());
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import net.osmand.plus.inapp.InAppPurchaseHelper;
|
|||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
@ -41,15 +40,15 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
|
|||
}
|
||||
|
||||
public TroubleshootingOrPurchasingCard(@NonNull MapActivity mapActivity, @NonNull InAppPurchaseHelper purchaseHelper, boolean isPaidVersion) {
|
||||
super(mapActivity);
|
||||
super(mapActivity, false);
|
||||
this.purchaseHelper = purchaseHelper;
|
||||
this.isPaidVersion = isPaidVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
setupRestorePurchasesBtn(R.id.restore_purchases);
|
||||
setupNewDeviceOrAccountBtn(R.id.new_device_account_container);
|
||||
setupRestorePurchasesBtn();
|
||||
setupNewDeviceOrAccountBtn();
|
||||
setupSupportDescription();
|
||||
setupContactUsLink();
|
||||
|
||||
|
@ -82,8 +81,8 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
|
|||
}
|
||||
}
|
||||
|
||||
protected void setupRestorePurchasesBtn(@IdRes int btnId) {
|
||||
View purchasesRestore = view.findViewById(btnId);
|
||||
protected void setupRestorePurchasesBtn() {
|
||||
View purchasesRestore = view.findViewById(R.id.restore_purchases);
|
||||
purchasesRestore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -94,8 +93,8 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
|
|||
});
|
||||
}
|
||||
|
||||
protected void setupNewDeviceOrAccountBtn(@IdRes int btnId) {
|
||||
View newDeviceAccountContainer = view.findViewById(btnId);
|
||||
protected void setupNewDeviceOrAccountBtn() {
|
||||
View newDeviceAccountContainer = view.findViewById(R.id.new_device_account_container);
|
||||
newDeviceAccountContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
Loading…
Reference in a new issue