T consumeAttributes()

in shimmer/src/main/java/com/facebook/shimmer/Shimmer.java [149:250]


    T consumeAttributes(TypedArray a) {
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_clip_to_children)) {
        setClipToChildren(
            a.getBoolean(
                R.styleable.ShimmerFrameLayout_shimmer_clip_to_children, mShimmer.clipToChildren));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_auto_start)) {
        setAutoStart(
            a.getBoolean(R.styleable.ShimmerFrameLayout_shimmer_auto_start, mShimmer.autoStart));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_base_alpha)) {
        setBaseAlpha(a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_base_alpha, 0.3f));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_highlight_alpha)) {
        setHighlightAlpha(a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_highlight_alpha, 1f));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_duration)) {
        setDuration(
            a.getInt(
                R.styleable.ShimmerFrameLayout_shimmer_duration, (int) mShimmer.animationDuration));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_repeat_count)) {
        setRepeatCount(
            a.getInt(R.styleable.ShimmerFrameLayout_shimmer_repeat_count, mShimmer.repeatCount));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_repeat_delay)) {
        setRepeatDelay(
            a.getInt(
                R.styleable.ShimmerFrameLayout_shimmer_repeat_delay, (int) mShimmer.repeatDelay));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_repeat_mode)) {
        setRepeatMode(
            a.getInt(R.styleable.ShimmerFrameLayout_shimmer_repeat_mode, mShimmer.repeatMode));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_start_delay)) {
        setStartDelay(
            a.getInt(
                R.styleable.ShimmerFrameLayout_shimmer_start_delay, (int) mShimmer.startDelay));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_direction)) {
        int direction =
            a.getInt(R.styleable.ShimmerFrameLayout_shimmer_direction, mShimmer.direction);
        switch (direction) {
          default:
          case Direction.LEFT_TO_RIGHT:
            setDirection(Direction.LEFT_TO_RIGHT);
            break;
          case Direction.TOP_TO_BOTTOM:
            setDirection(Direction.TOP_TO_BOTTOM);
            break;
          case Direction.RIGHT_TO_LEFT:
            setDirection(Direction.RIGHT_TO_LEFT);
            break;
          case Direction.BOTTOM_TO_TOP:
            setDirection(Direction.BOTTOM_TO_TOP);
            break;
        }
      }

      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_shape)) {
        int shape = a.getInt(R.styleable.ShimmerFrameLayout_shimmer_shape, mShimmer.shape);
        switch (shape) {
          default:
          case Shape.LINEAR:
            setShape(Shape.LINEAR);
            break;
          case Shape.RADIAL:
            setShape(Shape.RADIAL);
            break;
        }
      }

      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_dropoff)) {
        setDropoff(a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_dropoff, mShimmer.dropoff));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_fixed_width)) {
        setFixedWidth(
            a.getDimensionPixelSize(
                R.styleable.ShimmerFrameLayout_shimmer_fixed_width, mShimmer.fixedWidth));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_fixed_height)) {
        setFixedHeight(
            a.getDimensionPixelSize(
                R.styleable.ShimmerFrameLayout_shimmer_fixed_height, mShimmer.fixedHeight));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_intensity)) {
        setIntensity(
            a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_intensity, mShimmer.intensity));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_width_ratio)) {
        setWidthRatio(
            a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_width_ratio, mShimmer.widthRatio));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_height_ratio)) {
        setHeightRatio(
            a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_height_ratio, mShimmer.heightRatio));
      }
      if (a.hasValue(R.styleable.ShimmerFrameLayout_shimmer_tilt)) {
        setTilt(a.getFloat(R.styleable.ShimmerFrameLayout_shimmer_tilt, mShimmer.tilt));
      }
      return getThis();
    }