Obtains the orientation of the shadow, which is visualized by the view, from a specific typed
array.

@param typedArray
The typed array, the elevation should be obtained from, as an instance of the class
{@link TypedArray}. The typed array may not be null
329727
private void obtainShadowOrientation(@NonNull final TypedArray typedArray) {
        int defaultValue = getResources()
                .getInteger(R.integer.elevation_shadow_view_shadow_orientation_default_value);
        orientation = Orientation.fromValue(typedArray
                .getInteger(R.styleable.ElevationShadowView_shadowOrientation, defaultValue));
    }
602084
static public <D extends ImageGray<D>>
	void direction2( D derivX , D derivY , GrayF32 angle )
	{
		if( derivX instanceof GrayF32) {
			GradientToEdgeFeatures.direction2((GrayF32)derivX,(GrayF32)derivY,angle);
		} else if( derivX instanceof GrayS16) {
			GradientToEdgeFeatures.direction2((GrayS16)derivX,(GrayS16)derivY,angle);
		} else if( derivX instanceof GrayS32) {
			GradientToEdgeFeatures.direction2((GrayS32)derivX,(GrayS32)derivY,angle);
		} else {
			throw new IllegalArgumentException("Unknown input type");
		}
	}
900923
private void obtainInsetForeground(@NonNull final TypedArray typedArray) {
        int color = typedArray.getColor(R.styleable.ScrimInsetsLayout_insetDrawable, -1);

        if (color == -1) {
            Drawable drawable = typedArray.getDrawable(R.styleable.ScrimInsetsLayout_insetDrawable);

            if (drawable != null) {
                setInsetDrawable(drawable);
            } else {
                setInsetColor(ContextCompat.getColor(getContext(),
                        R.color.scrim_insets_layout_insets_drawable_default_value));
            }
        } else {
            setInsetColor(color);
        }
    }
1002111
public void drawEdgeShadow(Canvas canvas, Matrix transform, RectF bounds, int elevation) {
        bounds.bottom += elevation;
        bounds.offset(0, -elevation);

        edgeColors[0] = shadowEndColor;
        edgeColors[1] = shadowMiddleColor;
        edgeColors[2] = shadowStartColor;

        edgeShadowPaint.setShader(
                new LinearGradient(
                        bounds.left,
                        bounds.top,
                        bounds.left,
                        bounds.bottom,
                        edgeColors,
                        edgePositions,
                        Shader.TileMode.CLAMP));

        canvas.save();
        canvas.concat(transform);
        canvas.drawRect(bounds, edgeShadowPaint);
        canvas.restore();
    }
492472
private void obtainDialogIcon(@NonNull final TypedArray typedArray) {
        int resourceId =
                typedArray.getResourceId(R.styleable.DialogPreference_android_dialogIcon, -1);

        if (resourceId != -1) {
            setDialogIcon(resourceId);
        }
    }
684821
@Override
	protected void getHeights(int currentHeight, List<Integer> heights) {
		if (isLeaf()) {
			heights.add(new Integer(currentHeight));
		} else {
			if (this.left != null) {
				this.left.getHeights(currentHeight + 1, heights);
			}
			if (this.middle != null) {
				this.middle.getHeights(currentHeight + 1, heights);
			}
			if (this.right != null) {
				this.right.getHeights(currentHeight + 1, heights);
			}
		}
	}
217512
public static Type getArrayComponentType(Type type) {
        if (type instanceof GenericArrayType) {
            return GenericArrayType.class.cast(type).getGenericComponentType();
        }
        if (type instanceof Class<?>) {
            Class<?> clazz = (Class<?>) type;
            if (clazz.isArray()) {
                return clazz.getComponentType();
            }
        }
        throw new IllegalArgumentException("Not an array type " + type);
    }
1369507
private void obtainPreviewSize(@NonNull final TypedArray typedArray) {
        int defaultValue = getContext().getResources()
                .getDimensionPixelSize(R.dimen.color_picker_preference_default_preview_size);
        setPreviewSize(typedArray
                .getDimensionPixelSize(R.styleable.AbstractColorPickerPreference_previewSize,
                        defaultValue));
    }
619471
public void update(final Ray3DFloat ray) {
        final Point3D origin = VecToPoint(ray.getOrigin());
        final Point3D direction = VecToPoint(ray.getDirection());
        final Point3D end = origin.add(direction.normalize().multiply(rayLength));
        super.setStartEndPoints(origin, end);
    }
