Skip to content

Commit

Permalink
[Android] Tiny cleanup regarding method indentation in GameListAdapter.
Browse files Browse the repository at this point in the history
getItem() and getView were a little off-kilter with the rest of the class. Keeps things more consistent, etc.
  • Loading branch information
lioncash committed Jul 18, 2013
1 parent a3e289e commit 2e92e38
Showing 1 changed file with 39 additions and 41 deletions.
80 changes: 39 additions & 41 deletions Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java
Expand Up @@ -12,46 +12,44 @@

public class GameListAdapter extends ArrayAdapter<GameListItem>{

private Context c;
private int id;
private List<GameListItem>items;

public GameListAdapter(Context context, int textViewResourceId,
List<GameListItem> objects) {
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}
public GameListItem getItem(int i)
{
return items.get(i);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}
final GameListItem o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.GameItemTitle);
TextView t2 = (TextView) v.findViewById(R.id.GameItemSubText);
ImageView v1 = (ImageView) v.findViewById(R.id.GameItemIcon);

if(t1!=null)
t1.setText(o.getName());
if(t2!=null)
t2.setText(o.getData());
if(v1!=null)
v1.setImageBitmap(o.getImage());

}
return v;
}



private Context c;
private int id;
private List<GameListItem>items;

public GameListAdapter(Context context, int textViewResourceId, List<GameListItem> objects) {
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}

public GameListItem getItem(int i)
{
return items.get(i);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}

final GameListItem o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.GameItemTitle);
TextView t2 = (TextView) v.findViewById(R.id.GameItemSubText);
ImageView v1 = (ImageView) v.findViewById(R.id.GameItemIcon);

if(t1!=null)
t1.setText(o.getName());
if(t2!=null)
t2.setText(o.getData());
if(v1!=null)
v1.setImageBitmap(o.getImage());
}
return v;
}
}

0 comments on commit 2e92e38

Please sign in to comment.