replace unused NFC selection

Instead, tell the user to fix the nfc emulation requirements, e.g.
installing samsung gear plugin or enabling the nfc settings.
This commit is contained in:
Frank Morgner
2017-07-18 08:23:24 +02:00
parent b4b36c8979
commit 51bd1893a2
4 changed files with 42 additions and 14 deletions

View File

@@ -175,4 +175,4 @@ public class MainActivity extends AppCompatActivity {
dialog.dismiss();
super.onPause();
}
}
}

View File

@@ -201,7 +201,30 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
});
bindPreferenceSummaryToValue(findPreference("nfc"));
Preference internal_nfc = findPreference("internal_nfc");
internal_nfc.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
if (android.os.Build.VERSION.SDK_INT >= 16) {
startActivity(new Intent(android.provider.Settings.ACTION_NFC_SETTINGS));
} else {
startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
}
return true;
}
});
Preference gear_nfc = findPreference("gear_nfc");
gear_nfc.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
String gearPackage = "com.samsung.android.gearoplugin";
try {
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("market://details?id="+gearPackage)));
} catch (android.content.ActivityNotFoundException e) {
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+gearPackage)));
}
return true;
}
});
}
@Override

View File

@@ -45,13 +45,6 @@
<string name="jcardsim">Builtin Java Card Simulator</string>
<string name="vicc">Remote Virtual Smart Card</string>
<string-array name="strNFC">
<item>@string/nfc</item>
<item>@string/gear</item>
</string-array>
<string name="nfc">Builtin NFC</string>
<string name="gear">Samsung Accessory</string>
<string name="vicc_config_info">If you choose the virtual smart card (VICC) as emulator, you need to start the it on your computer with the `--reversed` flag and configure the connection parameters here accordingly.</string>
<string name="hint_vicc_port">VICC Port</string>
<string name="hint_vicc_hostname">VICC Hostname</string>

View File

@@ -81,11 +81,23 @@
</PreferenceCategory>
<ListPreference
<PreferenceCategory
android:title="Near Field Communication"
android:key="nfc"
android:title="NFC communication hardware"
android:defaultValue="@string/nfc"
android:entries="@array/strNFC"
android:entryValues="@array/strNFC" />
>
<Preference
android:title="Emulation with Built-in NFC"
android:summary="NFC needs to be enabled for smart card emulation. Use the wireless settings to enable NFC."
android:key="internal_nfc">
</Preference>
<Preference
android:title="Emulation with Gear's NFC"
android:summary="Samsung Gear needs to be installed for using the Gear's NFC emulation capabilities."
android:key="gear_nfc">
</Preference>
</PreferenceCategory>
</PreferenceScreen>