本文整理了Java中android.os.Parcel.writeFloat()
方法的一些代码示例,展示了Parcel.writeFloat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.writeFloat()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:writeFloat
[英]Write a floating point value into the parcel at the current dataPosition(), growing dataCapacity() if needed.
[中]在当前dataPosition()处向包裹中写入浮点值,必要时增加dataCapacity()。
代码示例来源:origin: johncarl81/parceler
@Override
public void nullSafeToParcel(Float input, Parcel parcel) {
parcel.writeFloat(input);
}
};
代码示例来源:origin: Yalantis/uCrop
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mAspectRatioTitle);
dest.writeFloat(mAspectRatioX);
dest.writeFloat(mAspectRatioY);
}
代码示例来源:origin: smuyyh/BookReader
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeFloat(this.strokeInset);
dest.writeFloat(this.strokeWidth);
dest.writeFloat(this.ringCenterRadius);
dest.writeFloat(this.start);
dest.writeFloat(this.end);
dest.writeFloat(this.sweep);
dest.writeFloat(this.sweeping);
dest.writeFloat(this.starting);
dest.writeFloat(this.ending);
dest.writeInt(this.color);
}
代码示例来源:origin: JessYanCoding/AndroidAutoSize
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeFloat(this.density);
dest.writeInt(this.densityDpi);
dest.writeFloat(this.scaledDensity);
dest.writeFloat(this.xdpi);
}
代码示例来源:origin: airbnb/lottie-android
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeString(animationName);
out.writeFloat(progress);
out.writeInt(isAnimating ? 1 : 0);
out.writeString(imageAssetsFolder);
out.writeInt(repeatMode);
out.writeInt(repeatCount);
}
代码示例来源:origin: JessYanCoding/AndroidAutoSize
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeByte(this.isBaseOnWidth ? (byte) 1 : (byte) 0);
dest.writeFloat(this.sizeInDp);
}
代码示例来源:origin: florent37/MaterialViewPager
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeParcelable(this.settings, flags);
out.writeFloat(this.yOffset);
}
}
代码示例来源:origin: rey5137/material
@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeFloat(position);
}
代码示例来源:origin: nickbutcher/plaid
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(text);
dest.writeFloat(textSize);
dest.writeInt(textColor);
dest.writeValue(bounds);
dest.writeInt(fontResId);
dest.writeFloat(lineSpacingAdd);
dest.writeFloat(lineSpacingMult);
dest.writeValue(textPosition);
dest.writeInt(textHeight);
dest.writeInt(textWidth);
dest.writeInt(breakStrategy);
dest.writeFloat(letterSpacing);
dest.writeInt(maxLines);
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeDouble(latitude);
dest.writeDouble(longitude);
dest.writeDouble(altitude);
dest.writeFloat(accuracy);
dest.writeFloat(speed);
dest.writeFloat(bearing);
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeFloat(this.x);
dest.writeFloat(this.getY());
if (getData() != null) {
if (getData() instanceof Parcelable) {
dest.writeInt(1);
dest.writeParcelable((Parcelable) this.getData(), flags);
} else {
throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
}
} else {
dest.writeInt(0);
}
}
代码示例来源:origin: robolectric/robolectric
public boolean writeToParcel(Parcel parcel) {
parcel.writeLong(bits.getValue());
int count = bits.count();
for (int i = 0; i < count; i++) {
parcel.writeFloat(values[i]);
}
return true;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testByteArrayToleratesZeroes() {
parcel.writeInt(19); // Length
parcel.writeInt(0); // These are zero
parcel.writeLong(0); // This is zero
parcel.writeFloat(0.0f); // This is zero
parcel.writeByteArray(new byte[0]); // This is also zero
assertThat(parcel.dataSize()).isEqualTo(24);
parcel.setDataPosition(0);
assertThat(parcel.createByteArray()).isEqualTo(new byte[19]);
}
代码示例来源: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 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 testDataAvail() {
parcel.writeInt(1);
parcel.writeFloat(5);
parcel.writeDouble(6);
parcel.setDataPosition(4);
assertThat(parcel.dataAvail()).isEqualTo(12);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testDataSizeAfterSomeWrites() {
parcel.writeInt(1);
assertThat(parcel.dataSize()).isEqualTo(4);
parcel.writeFloat(5);
assertThat(parcel.dataSize()).isEqualTo(8);
parcel.writeDouble(37);
assertThat(parcel.dataSize()).isEqualTo(16);
}
代码示例来源: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);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testDataPositionAfterSomeWrites() {
parcel.writeInt(1);
assertThat(parcel.dataPosition()).isEqualTo(4);
parcel.writeFloat(5);
assertThat(parcel.dataPosition()).isEqualTo(8);
parcel.writeDouble(37);
assertThat(parcel.dataPosition()).isEqualTo(16);
parcel.writeStrongBinder(new Binder()); // 20 bytes
assertThat(parcel.dataPosition()).isEqualTo(36);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testZeroCanBeCasted_4ByteTypesCanBeReadAs8Bytes() {
parcel.writeByte((byte) 0);
parcel.writeByte((byte) 0);
parcel.writeInt(0);
parcel.writeInt(0);
parcel.writeFloat(0.0f);
parcel.writeByteArray(new byte[0]);
assertThat(parcel.dataSize()).named("total size").isEqualTo(24);
parcel.setDataPosition(0);
assertThat(parcel.readLong()).isEqualTo(0L);
assertWithMessage("long consumes 8B").that(parcel.dataPosition()).isEqualTo(8);
assertThat(parcel.readDouble()).isEqualTo(0.0);
assertWithMessage("double consumes 8B").that(parcel.dataPosition()).isEqualTo(16);
assertThat(parcel.readString()).isEqualTo("");
assertWithMessage("empty string 8B").that(parcel.dataPosition()).isEqualTo(24);
}
内容来源于网络,如有侵权,请联系作者删除!