Loading res/layout/nfc_payment_option.xml +1 −8 Original line number Diff line number Diff line Loading @@ -26,15 +26,8 @@ android:background="?android:attr/selectableItemBackground"> <RadioButton xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button" android:layout_width="wrap_content" android:layout_width="match_parent" android:layout_height="fill_parent" android:checkMark="?android:attr/listChoiceIndicatorSingle" /> <ImageView android:id="@+id/banner" android:layout_width="wrap_content" android:layout_height="64dp" android:scaleType="centerInside" android:clickable="true" /> </LinearLayout> src/com/android/settings/nfc/NfcPaymentPreferenceController.java +3 −8 Original line number Diff line number Diff line Loading @@ -183,7 +183,7 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp } public void updateApps(PaymentAppInfo[] appInfos) { // Clone app infos, only add those with a banner // Clone app infos, only add an application label this.appInfos = appInfos; notifyDataSetChanged(); } Loading Loading @@ -211,16 +211,11 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp convertView = mLayoutInflater.inflate( R.layout.nfc_payment_option, parent, false); holder = new ViewHolder(); holder.imageView = convertView.findViewById(R.id.banner); holder.radioButton = convertView.findViewById(R.id.button); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.imageView.setImageDrawable(appInfo.banner); holder.imageView.setTag(appInfo); holder.imageView.setContentDescription(appInfo.label); holder.imageView.setOnClickListener(this); // Prevent checked callback getting called on recycled views holder.radioButton.setOnCheckedChangeListener(null); Loading @@ -228,11 +223,11 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp holder.radioButton.setContentDescription(appInfo.label); holder.radioButton.setOnCheckedChangeListener(this); holder.radioButton.setTag(appInfo); holder.radioButton.setText(appInfo.label); return convertView; } private class ViewHolder { public ImageView imageView; public RadioButton radioButton; } Loading src/com/android/settings/nfc/PaymentBackend.java +1 −16 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ public class PaymentBackend { public static class PaymentAppInfo { public CharSequence label; CharSequence description; Drawable banner; boolean isDefault; public ComponentName componentName; public ComponentName settingsComponent; Loading Loading @@ -111,7 +110,6 @@ public class PaymentBackend { appInfo.settingsComponent = null; } appInfo.description = service.getDescription(); appInfo.banner = service.loadBanner(pm); appInfos.add(appInfo); } mAppInfos = appInfos; Loading Loading @@ -141,19 +139,6 @@ public class PaymentBackend { } } Drawable loadDrawableForPackage(String pkgName, int drawableResId) { PackageManager pm = mContext.getPackageManager(); try { Resources res = pm.getResourcesForApplication(pkgName); Drawable banner = res.getDrawable(drawableResId); return banner; } catch (Resources.NotFoundException e) { return null; } catch (PackageManager.NameNotFoundException e) { return null; } } boolean isForegroundMode() { try { return Settings.Secure.getInt(mContext.getContentResolver(), Loading Loading
res/layout/nfc_payment_option.xml +1 −8 Original line number Diff line number Diff line Loading @@ -26,15 +26,8 @@ android:background="?android:attr/selectableItemBackground"> <RadioButton xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button" android:layout_width="wrap_content" android:layout_width="match_parent" android:layout_height="fill_parent" android:checkMark="?android:attr/listChoiceIndicatorSingle" /> <ImageView android:id="@+id/banner" android:layout_width="wrap_content" android:layout_height="64dp" android:scaleType="centerInside" android:clickable="true" /> </LinearLayout>
src/com/android/settings/nfc/NfcPaymentPreferenceController.java +3 −8 Original line number Diff line number Diff line Loading @@ -183,7 +183,7 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp } public void updateApps(PaymentAppInfo[] appInfos) { // Clone app infos, only add those with a banner // Clone app infos, only add an application label this.appInfos = appInfos; notifyDataSetChanged(); } Loading Loading @@ -211,16 +211,11 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp convertView = mLayoutInflater.inflate( R.layout.nfc_payment_option, parent, false); holder = new ViewHolder(); holder.imageView = convertView.findViewById(R.id.banner); holder.radioButton = convertView.findViewById(R.id.button); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.imageView.setImageDrawable(appInfo.banner); holder.imageView.setTag(appInfo); holder.imageView.setContentDescription(appInfo.label); holder.imageView.setOnClickListener(this); // Prevent checked callback getting called on recycled views holder.radioButton.setOnCheckedChangeListener(null); Loading @@ -228,11 +223,11 @@ public class NfcPaymentPreferenceController extends BasePreferenceController imp holder.radioButton.setContentDescription(appInfo.label); holder.radioButton.setOnCheckedChangeListener(this); holder.radioButton.setTag(appInfo); holder.radioButton.setText(appInfo.label); return convertView; } private class ViewHolder { public ImageView imageView; public RadioButton radioButton; } Loading
src/com/android/settings/nfc/PaymentBackend.java +1 −16 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ public class PaymentBackend { public static class PaymentAppInfo { public CharSequence label; CharSequence description; Drawable banner; boolean isDefault; public ComponentName componentName; public ComponentName settingsComponent; Loading Loading @@ -111,7 +110,6 @@ public class PaymentBackend { appInfo.settingsComponent = null; } appInfo.description = service.getDescription(); appInfo.banner = service.loadBanner(pm); appInfos.add(appInfo); } mAppInfos = appInfos; Loading Loading @@ -141,19 +139,6 @@ public class PaymentBackend { } } Drawable loadDrawableForPackage(String pkgName, int drawableResId) { PackageManager pm = mContext.getPackageManager(); try { Resources res = pm.getResourcesForApplication(pkgName); Drawable banner = res.getDrawable(drawableResId); return banner; } catch (Resources.NotFoundException e) { return null; } catch (PackageManager.NameNotFoundException e) { return null; } } boolean isForegroundMode() { try { return Settings.Secure.getInt(mContext.getContentResolver(), Loading