Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
[video_player] updated nullability in pigeon files
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke committed Feb 14, 2022
1 parent d9a9307 commit c702665
Show file tree
Hide file tree
Showing 17 changed files with 274 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,29 @@
/** Generated class from Pigeon. */
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
public class Messages {

/** Generated class from Pigeon that represents data sent in messages. */
public static class TextureMessage {
private @Nullable Long textureId;
private @NonNull Long textureId;

public @Nullable Long getTextureId() {
public @NonNull Long getTextureId() {
return textureId;
}

public void setTextureId(@Nullable Long setterArg) {
public void setTextureId(@NonNull Long setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"textureId\" is null.");
}
this.textureId = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private TextureMessage() {}

public static class Builder {
private @Nullable Long textureId;

public @NonNull Builder setTextureId(@Nullable Long setterArg) {
public @NonNull Builder setTextureId(@NonNull Long setterArg) {
this.textureId = setterArg;
return this;
}
Expand Down Expand Up @@ -69,37 +76,46 @@ Map<String, Object> toMap() {

/** Generated class from Pigeon that represents data sent in messages. */
public static class LoopingMessage {
private @Nullable Long textureId;
private @NonNull Long textureId;

public @Nullable Long getTextureId() {
public @NonNull Long getTextureId() {
return textureId;
}

public void setTextureId(@Nullable Long setterArg) {
public void setTextureId(@NonNull Long setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"textureId\" is null.");
}
this.textureId = setterArg;
}

private @Nullable Boolean isLooping;
private @NonNull Boolean isLooping;

public @Nullable Boolean getIsLooping() {
public @NonNull Boolean getIsLooping() {
return isLooping;
}

public void setIsLooping(@Nullable Boolean setterArg) {
public void setIsLooping(@NonNull Boolean setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"isLooping\" is null.");
}
this.isLooping = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private LoopingMessage() {}

public static class Builder {
private @Nullable Long textureId;

public @NonNull Builder setTextureId(@Nullable Long setterArg) {
public @NonNull Builder setTextureId(@NonNull Long setterArg) {
this.textureId = setterArg;
return this;
}

private @Nullable Boolean isLooping;

public @NonNull Builder setIsLooping(@Nullable Boolean setterArg) {
public @NonNull Builder setIsLooping(@NonNull Boolean setterArg) {
this.isLooping = setterArg;
return this;
}
Expand Down Expand Up @@ -135,37 +151,46 @@ Map<String, Object> toMap() {

/** Generated class from Pigeon that represents data sent in messages. */
public static class VolumeMessage {
private @Nullable Long textureId;
private @NonNull Long textureId;

public @Nullable Long getTextureId() {
public @NonNull Long getTextureId() {
return textureId;
}

public void setTextureId(@Nullable Long setterArg) {
public void setTextureId(@NonNull Long setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"textureId\" is null.");
}
this.textureId = setterArg;
}

private @Nullable Double volume;
private @NonNull Double volume;

public @Nullable Double getVolume() {
public @NonNull Double getVolume() {
return volume;
}

public void setVolume(@Nullable Double setterArg) {
public void setVolume(@NonNull Double setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"volume\" is null.");
}
this.volume = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private VolumeMessage() {}

public static class Builder {
private @Nullable Long textureId;

public @NonNull Builder setTextureId(@Nullable Long setterArg) {
public @NonNull Builder setTextureId(@NonNull Long setterArg) {
this.textureId = setterArg;
return this;
}

private @Nullable Double volume;

public @NonNull Builder setVolume(@Nullable Double setterArg) {
public @NonNull Builder setVolume(@NonNull Double setterArg) {
this.volume = setterArg;
return this;
}
Expand Down Expand Up @@ -201,37 +226,46 @@ Map<String, Object> toMap() {

/** Generated class from Pigeon that represents data sent in messages. */
public static class PlaybackSpeedMessage {
private @Nullable Long textureId;
private @NonNull Long textureId;

public @Nullable Long getTextureId() {
public @NonNull Long getTextureId() {
return textureId;
}

public void setTextureId(@Nullable Long setterArg) {
public void setTextureId(@NonNull Long setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"textureId\" is null.");
}
this.textureId = setterArg;
}

private @Nullable Double speed;
private @NonNull Double speed;

public @Nullable Double getSpeed() {
public @NonNull Double getSpeed() {
return speed;
}

public void setSpeed(@Nullable Double setterArg) {
public void setSpeed(@NonNull Double setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"speed\" is null.");
}
this.speed = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private PlaybackSpeedMessage() {}

public static class Builder {
private @Nullable Long textureId;

public @NonNull Builder setTextureId(@Nullable Long setterArg) {
public @NonNull Builder setTextureId(@NonNull Long setterArg) {
this.textureId = setterArg;
return this;
}

private @Nullable Double speed;

public @NonNull Builder setSpeed(@Nullable Double setterArg) {
public @NonNull Builder setSpeed(@NonNull Double setterArg) {
this.speed = setterArg;
return this;
}
Expand Down Expand Up @@ -267,37 +301,46 @@ Map<String, Object> toMap() {

/** Generated class from Pigeon that represents data sent in messages. */
public static class PositionMessage {
private @Nullable Long textureId;
private @NonNull Long textureId;

public @Nullable Long getTextureId() {
public @NonNull Long getTextureId() {
return textureId;
}

public void setTextureId(@Nullable Long setterArg) {
public void setTextureId(@NonNull Long setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"textureId\" is null.");
}
this.textureId = setterArg;
}

private @Nullable Long position;
private @NonNull Long position;

public @Nullable Long getPosition() {
public @NonNull Long getPosition() {
return position;
}

public void setPosition(@Nullable Long setterArg) {
public void setPosition(@NonNull Long setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"position\" is null.");
}
this.position = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private PositionMessage() {}

public static class Builder {
private @Nullable Long textureId;

public @NonNull Builder setTextureId(@Nullable Long setterArg) {
public @NonNull Builder setTextureId(@NonNull Long setterArg) {
this.textureId = setterArg;
return this;
}

private @Nullable Long position;

public @NonNull Builder setPosition(@Nullable Long setterArg) {
public @NonNull Builder setPosition(@NonNull Long setterArg) {
this.position = setterArg;
return this;
}
Expand Down Expand Up @@ -462,20 +505,26 @@ Map<String, Object> toMap() {

/** Generated class from Pigeon that represents data sent in messages. */
public static class MixWithOthersMessage {
private @Nullable Boolean mixWithOthers;
private @NonNull Boolean mixWithOthers;

public @Nullable Boolean getMixWithOthers() {
public @NonNull Boolean getMixWithOthers() {
return mixWithOthers;
}

public void setMixWithOthers(@Nullable Boolean setterArg) {
public void setMixWithOthers(@NonNull Boolean setterArg) {
if (setterArg == null) {
throw new IllegalStateException("Nonnull field \"mixWithOthers\" is null.");
}
this.mixWithOthers = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private MixWithOthersMessage() {}

public static class Builder {
private @Nullable Boolean mixWithOthers;

public @NonNull Builder setMixWithOthers(@Nullable Boolean setterArg) {
public @NonNull Builder setMixWithOthers(@NonNull Boolean setterArg) {
this.mixWithOthers = setterArg;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ public TextureMessage create(CreateMessage arg) {
}
videoPlayers.put(handle.id(), player);

TextureMessage result = new TextureMessage();
result.setTextureId(handle.id());
TextureMessage result = new TextureMessage.Builder().setTextureId(handle.id()).build();
return result;
}

Expand Down Expand Up @@ -189,8 +188,11 @@ public void play(TextureMessage arg) {

public PositionMessage position(TextureMessage arg) {
VideoPlayer player = videoPlayers.get(arg.getTextureId());
PositionMessage result = new PositionMessage();
result.setPosition(player.getPosition());
PositionMessage result =
new PositionMessage.Builder()
.setPosition(player.getPosition())
.setTextureId(arg.getTextureId())
.build();
player.sendBufferingUpdate();
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class AndroidVideoPlayer extends VideoPlayerPlatform {
Future<Duration> getPosition(int textureId) async {
final PositionMessage response =
await _api.position(TextureMessage(textureId: textureId));
return Duration(milliseconds: response.position!);
return Duration(milliseconds: response.position);
}

@override
Expand Down
Loading

0 comments on commit c702665

Please sign in to comment.