78427
public static int getOrientation(InputStream is) {
    try {
      int length = moveToAPP1EXIF(is);
      if (length == 0) {
        return ExifInterface.ORIENTATION_UNDEFINED;
      }
      return TiffUtil.readOrientationFromTIFF(is, length);
    } catch (IOException ioe) {
      return ExifInterface.ORIENTATION_UNDEFINED;
    }
  }
1284061
private void obtainPreviewBorderWidth(@NonNull final TypedArray typedArray) {
        int defaultValue = getContext().getResources().getDimensionPixelSize(
                R.dimen.color_picker_preference_default_preview_border_width);
        setPreviewBorderWidth(typedArray
                .getDimensionPixelSize(R.styleable.AbstractColorPickerPreference_previewBorderWidth,
                        defaultValue));
    }
417135
@Override
	protected void vertical( GrayF32 intensity ) {
		float[] hXX = horizXX.data;
		float[] hXY = horizXY.data;
		float[] hYY = horizYY.data;
		final float[] inten = intensity.data;

		final int imgHeight = horizXX.getHeight();
		final int imgWidth = horizXX.getWidth();

		final int kernelWidth = radius * 2 + 1;

		final int startX = radius;
		final int endX = imgWidth - radius;

		final int backStep = kernelWidth * imgWidth;

		BoofConcurrency.loopBlocks(radius,imgHeight-radius,(y0,y1)->{
		final float[] tempXX = work.pop();
		final float[] tempXY = work.pop();
		final float[] tempYY = work.pop();
		for (int x = startX; x < endX; x++) {
			// defines the A matrix, from which the eigenvalues are computed
			int srcIndex = x + (y0-radius)*imgWidth;
			int destIndex = imgWidth * y0 + x;
			float totalXX = 0, totalXY = 0, totalYY = 0;

			int indexEnd = srcIndex + imgWidth * kernelWidth;
			for (; srcIndex < indexEnd; srcIndex += imgWidth) {
				totalXX += hXX[srcIndex];
				totalXY += hXY[srcIndex];
				totalYY += hYY[srcIndex];
			}

			tempXX[x] = totalXX;
			tempXY[x] = totalXY;
			tempYY[x] = totalYY;

			// compute the eigen values
			inten[destIndex] = this.intensity.compute(totalXX,totalXY,totalYY);
			destIndex += imgWidth;
		}

		// change the order it is processed in to reduce cache misses
		for (int y = y0 + 1; y < y1; y++) {
			int srcIndex = (y + radius) * imgWidth + startX;
			int destIndex = y * imgWidth + startX;

			for (int x = startX; x < endX; x++, srcIndex++, destIndex++) {
				float totalXX = tempXX[x] - hXX[srcIndex - backStep];
				tempXX[x] = totalXX += hXX[srcIndex];
				float totalXY = tempXY[x] - hXY[srcIndex - backStep];
				tempXY[x] = totalXY += hXY[srcIndex];
				float totalYY = tempYY[x] - hYY[srcIndex - backStep];
				tempYY[x] = totalYY += hYY[srcIndex];

				inten[destIndex] = this.intensity.compute(totalXX,totalXY,totalYY);
			}
		}
		work.recycle(tempXX);
		work.recycle(tempXY);
		work.recycle(tempYY);
		});
	}
1046897
private void obtainTextColor(@NonNull final TypedArray typedArray) {
        ColorStateList colorStateList =
                typedArray.getColorStateList(R.styleable.ActionPreference_android_textColor);

        if (colorStateList == null) {
            colorStateList = ContextCompat
                    .getColorStateList(getContext(), R.color.action_preference_text_color);
        }

        setTextColor(colorStateList);
    }
746558
@Override
    public INDArray getLFactor(INDArray A) {
        // FIXME: int cast
        if (A.rows() > Integer.MAX_VALUE || A.columns() > Integer.MAX_VALUE)
            throw new ND4JArraySizeException();

        int m = (int) A.rows();
        int n = (int) A.columns();

        INDArray L = Nd4j.create(m, n);
        for (int r = 0; r < m; r++) {
            for (int c = 0; c < n; c++) {
                if (r > c && r < m && c < n) {
                    L.putScalar(r, c, A.getFloat(r, c));
                } else if (r < c) {
                    L.putScalar(r, c, 0.f);
                } else {
                    L.putScalar(r, c, 1.f);
                }
            }
        }
        return L;
    }
799212
private void obtainDialogWidth(@NonNull final TypedArray typedArray) {
        int width = 0;

        try {
            width = typedArray
                    .getDimensionPixelSize(R.styleable.DialogPreference_dialogWidth, width);
        } catch (Resources.NotFoundException | UnsupportedOperationException e) {
            width = typedArray.getInteger(0, width);
        }

        if (width != 0) {
            setDialogWidth(width);
        }
    }
