HCE: Latest UX and strings.
Bug: 10262585 Change-Id: I5473c4d387fed884faf77c7448fab1332f710557
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user