add compatible mode; fix strings

master
wlt233 2 years ago
parent 8029450f73
commit 4ffdfce27d

@ -34,11 +34,12 @@ class MainActivity : AppCompatActivity() {
private var nfcAdapter: NfcAdapter? = null
private var nfcFCardEmulation: NfcFCardEmulation? = null
private var nfcPendingIntent: PendingIntent? = null
private val gson = Gson()
private var cards = mutableListOf<Card>()
private val gson = Gson()
private val cardsJsonPath = "card.json"
private var showCardID: Boolean = false
private val TAG = "AICEmu"
private var showCardID: Boolean = false
private var compatibleID: Boolean = false
override fun onCreate(savedInstanceState: Bundle?) {
@ -69,13 +70,13 @@ class MainActivity : AppCompatActivity() {
if (nfcAdapter == null) {
Log.e(TAG, "NFC not supported")
AlertDialog.Builder(this)
.setTitle(R.string.error).setMessage("NFC not supported").setCancelable(false).show()
.setTitle(R.string.error).setMessage(R.string.nfc_not_supported).setCancelable(false).show()
return
}
if (!nfcAdapter!!.isEnabled) {
Log.e(TAG, "NFC is off")
AlertDialog.Builder(this)
.setTitle(R.string.error).setMessage("NFC is off").setCancelable(false).show()
.setTitle(R.string.error).setMessage(R.string.nfc_not_on).setCancelable(false).show()
return
}
@ -126,15 +127,25 @@ class MainActivity : AppCompatActivity() {
return when (item.itemId) {
R.id.toolbar_menu_hide_id -> {
showCardID = !showCardID
item.title = if (showCardID) {
"Hide IDm"
item.setTitle(if (showCardID) {
R.string.hide_idm
}
else {
"Show IDm"
}
R.string.show_idm
})
checkCardIDShadow()
true
}
R.id.toolbar_menu_compatible -> {
compatibleID = !compatibleID
item.setTitle(if (compatibleID) {
R.string.compatible_off
}
else {
R.string.compatible_on
})
true
}
R.id.toolbar_menu_settings -> {
Toast.makeText(applicationContext, "还没做()\nUnder constuction...", Toast.LENGTH_LONG).show()
// TODO
@ -218,8 +229,15 @@ class MainActivity : AppCompatActivity() {
val globalVar = this.applicationContext as GlobalVar
val cardIDmTextView = cardView.findViewById<TextView>(R.id.card_id)
globalVar.IDm = cardIDmTextView.text.toString()
//val resultIdm = setIDm(IDm)
val resultIdm = setIDm("02fe000000000000") // hardcoded idm for sbga
var resultIdm = if (compatibleID) {
// hardcoded idm for specific model e.g. Samsung S8
// idm needs to start with 02, or syscode won't be added to polling ack
// konmai reader read this idm while sbga reader do not check this
setIDm("02fe001145141919")
}
else {
setIDm(globalVar.IDm)
}
val resultSys = setSys("88B4") // hardcoded syscode for sbga
val cardNameTextView = cardView.findViewById<TextView>(R.id.card_name)

@ -5,6 +5,9 @@
<item
android:id="@+id/toolbar_menu_hide_id"
android:title="@string/show_idm" />
<item
android:id="@+id/toolbar_menu_compatible"
android:title="@string/compatible_on" />
<item
android:id="@+id/toolbar_menu_settings"
android:title="@string/settings" />

@ -7,4 +7,8 @@
<string name="show_idm">展示卡号</string>
<string name="hide_idm">隐藏卡号</string>
<string name="error">出错了!</string>
<string name="compatible_on">打开兼容模式</string>
<string name="compatible_off">关闭兼容模式</string>
<string name="nfc_not_on">NFC 没开...</string>
<string name="nfc_not_supported">设备不支持 NFC...</string>
</resources>

@ -4,11 +4,15 @@
<string name="delete">Delete</string>
<string name="show_idm">Show IDm</string>
<string name="hide_idm">Hide IDm</string>
<string name="compatible_on">Compatible mode on</string>
<string name="compatible_off">Compatible mode off</string>
<string name="settings">Settings</string>
<string name="error">Error!</string>
<string name="dummy_card_name">AIC Card</string>
<string name="dummy_card_id" translatable="false">012EXXXXXXXXXXXX</string>
<string name="read_card_tip">Please touch your AIC Card!</string>
<string name="nfc_not_supported">NFC not supported</string>
<string name="nfc_not_on">NFC is off...</string>
<string name="desc_add_card" translatable="false">add card</string>
<string name="desc_edit_card" translatable="false">edit card</string>
<string name="desc_close_popup" translatable="false">close</string>

Loading…
Cancel
Save