1368527
public static <E extends Comparable<E>> void sortDescending(E[] intArray) {
        Merge.sort(intArray, 0, intArray.length-1, true);
    }
232269
protected void initAttributes(TypedArray attrArray) {
        mCircleXRadius = attrArray.getDimension(R.styleable.CircularSeekBar_circle_x_radius, DEFAULT_CIRCLE_X_RADIUS * DPTOPX_SCALE);
        mCircleYRadius = attrArray.getDimension(R.styleable.CircularSeekBar_circle_y_radius, DEFAULT_CIRCLE_Y_RADIUS * DPTOPX_SCALE);
        mPointerRadius = attrArray.getDimension(R.styleable.CircularSeekBar_pointer_radius, DEFAULT_POINTER_RADIUS * DPTOPX_SCALE);
        mPointerHaloWidth = attrArray.getDimension(R.styleable.CircularSeekBar_pointer_halo_width, DEFAULT_POINTER_HALO_WIDTH * DPTOPX_SCALE);
        mPointerHaloBorderWidth = attrArray.getDimension(R.styleable.CircularSeekBar_pointer_halo_border_width, DEFAULT_POINTER_HALO_BORDER_WIDTH * DPTOPX_SCALE);
        mCircleStrokeWidth = attrArray.getDimension(R.styleable.CircularSeekBar_circle_stroke_width, DEFAULT_CIRCLE_STROKE_WIDTH * DPTOPX_SCALE);

        mPointerColor = attrArray.getColor(R.styleable.CircularSeekBar_pointer_color, DEFAULT_POINTER_COLOR);
        mPointerHaloColor = attrArray.getColor(R.styleable.CircularSeekBar_pointer_halo_color, DEFAULT_POINTER_HALO_COLOR);
        mPointerHaloColorOnTouch = attrArray.getColor(R.styleable.CircularSeekBar_pointer_halo_color_ontouch, DEFAULT_POINTER_HALO_COLOR_ONTOUCH);
        mCircleColor = attrArray.getColor(R.styleable.CircularSeekBar_circle_color, DEFAULT_CIRCLE_COLOR);
        mCircleProgressColor = attrArray.getColor(R.styleable.CircularSeekBar_circle_progress_color, DEFAULT_CIRCLE_PROGRESS_COLOR);
        mCircleFillColor = attrArray.getColor(R.styleable.CircularSeekBar_circle_fill, DEFAULT_CIRCLE_FILL_COLOR);

        mPointerAlpha = Color.alpha(mPointerHaloColor);

        mPointerAlphaOnTouch = attrArray.getInt(R.styleable.CircularSeekBar_pointer_alpha_ontouch, DEFAULT_POINTER_ALPHA_ONTOUCH);
        if (mPointerAlphaOnTouch > 255 || mPointerAlphaOnTouch < 0) {
            mPointerAlphaOnTouch = DEFAULT_POINTER_ALPHA_ONTOUCH;
        }

        mMax = attrArray.getInt(R.styleable.CircularSeekBar_maxValue, DEFAULT_MAX);
        mProgress = attrArray.getInt(R.styleable.CircularSeekBar_progressValue, DEFAULT_PROGRESS);
        mCustomRadii = attrArray.getBoolean(R.styleable.CircularSeekBar_use_custom_radii, DEFAULT_USE_CUSTOM_RADII);
        mMaintainEqualCircle = attrArray.getBoolean(R.styleable.CircularSeekBar_maintain_equal_circle, DEFAULT_MAINTAIN_EQUAL_CIRCLE);
        mMoveOutsideCircle = attrArray.getBoolean(R.styleable.CircularSeekBar_move_outside_circle, DEFAULT_MOVE_OUTSIDE_CIRCLE);
        lockEnabled = attrArray.getBoolean(R.styleable.CircularSeekBar_lock_enabled, DEFAULT_LOCK_ENABLED);

        // Modulo 360 right now to avoid constant conversion
        mStartAngle = ((360f + (attrArray.getFloat((R.styleable.CircularSeekBar_start_angle), DEFAULT_START_ANGLE) % 360f)) % 360f);
        mEndAngle = ((360f + (attrArray.getFloat((R.styleable.CircularSeekBar_end_angle), DEFAULT_END_ANGLE) % 360f)) % 360f);

        if (mStartAngle == mEndAngle) {
            //mStartAngle = mStartAngle + 1f;
            mEndAngle = mEndAngle - .1f;
        }
    }