android.os.Parcel.readFloat()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(243)

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

Parcel.readFloat介绍

[英]Read a floating point value from the parcel at the current dataPosition().
[中]从当前dataPosition()处的地块读取浮点值。

代码示例

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set the point's coordinates from the data stored in the specified
 * parcel. To write a point to a parcel, call writeToParcel().
 * Provided to support older Android devices.
 *
 * @param in The parcel to read the point's coordinates from
 */
public void my_readFromParcel(Parcel in) {
  x = in.readFloat();
  y = in.readFloat();
}

代码示例来源:origin: johncarl81/parceler

@Override
public Float nullSafeFromParcel(Parcel parcel) {
  return parcel.readFloat();
}

代码示例来源:origin: rey5137/material

/**
 * Constructor called from {@link #CREATOR}
 */
private SavedState(Parcel in) {
  super(in);
  position = in.readFloat();
}

代码示例来源:origin: smuyyh/BookReader

protected Ring(Parcel in) {
  this.strokeInset = in.readFloat();
  this.strokeWidth = in.readFloat();
  this.ringCenterRadius = in.readFloat();
  this.start = in.readFloat();
  this.end = in.readFloat();
  this.sweep = in.readFloat();
  this.sweeping = in.readFloat();
  this.starting = in.readFloat();
  this.ending = in.readFloat();
  this.color = in.readInt();
}

代码示例来源:origin: JessYanCoding/AndroidAutoSize

protected DisplayMetricsInfo(Parcel in) {
  this.density = in.readFloat();
  this.densityDpi = in.readInt();
  this.scaledDensity = in.readFloat();
  this.xdpi = in.readFloat();
}

代码示例来源:origin: Yalantis/uCrop

protected AspectRatio(Parcel in) {
  mAspectRatioTitle = in.readString();
  mAspectRatioX = in.readFloat();
  mAspectRatioY = in.readFloat();
}

代码示例来源:origin: airbnb/lottie-android

private SavedState(Parcel in) {
 super(in);
 animationName = in.readString();
 progress = in.readFloat();
 isAnimating = in.readInt() == 1;
 imageAssetsFolder = in.readString();
 repeatMode = in.readInt();
 repeatCount = in.readInt();
}

代码示例来源:origin: JessYanCoding/AndroidAutoSize

protected ExternalAdaptInfo(Parcel in) {
  this.isBaseOnWidth = in.readByte() != 0;
  this.sizeInDp = in.readFloat();
}

代码示例来源:origin: florent37/MaterialViewPager

private SavedState(Parcel in) {
  super(in);
  this.settings = in.readParcelable(MaterialViewPagerSettings.class.getClassLoader());
  this.yOffset = in.readFloat();
}

代码示例来源:origin: PhilJay/MPAndroidChart

protected Entry(Parcel in) {
  this.x = in.readFloat();
  this.setY(in.readFloat());
  if (in.readInt() == 1) {
    this.setData(in.readParcelable(Object.class.getClassLoader()));
  }
}

代码示例来源:origin: nickbutcher/plaid

ReflowData(Parcel in) {
  text = in.readString();
  textSize = in.readFloat();
  textColor = in.readInt();
  bounds = (Rect) in.readValue(Rect.class.getClassLoader());
  fontResId = in.readInt();
  lineSpacingAdd = in.readFloat();
  lineSpacingMult = in.readFloat();
  textPosition = (Point) in.readValue(Point.class.getClassLoader());
  textHeight = in.readInt();
  textWidth = in.readInt();
  breakStrategy = in.readInt();
  letterSpacing = in.readFloat();
  maxLines = in.readInt();
}

代码示例来源:origin: android-hacker/VirtualXposed

protected SessionInfo(Parcel in) {
  this.sessionId = in.readInt();
  this.installerPackageName = in.readString();
  this.resolvedBaseCodePath = in.readString();
  this.progress = in.readFloat();
  this.sealed = in.readByte() != 0;
  this.active = in.readByte() != 0;
  this.mode = in.readInt();
  this.sizeBytes = in.readLong();
  this.appPackageName = in.readString();
  this.appIcon = in.readParcelable(Bitmap.class.getClassLoader());
  this.appLabel = in.readString();
}

代码示例来源:origin: android-hacker/VirtualXposed

public VLocation(Parcel in) {
  latitude = in.readDouble();
  longitude = in.readDouble();
  altitude = in.readDouble();
  accuracy = in.readFloat();
  speed = in.readFloat();
  bearing = in.readFloat();
}

代码示例来源:origin: Cleveroad/SlidingTutorial-Android

protected TransformItem(Parcel in) {
  mViewResId = in.readInt();
  mDirection = Direction.valueOf(in.readString());
  mShiftCoefficient = in.readFloat();
}

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

public boolean readFromParcel(Parcel parcel) {
 bits.setValue(parcel.readLong());
 int count = bits.count();
 if (count > MAX_AXES) {
  return false;
 }
 for (int i = 0; i < count; i++) {
  values[i] = parcel.readFloat();
 }
 return true;
}

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

@Test
public void testReadWriteSingleFloat() {
 float val = 5.2f;
 parcel.writeFloat(val);
 parcel.setDataPosition(0);
 assertThat(parcel.readFloat()).isEqualTo(val);
}

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

@Test
public void testByteArrayOfZeroesCastedToZeroes() {
 parcel.writeByteArray(new byte[17]);
 assertThat(parcel.dataSize()).named("total size").isEqualTo(24);
 parcel.setDataPosition(0);
 assertThat(parcel.readInt()).isEqualTo(17);
 assertThat(parcel.readInt()).isEqualTo(0);
 assertThat(parcel.readFloat()).isEqualTo(0.0f);
 assertThat(parcel.createByteArray()).isEqualTo(new byte[0]);
 assertThat(parcel.readString()).isEqualTo("");
}

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

@Test
public void testSetDataPositionIntoMiddleOfParcel() {
 parcel.writeInt(1);
 parcel.writeFloat(5);
 parcel.writeDouble(6);
 parcel.setDataPosition(4);
 assertThat(parcel.readFloat()).isEqualTo(5.0f);
}

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

@Test
public void testZeroCanBeCasted_8ByteTypesCanBeReadAs4Bytes() {
 parcel.writeLong(0);
 parcel.writeDouble(0.0);
 parcel.writeLong(0);
 assertThat(parcel.dataSize()).named("total size").isEqualTo(24);
 parcel.setDataPosition(0);
 assertThat(parcel.readInt()).isEqualTo(0);
 assertThat(parcel.readFloat()).isEqualTo(0.0f);
 assertThat(parcel.createByteArray()).isEqualTo(new byte[0]);
 assertThat(parcel.dataPosition()).isEqualTo(12);
 assertThat(parcel.readInt()).isEqualTo(0);
 assertThat(parcel.readFloat()).isEqualTo(0.0f);
 assertThat(parcel.createByteArray()).isEqualTo(new byte[0]);
 assertThat(parcel.dataPosition()).isEqualTo(24);
}

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

@Test
public void testDataPositionAfterSomeReads() {
 parcel.writeInt(1);
 parcel.writeFloat(5);
 parcel.writeDouble(37);
 parcel.setDataPosition(0);
 parcel.readInt();
 assertThat(parcel.dataPosition()).isEqualTo(4);
 parcel.readFloat();
 assertThat(parcel.dataPosition()).isEqualTo(8);
 parcel.readDouble();
 assertThat(parcel.dataPosition()).isEqualTo(16);
}

相关文章

Parcel类方法