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