[Android] Readability cleanup in IconAdapter.java.

This commit is contained in:
Lioncash 2013-10-31 05:06:31 -04:00
parent 97c1745909
commit e11b678ddd

View File

@ -37,27 +37,27 @@ public final class IconAdapter<T extends IconAdapterItem> extends ArrayAdapter<T
IconAdapterItem item = getItem(position);
final boolean enabled = item.isEnabled();
TextView textView = (TextView) convertView.findViewById(R.id.name);
if (null != textView) {
textView.setText(item.getText());
textView.setEnabled(enabled);
TextView title = (TextView) convertView.findViewById(R.id.name);
if (title != null) {
title.setText(item.getText());
title.setEnabled(enabled);
}
textView = (TextView) convertView.findViewById(R.id.sub_name);
if (null != textView) {
TextView subtitle = (TextView) convertView.findViewById(R.id.sub_name);
if (subtitle != null) {
String subText = item.getSubText();
if (null != subText) {
textView.setVisibility(View.VISIBLE);
textView.setEnabled(item.isEnabled());
textView.setText(subText);
if (subText != null) {
subtitle.setVisibility(View.VISIBLE);
subtitle.setEnabled(item.isEnabled());
subtitle.setText(subText);
}
}
ImageView imageView = (ImageView) convertView.findViewById(R.id.icon);
if (null != imageView) {
if (imageView != null) {
if (enabled) {
final int id = item.getIconResourceId();
if (0 != id) {
if (id != 0) {
imageView.setImageResource(id);
} else {
imageView.setImageDrawable(item.getIconDrawable());