diff --git a/app/src/General/res/values/devset_defaults.xml b/app/src/General/res/values/devset_defaults.xml new file mode 100644 index 0000000..981f2d5 --- /dev/null +++ b/app/src/General/res/values/devset_defaults.xml @@ -0,0 +1,11 @@ + + + + true + true + true + diff --git a/app/src/main/java/com/unibuy/smartdevice/MyApp.java b/app/src/main/java/com/unibuy/smartdevice/MyApp.java index 1632b0e..f4419e5 100644 --- a/app/src/main/java/com/unibuy/smartdevice/MyApp.java +++ b/app/src/main/java/com/unibuy/smartdevice/MyApp.java @@ -192,8 +192,24 @@ public class MyApp extends Application { this.comPort2ByNFCPay = ComPort.COM_PORT_S2; } - this.devSet = new DevSetStructure(true, false, false, true, true, - true, true, false, false,true,true,true,true,true); + // DevSet 初始預設值改由 res/values/devset_defaults.xml 提供, + // 各 flavor 可覆寫(General override 為「購物車 + 現金/刷卡/掃碼/發票」全開)。 + android.content.res.Resources devSetRes = getResources(); + this.devSet = new DevSetStructure( + devSetRes.getBoolean(R.bool.devset_default_vmc), + devSetRes.getBoolean(R.bool.devset_default_electric), + devSetRes.getBoolean(R.bool.devset_default_shopping_cart), + devSetRes.getBoolean(R.bool.devset_default_invoice), + devSetRes.getBoolean(R.bool.devset_default_nfc_pay), + devSetRes.getBoolean(R.bool.devset_default_esun_pay), + devSetRes.getBoolean(R.bool.devset_default_tap_pay), + devSetRes.getBoolean(R.bool.devset_default_cash), + devSetRes.getBoolean(R.bool.devset_default_line_pay), + devSetRes.getBoolean(R.bool.devset_default_tap_pay_30), + devSetRes.getBoolean(R.bool.devset_default_tap_pay_31), + devSetRes.getBoolean(R.bool.devset_default_tap_pay_32), + devSetRes.getBoolean(R.bool.devset_default_tap_pay_33), + devSetRes.getBoolean(R.bool.devset_default_tap_pay_34)); this.machine = new MachineStructure(""); this.esunpay = new EsunpayStructure("", "", ""); this.greenInvoice = new GreenInvoiceStructure("", "", "", ""); diff --git a/app/src/main/java/com/unibuy/smartdevice/ui/dialog/BuyDialog.java b/app/src/main/java/com/unibuy/smartdevice/ui/dialog/BuyDialog.java index 8aaf876..f4e2fe3 100644 --- a/app/src/main/java/com/unibuy/smartdevice/ui/dialog/BuyDialog.java +++ b/app/src/main/java/com/unibuy/smartdevice/ui/dialog/BuyDialog.java @@ -235,11 +235,11 @@ public class BuyDialog extends DialogAbstract { } if (MyApp.getInstance().getDevSet().isShoppingCar()) { - if (MyApp.getInstance().getDevSet().isDevNFCPay()) { -// binding.layoutNfcPay.setVisibility(View.VISIBLE); - } else { -// binding.layoutNfcPay.setVisibility(View.GONE); - } + // NFC 卡/儲值/手機(TaiwanStar 無 layoutNfcPay 容器,改逐顆控制),依 isDevNFCPay 顯示/隱藏 + int nfcVisibility = MyApp.getInstance().getDevSet().isDevNFCPay() ? View.VISIBLE : View.GONE; + binding.buttonNfcCard.setVisibility(nfcVisibility); + binding.buttonNfcRecharge.setVisibility(nfcVisibility); + binding.buttonNfcPhone.setVisibility(nfcVisibility); if (MyApp.getInstance().getDevSet().isDevEsunPay()) { binding.buttonEsunPay.setVisibility(View.VISIBLE); diff --git a/app/src/main/res/values/devset_defaults.xml b/app/src/main/res/values/devset_defaults.xml new file mode 100644 index 0000000..6081e21 --- /dev/null +++ b/app/src/main/res/values/devset_defaults.xml @@ -0,0 +1,22 @@ + + + + true + false + false + true + true + true + true + false + false + true + true + true + true + true +