android.graphics.drawable.shapes.ArcShape Java Examples

The following examples show how to use android.graphics.drawable.shapes.ArcShape. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaletteGridAdapter.java    From color-picker with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    View view = convertView;
    if (view == null)
    {
        view = mLayoutInflater.inflate(R.layout.dmfs_colorpickerdialog_palette_field, null);
    }

    // set the background to a colored circle
    // TODO: allow to customize the shape
    Shape shape = new ArcShape(0, 360);
    ShapeDrawable bg = new ShapeDrawable(shape);
    bg.getPaint().setColor(mPalette.colorAt(position));

    if (android.os.Build.VERSION.SDK_INT < 16)
    {
        view.setBackgroundDrawable(bg);
    }
    else
    {
        view.setBackground(bg);
    }

    return view;

}