summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/nfc/NfcPaymentPreference.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/nfc/NfcPaymentPreference.java')
-rw-r--r--src/com/android/settings/nfc/NfcPaymentPreference.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/com/android/settings/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
index e8dcf0b..0eef242 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreference.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -29,6 +29,7 @@ import android.widget.BaseAdapter;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RadioButton;
+import android.content.pm.PackageManager;
import com.android.settings.R;
import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
@@ -129,7 +130,7 @@ public class NfcPaymentPreference extends DialogPreference implements
}
class NfcPaymentAdapter extends BaseAdapter implements CompoundButton.OnCheckedChangeListener,
- View.OnClickListener {
+ View.OnClickListener, View.OnLongClickListener {
// Only modified on UI thread
private PaymentAppInfo[] appInfos;
@@ -175,6 +176,7 @@ public class NfcPaymentPreference extends DialogPreference implements
holder.imageView.setTag(appInfo);
holder.imageView.setContentDescription(appInfo.label);
holder.imageView.setOnClickListener(this);
+ holder.imageView.setOnLongClickListener(this);
// Prevent checked callback getting called on recycled views
holder.radioButton.setOnCheckedChangeListener(null);
@@ -202,6 +204,28 @@ public class NfcPaymentPreference extends DialogPreference implements
makeDefault(appInfo);
}
+ @Override
+ public boolean onLongClick(View view){
+ PaymentAppInfo appInfo = (PaymentAppInfo) view.getTag();
+ if (appInfo.componentName != null) {
+ Log.d(TAG, "LongClick: " + appInfo.componentName.toString());
+ PackageManager pm = mContext.getPackageManager();
+ Intent gsmaIntent =
+ pm.getLaunchIntentForPackage(appInfo.componentName.getPackageName());
+ if (gsmaIntent != null) {
+ gsmaIntent.setAction("com.gsma.services.nfc.SELECT_DEFAULT_SERVICE");
+ gsmaIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
+ gsmaIntent.setPackage(gsmaIntent.getPackage());
+ try {
+ mContext.startActivity(gsmaIntent);
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "Settings activity for " + appInfo.componentName.toString() + " not found.");
+ }
+ }
+ }
+ return true;
+ }
+
void makeDefault(PaymentAppInfo appInfo) {
if (!appInfo.isDefault) {
mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);