HCE: Latest UX and strings.
Bug: 10262585 Change-Id: I5473c4d387fed884faf77c7448fab1332f710557
This commit is contained in:
@@ -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