add multilanguage string

master
wlt233 2 years ago
parent 1d404bf4bf
commit 70f4895097

@ -69,13 +69,13 @@ class MainActivity : AppCompatActivity() {
if (nfcAdapter == null) {
Log.e(TAG, "NFC not supported")
AlertDialog.Builder(this)
.setTitle("Error").setMessage("NFC not supported").setCancelable(false).show()
.setTitle(R.string.error).setMessage("NFC not supported").setCancelable(false).show()
return
}
if (!nfcAdapter!!.isEnabled) {
Log.e(TAG, "NFC is off")
AlertDialog.Builder(this)
.setTitle("Error").setMessage("NFC is off").setCancelable(false).show()
.setTitle(R.string.error).setMessage("NFC is off").setCancelable(false).show()
return
}
@ -165,7 +165,7 @@ class MainActivity : AppCompatActivity() {
private fun showCardMenu(v: View, cardView: View) {
val popupMenu = PopupMenu(this, v)
popupMenu.inflate(R.menu.card_menu) // 加载菜单资源文件
popupMenu.inflate(R.menu.card_menu)
popupMenu.setOnMenuItemClickListener { item: MenuItem ->
when (item.itemId) {
R.id.card_menu_rename -> {
@ -175,7 +175,7 @@ class MainActivity : AppCompatActivity() {
editText.visibility = View.VISIBLE
editText.setText(textView.text)
editText.requestFocus()
editText.setOnFocusChangeListener { v, hasFocus ->
editText.setOnFocusChangeListener { _, hasFocus ->
if (!hasFocus) {
textView.text = editText.text
textView.visibility = View.VISIBLE
@ -183,11 +183,6 @@ class MainActivity : AppCompatActivity() {
saveCards()
}
}
// cardView.setOnTouchListener { v, _ ->
// editText.clearFocus()
// v.performClick()
// true
// }
true
}
R.id.card_menu_delete -> {
@ -199,7 +194,7 @@ class MainActivity : AppCompatActivity() {
else -> false
}
}
popupMenu.show() // 显示PopupMenu
popupMenu.show()
}

@ -39,7 +39,7 @@
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:clickable="true"
android:contentDescription="@string/add_card"
android:contentDescription="@string/desc_add_card"
android:focusable="true"
app:backgroundTint="@color/colorSecondary"
app:maxImageSize="35dp"

@ -30,7 +30,7 @@
android:text="@string/read_card_tip"
android:textColor="@color/design_default_color_on_primary"
android:textSize="18sp"
android:contentDescription="@string/close_popup" />
android:contentDescription="@string/desc_close_popup" />
</androidx.cardview.widget.CardView>

@ -19,7 +19,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="@string/card_name"
android:text="@string/dummy_card_name"
android:textColor="?android:attr/textColorPrimary"
android:textSize="40sp" />
@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="@string/card_name"
android:text="@string/dummy_card_name"
android:textColor="?android:attr/textColorPrimary"
android:textSize="40sp"
android:visibility="gone" />
@ -64,7 +64,7 @@
android:layout_marginEnd="10dp"
android:layout_gravity="end|top"
android:background="@null"
android:contentDescription="@string/edit_card"
android:contentDescription="@string/desc_edit_card"
android:src="@android:drawable/ic_menu_edit" />
</androidx.cardview.widget.CardView>

@ -0,0 +1,10 @@
<resources>
<string name="settings">设置</string>
<string name="dummy_card_name">AIC Card</string>
<string name="read_card_tip">请与AIC卡贴贴</string>
<string name="rename">改名</string>
<string name="delete">删除</string>
<string name="show_idm">展示卡号</string>
<string name="hide_idm">隐藏卡号</string>
<string name="error">出错了!</string>
</resources>

@ -1,14 +1,16 @@
<resources>
<string name="app_name">AICEmu</string>
<string name="app_name" translatable="false">AICEmu</string>
<string name="rename">Rename</string>
<string name="delete">Delete</string>
<string name="show_idm">Show IDm</string>
<string name="hide_idm">Hide IDm</string>
<string name="settings">Settings</string>
<string name="add_card">add card</string>
<string name="edit_card">edit card</string>
<string name="close_popup">close</string>
<string name="dummy_card_id">012EXXXXXXXXXXXX</string>
<string name="card_name">AIC Card</string>
<string name="read_card_tip">请与AIC卡贴贴</string>
<string name="service_desc">EmuCard</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="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>
<string name="desc_service" translatable="false">EmuCard</string>
</resources>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<host-nfcf-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/service_desc">
android:description="@string/desc_service">
<nfcid2-filter android:name="02FE000000000000" />
<system-code-filter android:name="4000" />
</host-nfcf-service>
Loading…
Cancel
Save