package com.cauchymop.goblob.ui;

import android.content.Context;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.cauchymop.goblob.R;
import com.google.common.base.Strings;

import java.util.List;

/**
 * Adapter displaying MatchMenuItem from the actionbar navigation spinner.
 */
public class MatchesAdapter extends ArrayAdapter<MatchMenuItem> {

  public MatchesAdapter(Context context, List<MatchMenuItem> items) {
    super(context, R.layout.match_row_view, items);
  }

  @Override @NonNull
  public View getDropDownView(int position, View convertView, ViewGroup parent) {
    final View matchRowView;

    if (convertView == null) {
      LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      matchRowView = inflater.inflate(R.layout.match_row_view, parent, false);
    } else {
      matchRowView = convertView;
    }

    MatchMenuItem item = getItem(position);
    int textColor = item.isValid() ? Color.BLACK : Color.RED;

    TextView firstLineLabelView = (TextView) matchRowView.findViewById( R.id.label_first_line);
    firstLineLabelView.setText(item.getFirstLine(getContext()));
    firstLineLabelView.setTextColor(textColor);

    TextView secondLineLabelView = (TextView) matchRowView.findViewById( R.id.label_second_line);
    String secondLine = item.getSecondLine(getContext());
    secondLineLabelView.setText(secondLine);
    secondLineLabelView.setVisibility(Strings.isNullOrEmpty(secondLine) ? View.GONE : View.VISIBLE);
    secondLineLabelView.setTextColor(textColor);

    ImageView iconView = (ImageView) matchRowView.findViewById( R.id.match_type_icon);
    iconView.setImageDrawable(item.getIcon(getContext()));
    // May have been set to GONE if it was a closed view.
    iconView.setVisibility(View.VISIBLE);

    return matchRowView;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO: Add number of games by turn status
    final View matchRowView = getDropDownView(position, convertView, parent);
    View icon = matchRowView.findViewById(R.id.match_type_icon);
    icon.setVisibility(View.GONE);
    return matchRowView;
  }
}

@@ -799,24 +799,400 @@
 p parent) %7B%0A
+    return populateView(position, convertView, parent, true);%0A  %7D%0A%0A  @Override%0A  public View getView(int position, View convertView, ViewGroup parent) %7B%0A    // TODO: Add number of games by turn status%0A    return populateView(position, convertView, parent, false);%0A  %7D%0A%0A  @NonNull%0A  public View populateView(int position, View convertView, ViewGroup parent, boolean hasIcon) %7B%0A
     final Vi
@@ -2234,32 +2234,52 @@
 tch_type_icon);%0A
+    if(hasIcon) %7B%0A  
     iconView.set
@@ -2327,64 +2327,8 @@
 ;%0A  
-  // May have been set to GONE if it was a closed view.%0A
     
@@ -2369,324 +2369,35 @@
 E);%0A
-%0A
     
-return matchRowView;%0A  %7D%0A%0A  @Override%0A  public View getView(int position, View convertView, ViewGroup parent) %7B%0A    // TODO: Add number of games by turn status%0A    final View matchRowView = getDropDownView(position, convertView, parent);%0A    View icon = matchRowView.findViewById(R.id.match_type_icon);%0A    icon
+%7D else %7B%0A      iconView
 .set
@@ -2415,24 +2415,31 @@
 View.GONE);%0A
+    %7D%0A%0A
     return m

Make getView and getDropDownView independent from each other.