summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/nfc
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2013-09-05 21:07:23 -0700
committerMartijn Coenen <maco@google.com>2013-09-11 12:30:46 +0200
commitda6c0ba382c1c2c9b98f11a1ef9e572472654e27 (patch)
tree8a0b9bc550d79acf8981d86b27888eb1667d6e7e /src/com/android/settings/nfc
parente9aa0a94d0572101dd580bcc48e23b96e6c6cb71 (diff)
downloadpackages_apps_Settings-da6c0ba382c1c2c9b98f11a1ef9e572472654e27.zip
packages_apps_Settings-da6c0ba382c1c2c9b98f11a1ef9e572472654e27.tar.gz
packages_apps_Settings-da6c0ba382c1c2c9b98f11a1ef9e572472654e27.tar.bz2
HCE: Latest UX and strings.
Bug: 10262585 Change-Id: I5473c4d387fed884faf77c7448fab1332f710557
Diffstat (limited to 'src/com/android/settings/nfc')
-rw-r--r--src/com/android/settings/nfc/PaymentBackend.java4
-rw-r--r--src/com/android/settings/nfc/PaymentDefaultDialog.java11
-rw-r--r--src/com/android/settings/nfc/PaymentSettings.java40
3 files changed, 46 insertions, 9 deletions
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index e2f110f..59f4ddf 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -33,7 +33,7 @@ public class PaymentBackend {
public static class PaymentAppInfo {
CharSequence caption;
- Drawable icon;
+ Drawable banner;
boolean isDefault;
public ComponentName componentName;
}
@@ -62,7 +62,7 @@ public class PaymentBackend {
for (ApduServiceInfo service : serviceInfos) {
PaymentAppInfo appInfo = new PaymentAppInfo();
appInfo.caption = service.loadLabel(pm);
- appInfo.icon = service.loadIcon(pm);
+ appInfo.banner = service.loadBanner(pm);
appInfo.isDefault = service.getComponent().equals(defaultApp);
appInfo.componentName = service.getComponent();
appInfos.add(appInfo);
diff --git a/src/com/android/settings/nfc/PaymentDefaultDialog.java b/src/com/android/settings/nfc/PaymentDefaultDialog.java
index ae2f4c1..538af2e 100644
--- a/src/com/android/settings/nfc/PaymentDefaultDialog.java
+++ b/src/com/android/settings/nfc/PaymentDefaultDialog.java
@@ -125,12 +125,15 @@ public final class PaymentDefaultDialog extends AlertActivity implements
// Compose dialog; get
final AlertController.AlertParams p = mAlertParams;
- p.mTitle = getString(R.string.nfc_payment_set_default);
+ p.mTitle = getString(R.string.nfc_payment_set_default_label);
if (defaultAppInfo == null) {
- p.mMessage = "Always use " + newAppInfo.loadLabel(pm) + " when you tap and pay?";
+ String formatString = getString(R.string.nfc_payment_set_default);
+ String msg = String.format(formatString, newAppInfo.loadLabel(pm));
+ p.mMessage = msg;
} else {
- p.mMessage = "Always use " + newAppInfo.loadLabel(pm) + " instead of " +
- defaultAppInfo.loadLabel(pm) + " when you tap and pay?";
+ String formatString = getString(R.string.nfc_payment_set_default_instead_of);
+ String msg = String.format(formatString, newAppInfo.loadLabel(pm), defaultAppInfo.loadLabel(pm));
+ p.mMessage = msg;
}
p.mPositiveButtonText = getString(R.string.yes);
p.mNegativeButtonText = getString(R.string.no);
diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java
index af569ac..d3ccbaf 100644
--- a/src/com/android/settings/nfc/PaymentSettings.java
+++ b/src/com/android/settings/nfc/PaymentSettings.java
@@ -21,9 +21,14 @@ import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
+import android.util.Log;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ImageView;
import android.widget.RadioButton;
+import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
@@ -34,14 +39,17 @@ import java.util.List;
public class PaymentSettings extends SettingsPreferenceFragment implements
OnClickListener {
public static final String TAG = "PaymentSettings";
+ private LayoutInflater mInflater;
private PaymentBackend mPaymentBackend;
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setHasOptionsMenu(false);
mPaymentBackend = new PaymentBackend(getActivity());
+ mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void refresh() {
@@ -55,12 +63,35 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
for (PaymentAppInfo appInfo : appInfos) {
PaymentAppPreference preference =
new PaymentAppPreference(getActivity(), appInfo, this);
- preference.setIcon(appInfo.icon);
preference.setTitle(appInfo.caption);
- screen.addPreference(preference);
+ if (appInfo.banner != null) {
+ screen.addPreference(preference);
+ } else {
+ // Ignore, no banner
+ Log.e(TAG, "Couldn't load banner drawable of service " + appInfo.componentName);
+ }
}
}
- setPreferenceScreen(screen);
+ TextView emptyText = (TextView) getView().findViewById(R.id.nfc_payment_empty_text);
+ ImageView emptyImage = (ImageView) getView().findViewById(R.id.nfc_payment_tap_image);
+ if (screen.getPreferenceCount() == 0) {
+ emptyText.setVisibility(View.VISIBLE);
+ emptyImage.setVisibility(View.VISIBLE);
+ } else {
+ emptyText.setVisibility(View.GONE);
+ emptyImage.setVisibility(View.GONE);
+ setPreferenceScreen(screen);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ super.onCreateView(inflater, container, savedInstanceState);
+
+ View v = mInflater.inflate(R.layout.nfc_payment, container, false);
+
+ return v;
}
@Override
@@ -101,6 +132,9 @@ public class PaymentSettings extends SettingsPreferenceFragment implements
RadioButton radioButton = (RadioButton) view.findViewById(android.R.id.button1);
radioButton.setChecked(appInfo.isDefault);
+
+ ImageView banner = (ImageView) view.findViewById(R.id.banner);
+ banner.setImageDrawable(appInfo.banner);
}
}
} \ No newline at end of file