[FEAT] General 付款選單啟用 + BuyDialog NFC 顯示控制(Part 2-1)

- DevSet 初始預設值改由 res/values/devset_defaults.xml 提供,各 flavor 可覆寫;
  main 維持原值(Chengwai/Cmuh 行為不變),General override 為購物車 + 現金/
  刷卡/玉山/LINE Pay/發票全開,裝上即可用。
- BuyDialog 購物車分支:NFC 卡/儲值/手機改逐顆依 isDevNFCPay 控制顯示
  (TaiwanStar 無 layoutNfcPay 容器,修正原本指向不存在 view 而被註解的問題)。

三 flavor 編譯通過、General APK 打包成功。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
sky121113 2026-06-10 08:48:07 +08:00
parent cfc802dbb5
commit 402490ee58
4 changed files with 56 additions and 7 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
General flavor 的 DevSet 預設覆寫:裝上即可用多品項購物車 + 指定付款方式。
(現金、刷卡/NFC、玉山掃碼、LINE Pay 掃碼、發票、購物車)
其餘沿用 main 預設TapPay 維持開啟,可於主控台關閉)。
-->
<resources>
<bool name="devset_default_shopping_cart">true</bool>
<bool name="devset_default_cash">true</bool>
<bool name="devset_default_line_pay">true</bool>
</resources>

View File

@ -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("", "", "", "");

View File

@ -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);

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
機台功能開關 DevSet 的「初始預設值」首次開機、DB 尚無設定時套用)。
各 flavor 可於自身 res 覆寫main 此處維持原本寫死的預設,確保 Chengwai/Cmuh 行為不變。
實機上由主控台「系統設定」寫入後存 DB之後以 DB 值為準。
-->
<resources>
<bool name="devset_default_vmc">true</bool>
<bool name="devset_default_electric">false</bool>
<bool name="devset_default_shopping_cart">false</bool>
<bool name="devset_default_invoice">true</bool>
<bool name="devset_default_nfc_pay">true</bool>
<bool name="devset_default_esun_pay">true</bool>
<bool name="devset_default_tap_pay">true</bool>
<bool name="devset_default_cash">false</bool>
<bool name="devset_default_line_pay">false</bool>
<bool name="devset_default_tap_pay_30">true</bool>
<bool name="devset_default_tap_pay_31">true</bool>
<bool name="devset_default_tap_pay_32">true</bool>
<bool name="devset_default_tap_pay_33">true</bool>
<bool name="devset_default_tap_pay_34">true</bool>
</resources>