android.support.annotation.Size.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中android.support.annotation.Size.<init>()方法的一些代码示例,展示了Size.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Size.<init>()方法的具体详情如下:
包路径:android.support.annotation.Size
类名称:Size
方法名:<init>

Size.<init>介绍

暂无

代码示例

代码示例来源:origin: dinuscxj/LoadingDrawable

public Builder setLevelColors(@Size(3) int[] colors) {
  this.mLevelColors = colors;
  return this;
}

代码示例来源:origin: dinuscxj/LoadingDrawable

public Builder setColors(@Size(2) int[] colors) {
  this.mColors = colors;
  return this;
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Returns the backing array of this {@link Matrix4}.
 *
 * @return double array containing the backing array. The returned array is owned
 * by this {@link Matrix4} and is subject to change as the implementation sees fit.
 */
@NonNull
@Size(16)
public double[] getDoubleValues() {
  return m;
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Copies the backing array of this {@link Matrix4} into the provided double array.
 *
 * @param doubleArray double array to store the copy in. Must be at least 16 elements long.
 *                    Entries will be placed starting at the 0 index.
 */
public void toArray(@NonNull @Size(min = 16) double[] doubleArray) {
  System.arraycopy(m, 0, doubleArray, 0, 16);
}

代码示例来源:origin: Rajawali/Rajawali

@NonNull
public Matrix4 setAll(@NonNull @Size(min = 16) float[] matrix) {
  // @formatter:off
  m[0] = matrix[0];	m[1] = matrix[1];	m[2] = matrix[2];	m[3] = matrix[3];
  m[4] = matrix[4];	m[5] = matrix[5];	m[6] = matrix[6];	m[7] = matrix[7];
  m[8] = matrix[8];	m[9] = matrix[9];	m[10] = matrix[10];	m[11] = matrix[11];
  m[12] = matrix[12];	m[13] = matrix[13];	m[14] = matrix[14];	m[15] = matrix[15];
  return this;
  // @formatter:on
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Constructs a new {@link Vector3} with components initialized from the input double array.
 *
 * @param values A double array of values to be parsed for each component.
 *
 * @throws IllegalArgumentException if there are fewer than 3 values in the array.
 */
public Vector3(@NonNull @Size(min = 3) double[] values) throws IllegalArgumentException {
  if (values.length < 3)
    throw new IllegalArgumentException("Vector3 must be initialized with an array length of at least 3.");
  x = values[0];
  y = values[1];
  z = values[2];
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Multiplies this {@link Vector3} and the provided 4x4 matrix.
 *
 * @param matrix double[16] representation of a 4x4 matrix.
 *
 * @return A reference to this {@link Vector3} to facilitate chaining.
 */
@NonNull
public Vector3 multiply(@NonNull @Size(min = 16) double[] matrix) {
  double vx = x, vy = y, vz = z;
  x = vx * matrix[Matrix4.M00] + vy * matrix[Matrix4.M01] + vz * matrix[Matrix4.M02] + matrix[Matrix4.M03];
  y = vx * matrix[Matrix4.M10] + vy * matrix[Matrix4.M11] + vz * matrix[Matrix4.M12] + matrix[Matrix4.M13];
  z = vx * matrix[Matrix4.M20] + vy * matrix[Matrix4.M21] + vz * matrix[Matrix4.M22] + matrix[Matrix4.M23];
  return this;
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Constructs a new {@link Vector3} with components initialized from the input {@link String} array.
 *
 * @param values A {@link String} array of values to be parsed for each component.
 *
 * @throws IllegalArgumentException if there are fewer than 3 values in the array.
 * @throws NumberFormatException if there is a problem parsing the {@link String} values into doubles.
 */
public Vector3(@NonNull @Size(min = 3) String[] values) throws IllegalArgumentException, NumberFormatException {
  this(Float.parseFloat(values[0]), Float.parseFloat(values[1]), Float.parseFloat(values[2]));
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

/**
 * 倍速播放
 *
 * @param speed 倍速播放,默认为1
 * @param pitch 音量缩放,默认为1,修改会导致声音变调
 */
public void setSpeed(@Size(min = 0) float speed, @Size(min = 0) float pitch) {
  PlaybackParameters playbackParameters = new PlaybackParameters(speed, pitch);
  mSpeedPlaybackParameters = playbackParameters;
  if (mInternalPlayer != null) {
    mInternalPlayer.setPlaybackParameters(playbackParameters);
  }
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Sets the elements of this {@link Matrix4} based on the provided double array.
 * The array length must be greater than or equal to 16 and the array will be copied
 * from the 0 index.
 *
 * @param matrix double array containing the values for the matrix in column major order.
 *               The array is not modified or referenced after this constructor completes.
 *
 * @return A reference to this {@link Matrix4} to facilitate chaining.
 */
@NonNull
public Matrix4 setAll(@NonNull @Size(min = 16) double[] matrix) {
  System.arraycopy(matrix, 0, m, 0, 16);
  return this;
}

代码示例来源:origin: oasisfeng/condom

private CondomContext(final CondomCore condom, final @Nullable Context app_context, final @Nullable @Size(max=16) String tag) {
  super(condom.mBase);
  final Context base = condom.mBase;
  mCondom = condom;
  mApplicationContext = app_context != null ? app_context : this;
  mBaseContext = new Lazy<Context>() { @Override protected Context create() {
    return new PseudoContextImpl(CondomContext.this);
  }};
  TAG = CondomCore.buildLogTag("Condom", "Condom.", tag);
}

代码示例来源:origin: oasisfeng/condom

CondomApplication(final CondomCore condom, final Application app, final @Nullable @Size(max = 13) String tag) {
  mCondom = condom;
  mApplication = app;
  TAG = CondomCore.buildLogTag("CondomApp", "CondomApp.", tag);
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Constructs a new {@link Matrix4} based on the provided float array. The array length
 * must be greater than or equal to 16 and the array will be copied from the 0 index.
 *
 * @param matrix float array containing the values for the matrix in column major order.
 *               The array is not modified or referenced after this constructor completes.
 */
public Matrix4(@NonNull @Size(min = 16) float[] matrix) {
  this(ArrayUtils.convertFloatsToDoubles(matrix));
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Returns an array representation of this Vector3.
 *
 * @return An array containing this Vector3's xyz values.
 */
@NonNull
@Size(3)
public double[] toArray() {
  return toArray(new double[3]);
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Copies the backing array of this {@link Matrix4} into a float array and returns it.
 *
 * @return float array containing a copy of the backing array. The returned array is owned
 * by this {@link Matrix4} and is subject to change as the implementation sees fit.
 */
@NonNull
@Size(16)
public float[] getFloatValues() {
  ArrayUtils.convertDoublesToFloats(m, mFloat);
  return mFloat;
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Constructs a new {@link Matrix4} based on the provided double array. The array length
 * must be greater than or equal to 16 and the array will be copied from the 0 index.
 *
 * @param matrix double array containing the values for the matrix in column major order.
 *               The array is not modified or referenced after this constructor completes.
 */
public Matrix4(@NonNull @Size(min = 16) double[] matrix) {
  setAll(matrix);
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Sets this {@link Quaternion}'s components from the given matrix.
 *
 * @param matrix {@link Matrix4} The rotation matrix.
 *
 * @return A reference to this {@link Quaternion} to facilitate chaining.
 */
@NonNull
public Quaternion fromMatrix(@NonNull @Size(min = 16) double[] matrix) {
  fromAxes(matrix[Matrix4.M00], matrix[Matrix4.M10], matrix[Matrix4.M20],
       matrix[Matrix4.M01], matrix[Matrix4.M11], matrix[Matrix4.M21],
       matrix[Matrix4.M02], matrix[Matrix4.M12], matrix[Matrix4.M22]);
  return this;
}

代码示例来源:origin: oasisfeng/condom

public static @CheckResult CondomContext wrap(final Context base, final @Nullable @Size(max=13) String tag) {
  return wrap(base, tag, new CondomOptions());
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Applies Gram-Schmitt Ortho-normalization to the given set of input {@link Vector3} objects.
 *
 * @param vecs Array of {@link Vector3} objects to be ortho-normalized.
 */
public static void orthoNormalize(@NonNull @Size(min = 2) Vector3[] vecs) {
  for (int i = 0; i < vecs.length; ++i) {
    vecs[i].normalize();
    for (int j = i + 1; j < vecs.length; ++j) {
      vecs[j].subtract(Vector3.projectAndCreate(vecs[j], vecs[i]));
    }
  }
}

代码示例来源:origin: Rajawali/Rajawali

/**
 * Multiplies this {@link Vector3} by the provided 4x4 matrix and divides by w.
 * Typically this is used for project/un-project of a {@link Vector3}.
 *
 * @param matrix double[16] array representation of a 4x4 matrix to project with.
 *
 * @return A reference to this {@link Vector3} to facilitate chaining.
 */
@NonNull
public Vector3 project(@NonNull @Size(min = 16) double[] matrix) {
  if (mTmpMatrix4 == null) {
    mTmpMatrix4 = new Matrix4(matrix);
  } else {
    mTmpMatrix4.setAll(matrix);
  }
  return project(mTmpMatrix4);
}

相关文章

微信公众号

最新文章

更多