예제 #1
0
    LayerState(LayerState orig, LayerDrawable owner) {
      if (orig != null) {
        final Rec[] origRec = orig.mArray;
        final int N = orig.mNum;

        mNum = N;
        mArray = new Rec[N];

        mChangingConfigurations = orig.mChangingConfigurations;
        mChildrenChangingConfigurations = orig.mChildrenChangingConfigurations;

        for (int i = 0; i < N; i++) {
          final Rec r = mArray[i] = new Rec();
          final Rec or = origRec[i];
          r.mDrawable = or.mDrawable.getConstantState().newDrawable();
          r.mDrawable.setCallback(owner);
          r.mInsetL = or.mInsetL;
          r.mInsetT = or.mInsetT;
          r.mInsetR = or.mInsetR;
          r.mInsetB = or.mInsetB;
          r.mId = or.mId;
        }

        mHaveOpacity = orig.mHaveOpacity;
        mOpacity = orig.mOpacity;
        mHaveStateful = orig.mHaveStateful;
        mStateful = orig.mStateful;
        mCheckedConstantState = mCanConstantState = true;
      } else {
        mNum = 0;
        mArray = null;
      }
    }