1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.ui; 6 7import android.graphics.Canvas; 8import android.graphics.ColorFilter; 9import android.graphics.Paint; 10import android.graphics.PixelFormat; 11import android.graphics.Rect; 12import android.graphics.drawable.Drawable; 13 14class DropdownDividerDrawable extends Drawable { 15 16 private Paint mPaint; 17 private Rect mDividerRect; 18 19 public DropdownDividerDrawable() { 20 mPaint = new Paint(); 21 mDividerRect = new Rect(); 22 } 23 24 @Override 25 public void draw(Canvas canvas) { 26 canvas.drawRect(mDividerRect, mPaint); 27 } 28 29 @Override 30 public void onBoundsChange(Rect bounds) { 31 mDividerRect.set(0, 0, bounds.width(), mDividerRect.height()); 32 } 33 34 public void setHeight(int height) { 35 mDividerRect.set(0, 0, mDividerRect.right, height); 36 } 37 38 public void setColor(int color) { 39 mPaint.setColor(color); 40 } 41 42 @Override 43 public void setAlpha(int alpha) { 44 } 45 46 @Override 47 public void setColorFilter(ColorFilter cf) { 48 } 49 50 @Override 51 public int getOpacity() { 52 return PixelFormat.OPAQUE; 53 } 54} 55