Android Open Source - Android_OSM_offlinemap Color Picker Adapter






From Project

Back to project page Android_OSM_offlinemap.

License

The source code is released under:

GNU General Public License

If you think the Android project Android_OSM_offlinemap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.vellut.offlinemap;
/* w w  w .  j a v a 2 s. c  o m*/
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

public class ColorPickerAdapter extends ArrayAdapter<Integer> {

  private int resourceId;
  private Context context;

  public ColorPickerAdapter(Context context, int resource, Integer[] objects) {
    super(context, resource, objects);
    this.context = context;
    this.resourceId = resource;
  }

  public ColorPickerAdapter(Context context, int resource, List<Integer> objects) {
    super(context, resource, objects);
    this.context = context;
    this.resourceId = resource;
  }

  @Override
  public View getDropDownView(int position, View convertView, ViewGroup parent) {
    return getCustomView(position, convertView, parent);
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    return getCustomView(position, convertView, parent);
  }

  private View getCustomView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      LayoutInflater inflater = (LayoutInflater) context
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = inflater.inflate(resourceId, parent, false);
    }
    convertView.setBackgroundColor(getItem(position));
    return convertView;
  }

}




Java Source Code List

com.vellut.offlinemap.CircleDrawable.java
com.vellut.offlinemap.ColorPickerAdapter.java
com.vellut.offlinemap.CopyrightMapView.java
com.vellut.offlinemap.CurrentPositionDrawable.java
com.vellut.offlinemap.CurrentPosition.java
com.vellut.offlinemap.FileExplorerActivity.java
com.vellut.offlinemap.MainActivity.java
com.vellut.offlinemap.MapAnnotationEditActivity.java
com.vellut.offlinemap.MapAnnotation.java
com.vellut.offlinemap.MapData.java
com.vellut.offlinemap.MarkerFactory.java
com.vellut.offlinemap.StarDrawable.java
com.vellut.offlinemap.Utils.java