@Override
 public View getView(int position, View convertView, ViewGroup parent) {
   if (convertView == null) {
     convertView = new CircleView(getContext());
     convertView.setLayoutParams(new GridView.LayoutParams(mCircleSize, mCircleSize));
   }
   CircleView child = (CircleView) convertView;
   final int color = isInSub() ? mColorsSub[topIndex()][position] : mColorsTop[position];
   child.setBackgroundColor(color);
   if (isInSub()) child.setSelected(subIndex() == position);
   else child.setSelected(topIndex() == position);
   child.setTag(position);
   child.setOnClickListener(ColorChooserDialog.this);
   return convertView;
 }
示例#2
0
 @Override
 public void setBackgroundResource(@ColorRes int color) {
   setBackgroundColor(DialogUtils.getColor(getContext(), color));
 }