public void setImageRepeat(boolean repeat) {
   int length = drawables.size();
   for (int i = 0; i < length; i++) {
     OneStateDrawable drawable = drawables.valueAt(i);
     drawable.setImageRepeat(repeat);
   }
 }
 public void releaseDelegate() {
   int length = drawables.size();
   for (int i = 0; i < length; i++) {
     OneStateDrawable drawable = drawables.valueAt(i);
     drawable.releaseDelegate();
   }
 }
 public void setDefaultColor(int defaultColor) {
   this.defaultColor = defaultColor;
   int length = drawables.size();
   for (int i = 0; i < length; i++) {
     OneStateDrawable drawable = drawables.valueAt(i);
     drawable.setDefaultColor(defaultColor);
   }
 }
  private OneStateDrawable getOrCreateDrawableForState(int[] stateSet) {
    OneStateDrawable drawable;
    int key = keyOfStateSet(stateSet);
    if (key == -1) {
      key = mStateSets.size();
      mStateSets.append(key, stateSet);
      drawable = new OneStateDrawable(this);
      drawable.setAlpha(this.alpha);
      drawable.setDefaultColor(defaultColor);
      drawable.setBounds(bounds);
      drawables.append(key, drawable);

      int currentKey = keyOfBestMatchingStateSet(getState());
      if (currentKey == key) {
        currentDrawable = drawable;
      }
    } else {
      drawable = drawables.get(key);
    }
    return drawable;
  }
  @Override
  public void draw(Canvas canvas) {
    canvas.save();

    if (currentDrawable != null) {
      currentDrawable.draw(canvas);
    } else if (defaultColor != Color.TRANSPARENT) {
      if (path != null) {

        paint.setColor(defaultColor);
        canvas.drawPath(path, paint);
      } else {
        canvas.drawColor(defaultColor);
      }
    }

    canvas.restore();
  }