コード例 #1
0
  public DrawableContainerConstantState(
      DrawableContainerConstantState state, DrawableContainer owner) {
    this.owner = owner;

    if (state != null) {
      List<Drawable> drawables = new ArrayList<>();

      for (Drawable drawable : state.getDrawables()) {
        Drawable copyDrawable = drawable.copy();
        copyDrawable.setDelegate(owner);

        drawables.add(copyDrawable);
      }

      this.drawables = drawables;
      this.constantIntrinsicSize = state.constantIntrinsicSize;
      this.constantMinimumSize = state.constantMinimumSize;
      this.constantSizeComputed = state.constantSizeComputed;
      this.haveStateful = state.haveStateful;
      this.stateful = state.stateful;
      this.paddingComputed = state.paddingComputed;
      this.padding = state.padding;
      this.hasPadding = state.hasPadding;
    } else {
      this.drawables = new ArrayList<>();
    }
  }
コード例 #2
0
  public void addChildDrawable(Drawable drawable) {
    drawables.add(drawable);
    drawable.setDelegate(this.owner);

    this.haveStateful = false;
    this.constantSizeComputed = false;
    this.paddingComputed = false;
  }