diff --git a/app/build.gradle b/app/build.gradle index dd61cd40..4064a023 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { - applicationId "com.example.ponycui_home.svgaplayer" + applicationId "com.example.drumge.svgaplayer" minSdkVersion 14 targetSdkVersion 28 versionCode 1 @@ -34,3 +34,18 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:3.4.1' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } + + +task testGit() { +// testExc("channel_id_test") +} + +def testExc(String channelId) { + exec { + workingDir '.' +// commandLine 'git commit -m \'test\'' +// commandLine 'git', 'status' +// commandLine 'git', 'commit', '-m', 'test' + commandLine 'git', 'commit', '-am', "${version} ${channelId} 渠道包" + } +} \ No newline at end of file diff --git a/app/src/main/assets/daxiao.svga b/app/src/main/assets/daxiao.svga new file mode 100644 index 00000000..2488f0e5 Binary files /dev/null and b/app/src/main/assets/daxiao.svga differ diff --git a/app/src/main/assets/mic_up_count_down.svga b/app/src/main/assets/mic_up_count_down.svga new file mode 100644 index 00000000..e32e4fc7 Binary files /dev/null and b/app/src/main/assets/mic_up_count_down.svga differ diff --git a/app/src/main/assets/red_pocket_miss.svga b/app/src/main/assets/red_pocket_miss.svga new file mode 100755 index 00000000..a79ee156 Binary files /dev/null and b/app/src/main/assets/red_pocket_miss.svga differ diff --git a/app/src/main/assets/yingbi.svga b/app/src/main/assets/yingbi.svga new file mode 100644 index 00000000..584ced34 Binary files /dev/null and b/app/src/main/assets/yingbi.svga differ diff --git a/app/src/main/java/com/example/ponycui_home/svgaplayer/AnimationFromAssetsActivity.java b/app/src/main/java/com/example/ponycui_home/svgaplayer/AnimationFromAssetsActivity.java index b9ff95ba..c1ec3844 100644 --- a/app/src/main/java/com/example/ponycui_home/svgaplayer/AnimationFromAssetsActivity.java +++ b/app/src/main/java/com/example/ponycui_home/svgaplayer/AnimationFromAssetsActivity.java @@ -31,12 +31,14 @@ public void onClick(View view) { animationView.stepToFrame(currentIndex++, false); } }); + // animationView.setImageDrawable(getResources().getDrawable(R.drawable.icon_lock_screen_arrow)); loadAnimation(); setContentView(animationView); } private void loadAnimation() { - parser.decodeFromAssets(this.randomSample(), new SVGAParser.ParseCompletion() { + parser.decodeFromAssets("mic_up_count_down.svga", new SVGAParser.ParseCompletion() { + // parser.decodeFromAssets("roomlist_ranking.svga", new SVGAParser.ParseCompletion() { @Override public void onComplete(@NotNull SVGAVideoEntity videoItem) { animationView.setVideoItem(videoItem); diff --git a/app/src/main/java/com/example/ponycui_home/svgaplayer/MainActivity.java b/app/src/main/java/com/example/ponycui_home/svgaplayer/MainActivity.java index d778582a..cdecbe5c 100644 --- a/app/src/main/java/com/example/ponycui_home/svgaplayer/MainActivity.java +++ b/app/src/main/java/com/example/ponycui_home/svgaplayer/MainActivity.java @@ -1,49 +1,27 @@ package com.example.ponycui_home.svgaplayer; -import android.app.Activity; import android.content.Intent; import android.database.DataSetObserver; -import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Paint; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; -import android.text.Layout; -import android.text.Spannable; -import android.text.SpannableStringBuilder; -import android.text.StaticLayout; -import android.text.TextPaint; -import android.text.style.ForegroundColorSpan; +import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; -import com.opensource.svgaplayer.SVGADrawable; -import com.opensource.svgaplayer.SVGADynamicEntity; -import com.opensource.svgaplayer.SVGAImageView; -import com.opensource.svgaplayer.SVGAParser; -import com.opensource.svgaplayer.SVGAPlayer; -import com.opensource.svgaplayer.SVGAVideoEntity; +import com.opensource.svgaplayer.proto.AudioEntity; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; import java.util.ArrayList; -import java.util.List; -import kotlin.Unit; -import kotlin.jvm.functions.Function1; -import kotlin.jvm.functions.Function2; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; +import ikxd.cproxy.InnerV2; +import okio.ByteString; class SampleItem { @@ -61,13 +39,52 @@ public class MainActivity extends AppCompatActivity { ListView listView; ArrayList items = new ArrayList(); + private byte[] bytes; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setupData(); this.setupListView(); - setContentView(listView); + LinearLayout linearLayout = new LinearLayout(this); + linearLayout.setOrientation(LinearLayout.VERTICAL); + linearLayout.addView(listView); + setContentView(linearLayout); + + Button ser1 = new Button(this); + ser1.setText("序列化"); + linearLayout.addView(ser1); + Button ser2 = new Button(this); + ser2.setText("反序列化"); + linearLayout.addView(ser2); + + ser1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AudioEntity entity = new AudioEntity.Builder().totalTime(33).build(); + byte[] payload = entity.encode(); + InnerV2 innerV2 = new InnerV2.Builder().payload(ByteString.of(payload)).build(); + bytes = innerV2.encode(); + Log.i("chenrenzhan-2", "序列化 payload " + payload.length + " , entity" + entity + " , inner2 " + innerV2); + } + }); + ser2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + InnerV2 innerV2 = null; + try { + innerV2 = InnerV2.ADAPTER.decode(bytes); + AudioEntity entity = AudioEntity.ADAPTER.decode(innerV2.payload); + Log.i("chenrenzhan-2", "反序列化 payload " + innerV2.payload.size() + " , entity" + entity + " , " + + "innerV2" + innerV2); + Log.i("chenrenzhan-2", "反序列化 uri " + innerV2.uri); + Log.i("chenrenzhan-2", "反序列化 startFrame " + entity.startFrame); + } catch (Exception e) { + e.printStackTrace(); + Log.i("dd", e.getMessage()); + } + } + }); } void setupData() { diff --git a/app/src/main/java/common/Biz.java b/app/src/main/java/common/Biz.java new file mode 100644 index 00000000..48f9cd16 --- /dev/null +++ b/app/src/main/java/common/Biz.java @@ -0,0 +1,182 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Map; +import okio.ByteString; + +/** + * BIZ 对应的是Header.biz字段,用于给业务做一些透传信息 + * 使用方法: + * 服务器通过biz_actions告诉客户端更新biz信息,客户端将信息保存在内存里面 + * 客户端给服务端发包的时候,需要将对应的sname的biz信息填充在biz_infos字段里面 + */ +public final class Biz extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Biz.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + /** + * see EBizType + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#INT64", + label = WireField.Label.REPEATED + ) + public final List types; + + /** + * 各列的编号和EBizType保持一致 + * 下行包携带,用于给服务端控制客户端的biz信息 + */ + @WireField( + tag = 10, + adapter = "common.BizAction#ADAPTER", + label = WireField.Label.REPEATED + ) + public final List biz_actions; + + /** + * 上行包携带,客户端携带这些信息给对应的sname + */ + @WireField( + tag = 11, + keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final Map biz_infos; + + /** + * 一些扩展的字段,上下行都有可能,由业务自行决定怎么用 + */ + @WireField( + tag = 12, + keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final Map biz_ext; + + public Biz(List types, List biz_actions, Map biz_infos, + Map biz_ext) { + this(types, biz_actions, biz_infos, biz_ext, ByteString.EMPTY); + } + + public Biz(List types, List biz_actions, Map biz_infos, + Map biz_ext, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.types = Internal.immutableCopyOf("types", types); + this.biz_actions = Internal.immutableCopyOf("biz_actions", biz_actions); + this.biz_infos = Internal.immutableCopyOf("biz_infos", biz_infos); + this.biz_ext = Internal.immutableCopyOf("biz_ext", biz_ext); + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.types = Internal.copyOf(types); + builder.biz_actions = Internal.copyOf(biz_actions); + builder.biz_infos = Internal.copyOf(biz_infos); + builder.biz_ext = Internal.copyOf(biz_ext); + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof Biz)) return false; + Biz o = (Biz) other; + return unknownFields().equals(o.unknownFields()) + && types.equals(o.types) + && biz_actions.equals(o.biz_actions) + && biz_infos.equals(o.biz_infos) + && biz_ext.equals(o.biz_ext); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + types.hashCode(); + result = result * 37 + biz_actions.hashCode(); + result = result * 37 + biz_infos.hashCode(); + result = result * 37 + biz_ext.hashCode(); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public List types; + + public List biz_actions; + + public Map biz_infos; + + public Map biz_ext; + + public Builder() { + types = Internal.newMutableList(); + biz_actions = Internal.newMutableList(); + biz_infos = Internal.newMutableMap(); + biz_ext = Internal.newMutableMap(); + } + + /** + * see EBizType + */ + public Builder types(List types) { + Internal.checkElementsNotNull(types); + this.types = types; + return this; + } + + /** + * 各列的编号和EBizType保持一致 + * 下行包携带,用于给服务端控制客户端的biz信息 + */ + public Builder biz_actions(List biz_actions) { + Internal.checkElementsNotNull(biz_actions); + this.biz_actions = biz_actions; + return this; + } + + /** + * 上行包携带,客户端携带这些信息给对应的sname + */ + public Builder biz_infos(Map biz_infos) { + Internal.checkElementsNotNull(biz_infos); + this.biz_infos = biz_infos; + return this; + } + + /** + * 一些扩展的字段,上下行都有可能,由业务自行决定怎么用 + */ + public Builder biz_ext(Map biz_ext) { + Internal.checkElementsNotNull(biz_ext); + this.biz_ext = biz_ext; + return this; + } + + @Override + public Biz build() { + return new Biz(types, biz_actions, biz_infos, biz_ext, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/common/BizAction.java b/app/src/main/java/common/BizAction.java new file mode 100644 index 00000000..fc87185a --- /dev/null +++ b/app/src/main/java/common/BizAction.java @@ -0,0 +1,183 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +/** + * 变更信息 + */ +public final class BizAction extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(BizAction.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Long DEFAULT_ACTION = 0L; + + public static final String DEFAULT_SNAME = ""; + + public static final String DEFAULT_KEY = ""; + + public static final ByteString DEFAULT_VALUE = ByteString.EMPTY; + + public static final Long DEFAULT_VALID_TIME = 0L; + + /** + * see EBizAction + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long action; + + /** + * Header.sname + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String sname; + + @WireField( + tag = 3, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String key; + + @WireField( + tag = 4, + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final ByteString value; + + /** + * 有效期,秒,相对时间,比如5表示5s后失效。如果没设置或者<=0表示永久有效 + */ + @WireField( + tag = 5, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long valid_time; + + public BizAction(Long action, String sname, String key, ByteString value, Long valid_time) { + this(action, sname, key, value, valid_time, ByteString.EMPTY); + } + + public BizAction(Long action, String sname, String key, ByteString value, Long valid_time, + ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.action = action; + this.sname = sname; + this.key = key; + this.value = value; + this.valid_time = valid_time; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.action = action; + builder.sname = sname; + builder.key = key; + builder.value = value; + builder.valid_time = valid_time; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof BizAction)) return false; + BizAction o = (BizAction) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(action, o.action) + && Internal.equals(sname, o.sname) + && Internal.equals(key, o.key) + && Internal.equals(value, o.value) + && Internal.equals(valid_time, o.valid_time); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (action != null ? action.hashCode() : 0); + result = result * 37 + (sname != null ? sname.hashCode() : 0); + result = result * 37 + (key != null ? key.hashCode() : 0); + result = result * 37 + (value != null ? value.hashCode() : 0); + result = result * 37 + (valid_time != null ? valid_time.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Long action; + + public String sname; + + public String key; + + public ByteString value; + + public Long valid_time; + + public Builder() { + } + + /** + * see EBizAction + */ + public Builder action(Long action) { + this.action = action; + return this; + } + + /** + * Header.sname + */ + public Builder sname(String sname) { + this.sname = sname; + return this; + } + + public Builder key(String key) { + this.key = key; + return this; + } + + public Builder value(ByteString value) { + this.value = value; + return this; + } + + /** + * 有效期,秒,相对时间,比如5表示5s后失效。如果没设置或者<=0表示永久有效 + */ + public Builder valid_time(Long valid_time) { + this.valid_time = valid_time; + return this; + } + + @Override + public BizAction build() { + return new BizAction(action, sname, key, value, valid_time, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/common/EBizAction.java b/app/src/main/java/common/EBizAction.java new file mode 100644 index 00000000..da40fcf6 --- /dev/null +++ b/app/src/main/java/common/EBizAction.java @@ -0,0 +1,50 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +/** + * ///////////////////////BIZ////////////////////////////////// + * 用于控制变更行为 + */ +public enum EBizAction implements WireEnum { + BizActionNone(0), + + /** + * 添加、修改(也就是覆盖) + */ + BizActionAdd(1), + + /** + * 删除 + */ + BizActionDel(2); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(EBizAction.class); + + private final int value; + + EBizAction(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static EBizAction fromValue(int value) { + switch (value) { + case 0: return BizActionNone; + case 1: return BizActionAdd; + case 2: return BizActionDel; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/java/common/EBizType.java b/app/src/main/java/common/EBizType.java new file mode 100644 index 00000000..521a94df --- /dev/null +++ b/app/src/main/java/common/EBizType.java @@ -0,0 +1,43 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +public enum EBizType implements WireEnum { + EBizTypeNone(0), + + EBizTypeAction(10), + + EBizTypeInfos(11), + + EBizTypeExt(12); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(EBizType.class); + + private final int value; + + EBizType(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static EBizType fromValue(int value) { + switch (value) { + case 0: return EBizTypeNone; + case 10: return EBizTypeAction; + case 11: return EBizTypeInfos; + case 12: return EBizTypeExt; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/java/common/ERet.java b/app/src/main/java/common/ERet.java new file mode 100644 index 00000000..b51047b9 --- /dev/null +++ b/app/src/main/java/common/ERet.java @@ -0,0 +1,352 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +/** + * 系统保留错误码 0-999 + */ +public enum ERet implements WireEnum { + kRetSuccess(0), + + /** + * 参数错误 + */ + kRetErrParameter(1), + + /** + * cookie错误 + */ + kRetErrCookie(2), + + /** + * 未授权 + */ + kRetErrUnauthorized(3), + + /** + * 服务器不支持的uri + */ + kRetErrUnknowUri(4), + + /** + * 不再支持该版本 + */ + kRetErrVersion(5), + + /** + * 账号被封禁 + */ + kRetErrBanned(6), + + /** + * 服务器忙 + */ + kRetErrBusy(7), + + /** + * Some requested entity (e.g., file or directory) was not found. + * HTTP Mapping: 404 Not Found + */ + kRetErrNotFound(8), + + /** + * The entity that a client attempted to create (e.g., file or directory) + * already exists. + * + * HTTP Mapping: 409 Conflict + */ + kRetErrAlreadyExists(9), + + /** + * The caller does not have permission to execute the specified + * operation. `PERMISSION_DENIED` must not be used for rejections + * caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + * instead for those errors). `PERMISSION_DENIED` must not be + * used if the caller can not be identified (use `UNAUTHENTICATED` + * instead for those errors). This error code does not imply the + * request is valid or the requested entity exists or satisfies + * other pre-conditions. + * + * HTTP Mapping: 403 Forbidden + */ + kRetErrPermissionDenied(10), + + /** + * 版本不兼容,操作无法完成 + */ + kRetErrIncompatibleVersion(11), + + /** + * 系统错误,尽量少用这个 + */ + kRetErrSystem(999), + + /** + * 游戏不存在,可能已经下架 + */ + kRetErrGameIdNotExist(1001), + + /** + * im pk重复邀请 + */ + kRetErrImPkRepeatedInvite(1002), + + /** + * im pk邀请过期 + */ + kRetErrImPkInviteOutOfDate(1003), + + /** + * 创建pk URl失败 + */ + kRetErrGenPkGameUrlFailed(1004), + + /** + * s2s AddrlistFriends接口失败 + */ + kRetErrS2SAddrlistFriendsFailed(1005), + + /** + * s2s FbFriends接口失败 + */ + kRetErrS2SFbFriendsFailed(1006), + + /** + * s2s GetFriendList接口失败 + */ + kRetErrS2SGetFriendListFailed(1007), + + /** + * s2s GetUserStatus接口失败 + */ + kRetErrS2SGetUserStatusFailed(1008), + + /** + * s2s GetUsersInfo接口失败 + */ + kRetErrS2SGetUsersInfoFailed(1009), + + /** + * 游戏维护中 + */ + kRetErrGameMaintain(1010), + + /** + * 游戏标满 + */ + kRetErrGameFull(1011), + + /** + * im pk邀请已被接受 + */ + kRetErrImPkInviteAccepted(1012), + + /** + * 场次无效 + */ + kRetErrIdInvalid(1013), + + /** + * 能量不足 + */ + kRetErrPowerLow(1014), + + /** + * 钱不足 + */ + kRetErrMoneyLow(1015), + + /** + * source错误 + */ + kRetErrSource(1016), + + /** + * 达到每天上限1000人 + */ + kRetErrRecommendDailyLimit(1051), + + /** + * 附近找不到人 + */ + kRetErrRecommendNearbyNone(1052), + + /** + * 2000 - 2100 组队游戏专用 + * 组队人数已满 + */ + kRetErrTeamFull(2000), + + /** + * 组队已失效 + */ + kRetErrTeamInvalid(2001), + + /** + * 游戏已开始 + */ + kRetErrGameHasBegun(2002), + + /** + * 用户游戏状态为游戏中,不能创建或加入新队伍 + */ + kRetErrGameing(2003), + + /** + * 邀请者已离开房间 + */ + kRetErrInviteLeaved(2004), + + /** + * 用户在团队中,不能重新创建团队 + */ + KRetErrBelongTeam(2005), + + /** + * 获取游戏信息失败 + */ + kRetErrGetGameInfoErr(2006), + + /** + * 不在匹配中 + */ + kRetErrNoInMatch(2007), + + /** + * 取消匹配失败 + */ + kRetErrCancelMatchErr(2008), + + /** + * 用户不在指定房间 + */ + kRetErrUserNotInRoom(2009), + + /** + * 团队匹配中 + */ + kRetErrTeamMatching(2010), + + /** + * 对方已接受你发起的im创建团队邀请,暂时不能再接受其它组队邀请 + */ + kRetErrImTeamCreating(2011), + + /** + * 部分用户不支持切换组队模板 + */ + kRetErrChangeTemplate(2012), + + /** + * 2101 - 2200 语音呼叫协议专用 + * 自己正在忙碌中,例如正在游戏中(现在不支持),正在通话中 + */ + kRetErrVoiceChatSelfBusy(2101), + + /** + * 对方正在忙碌中,例如正在游戏中(现在不支持),正在通话中 + */ + kRetErrVoiceChatOtherBusy(2102), + + /** + * 呼叫超时 + */ + kRetErrVoiceChatCallTimeout(2103), + + /** + * 不是被呼叫的用户 + */ + kRetErrVoiceChatUserNotBeCall(2104), + + /** + * 聊天已经开始(取消失败的情况下) + */ + kRetErrVoiceChatHadStarted(2105), + + /** + * 通话已结束 + */ + kRetErrVoiceChatHadStop(2106), + + /** + * 对方不在线 + */ + kRetErrVoiceChatOffLine(2107); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(ERet.class); + + private final int value; + + ERet(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static ERet fromValue(int value) { + switch (value) { + case 0: return kRetSuccess; + case 1: return kRetErrParameter; + case 2: return kRetErrCookie; + case 3: return kRetErrUnauthorized; + case 4: return kRetErrUnknowUri; + case 5: return kRetErrVersion; + case 6: return kRetErrBanned; + case 7: return kRetErrBusy; + case 8: return kRetErrNotFound; + case 9: return kRetErrAlreadyExists; + case 10: return kRetErrPermissionDenied; + case 11: return kRetErrIncompatibleVersion; + case 999: return kRetErrSystem; + case 1001: return kRetErrGameIdNotExist; + case 1002: return kRetErrImPkRepeatedInvite; + case 1003: return kRetErrImPkInviteOutOfDate; + case 1004: return kRetErrGenPkGameUrlFailed; + case 1005: return kRetErrS2SAddrlistFriendsFailed; + case 1006: return kRetErrS2SFbFriendsFailed; + case 1007: return kRetErrS2SGetFriendListFailed; + case 1008: return kRetErrS2SGetUserStatusFailed; + case 1009: return kRetErrS2SGetUsersInfoFailed; + case 1010: return kRetErrGameMaintain; + case 1011: return kRetErrGameFull; + case 1012: return kRetErrImPkInviteAccepted; + case 1013: return kRetErrIdInvalid; + case 1014: return kRetErrPowerLow; + case 1015: return kRetErrMoneyLow; + case 1016: return kRetErrSource; + case 1051: return kRetErrRecommendDailyLimit; + case 1052: return kRetErrRecommendNearbyNone; + case 2000: return kRetErrTeamFull; + case 2001: return kRetErrTeamInvalid; + case 2002: return kRetErrGameHasBegun; + case 2003: return kRetErrGameing; + case 2004: return kRetErrInviteLeaved; + case 2005: return KRetErrBelongTeam; + case 2006: return kRetErrGetGameInfoErr; + case 2007: return kRetErrNoInMatch; + case 2008: return kRetErrCancelMatchErr; + case 2009: return kRetErrUserNotInRoom; + case 2010: return kRetErrTeamMatching; + case 2011: return kRetErrImTeamCreating; + case 2012: return kRetErrChangeTemplate; + case 2101: return kRetErrVoiceChatSelfBusy; + case 2102: return kRetErrVoiceChatOtherBusy; + case 2103: return kRetErrVoiceChatCallTimeout; + case 2104: return kRetErrVoiceChatUserNotBeCall; + case 2105: return kRetErrVoiceChatHadStarted; + case 2106: return kRetErrVoiceChatHadStop; + case 2107: return kRetErrVoiceChatOffLine; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/java/common/ESex.java b/app/src/main/java/common/ESex.java new file mode 100644 index 00000000..8d16983e --- /dev/null +++ b/app/src/main/java/common/ESex.java @@ -0,0 +1,43 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +public enum ESex implements WireEnum { + kSexFemale(0), + + kSexMale(1), + + /** + * 用于性别过滤场景 + */ + kSexAll(2); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(ESex.class); + + private final int value; + + ESex(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static ESex fromValue(int value) { + switch (value) { + case 0: return kSexFemale; + case 1: return kSexMale; + case 2: return kSexAll; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/java/common/Header.java b/app/src/main/java/common/Header.java new file mode 100644 index 00000000..7954e4b0 --- /dev/null +++ b/app/src/main/java/common/Header.java @@ -0,0 +1,438 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Boolean; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import okio.ByteString; + +public final class Header extends AndroidMessage { + public static final ProtoAdapter
ADAPTER = ProtoAdapter.newMessageAdapter(Header.class); + + public static final Creator
CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_SNAME = ""; + + public static final Long DEFAULT_SEQID = 0L; + + public static final Long DEFAULT_CODE = 0L; + + public static final String DEFAULT_LANG = ""; + + public static final String DEFAULT_TID = ""; + + public static final String DEFAULT_ROOMID = ""; + + public static final String DEFAULT_METHOD = ""; + + public static final String DEFAULT_VERSION = ""; + + public static final MSGTYPE DEFAULT_MSGTYPE = MSGTYPE.MSGTYPE_UNKNOWN; + + public static final Boolean DEFAULT_BACK_GROUND = false; + + public static final ByteString DEFAULT_BIZ = ByteString.EMPTY; + + public static final ByteString DEFAULT_ROUTING_KEY = ByteString.EMPTY; + + /** + * service name + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String sname; + + /** + * sequence id + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long seqid; + + /** + * return code + */ + @WireField( + tag = 3, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long code; + + /** + * 语言代码_国家代码,如:zh_CN,en_US + */ + @WireField( + tag = 4, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String lang; + + /** + * traceid 客户端不用填,只需要收到包的时候log出来 + */ + @WireField( + tag = 5, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String tid; + + @WireField( + tag = 6, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String roomid; + + /** + * rpc调用时使用的函数名称 + */ + @WireField( + tag = 7, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String method; + + /** + * 版本信息, 客户端现在用这个字段来区分新老消息,老版本消息禁止填写 + */ + @WireField( + tag = 8, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String version; + + /** + * 消息类型 + */ + @WireField( + tag = 9, + adapter = "common.Header$MSGTYPE#ADAPTER" + ) + public final MSGTYPE msgtype; + + /** + * 是否处于后台,true表示处于后台,false表示处于前台。MSGTYPE_REQ类型消息才需要 + */ + @WireField( + tag = 10, + adapter = "com.squareup.wire.ProtoAdapter#BOOL" + ) + public final Boolean back_ground; + + /** + * 业务透传字段。 + */ + @WireField( + tag = 11, + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final ByteString biz; + + /** + * 扩展字段 + */ + @WireField( + tag = 12, + keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final Map extend; + + /** + * 路由信息 + */ + @WireField( + tag = 13, + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final ByteString routing_key; + + public Header(String sname, Long seqid, Long code, String lang, String tid, String roomid, + String method, String version, MSGTYPE msgtype, Boolean back_ground, ByteString biz, + Map extend, ByteString routing_key) { + this(sname, seqid, code, lang, tid, roomid, method, version, msgtype, back_ground, biz, extend, routing_key, ByteString.EMPTY); + } + + public Header(String sname, Long seqid, Long code, String lang, String tid, String roomid, + String method, String version, MSGTYPE msgtype, Boolean back_ground, ByteString biz, + Map extend, ByteString routing_key, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.sname = sname; + this.seqid = seqid; + this.code = code; + this.lang = lang; + this.tid = tid; + this.roomid = roomid; + this.method = method; + this.version = version; + this.msgtype = msgtype; + this.back_ground = back_ground; + this.biz = biz; + this.extend = Internal.immutableCopyOf("extend", extend); + this.routing_key = routing_key; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.sname = sname; + builder.seqid = seqid; + builder.code = code; + builder.lang = lang; + builder.tid = tid; + builder.roomid = roomid; + builder.method = method; + builder.version = version; + builder.msgtype = msgtype; + builder.back_ground = back_ground; + builder.biz = biz; + builder.extend = Internal.copyOf(extend); + builder.routing_key = routing_key; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof Header)) return false; + Header o = (Header) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(sname, o.sname) + && Internal.equals(seqid, o.seqid) + && Internal.equals(code, o.code) + && Internal.equals(lang, o.lang) + && Internal.equals(tid, o.tid) + && Internal.equals(roomid, o.roomid) + && Internal.equals(method, o.method) + && Internal.equals(version, o.version) + && Internal.equals(msgtype, o.msgtype) + && Internal.equals(back_ground, o.back_ground) + && Internal.equals(biz, o.biz) + && extend.equals(o.extend) + && Internal.equals(routing_key, o.routing_key); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (sname != null ? sname.hashCode() : 0); + result = result * 37 + (seqid != null ? seqid.hashCode() : 0); + result = result * 37 + (code != null ? code.hashCode() : 0); + result = result * 37 + (lang != null ? lang.hashCode() : 0); + result = result * 37 + (tid != null ? tid.hashCode() : 0); + result = result * 37 + (roomid != null ? roomid.hashCode() : 0); + result = result * 37 + (method != null ? method.hashCode() : 0); + result = result * 37 + (version != null ? version.hashCode() : 0); + result = result * 37 + (msgtype != null ? msgtype.hashCode() : 0); + result = result * 37 + (back_ground != null ? back_ground.hashCode() : 0); + result = result * 37 + (biz != null ? biz.hashCode() : 0); + result = result * 37 + extend.hashCode(); + result = result * 37 + (routing_key != null ? routing_key.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String sname; + + public Long seqid; + + public Long code; + + public String lang; + + public String tid; + + public String roomid; + + public String method; + + public String version; + + public MSGTYPE msgtype; + + public Boolean back_ground; + + public ByteString biz; + + public Map extend; + + public ByteString routing_key; + + public Builder() { + extend = Internal.newMutableMap(); + } + + /** + * service name + */ + public Builder sname(String sname) { + this.sname = sname; + return this; + } + + /** + * sequence id + */ + public Builder seqid(Long seqid) { + this.seqid = seqid; + return this; + } + + /** + * return code + */ + public Builder code(Long code) { + this.code = code; + return this; + } + + /** + * 语言代码_国家代码,如:zh_CN,en_US + */ + public Builder lang(String lang) { + this.lang = lang; + return this; + } + + /** + * traceid 客户端不用填,只需要收到包的时候log出来 + */ + public Builder tid(String tid) { + this.tid = tid; + return this; + } + + public Builder roomid(String roomid) { + this.roomid = roomid; + return this; + } + + /** + * rpc调用时使用的函数名称 + */ + public Builder method(String method) { + this.method = method; + return this; + } + + /** + * 版本信息, 客户端现在用这个字段来区分新老消息,老版本消息禁止填写 + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * 消息类型 + */ + public Builder msgtype(MSGTYPE msgtype) { + this.msgtype = msgtype; + return this; + } + + /** + * 是否处于后台,true表示处于后台,false表示处于前台。MSGTYPE_REQ类型消息才需要 + */ + public Builder back_ground(Boolean back_ground) { + this.back_ground = back_ground; + return this; + } + + /** + * 业务透传字段。 + */ + public Builder biz(ByteString biz) { + this.biz = biz; + return this; + } + + /** + * 扩展字段 + */ + public Builder extend(Map extend) { + Internal.checkElementsNotNull(extend); + this.extend = extend; + return this; + } + + /** + * 路由信息 + */ + public Builder routing_key(ByteString routing_key) { + this.routing_key = routing_key; + return this; + } + + @Override + public Header build() { + return new Header(sname, seqid, code, lang, tid, roomid, method, version, msgtype, back_ground, biz, extend, routing_key, super.buildUnknownFields()); + } + } + + public enum MSGTYPE implements WireEnum { + MSGTYPE_UNKNOWN(0), + + /** + * 请求消息 + */ + MSGTYPE_REQ(1), + + /** + * 响应消息 + */ + MSGTYPE_RESP(2), + + /** + * 单播消息 + */ + MSGTYPE_NOTICE(3); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(MSGTYPE.class); + + private final int value; + + MSGTYPE(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static MSGTYPE fromValue(int value) { + switch (value) { + case 0: return MSGTYPE_UNKNOWN; + case 1: return MSGTYPE_REQ; + case 2: return MSGTYPE_RESP; + case 3: return MSGTYPE_NOTICE; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } + } +} diff --git a/app/src/main/java/common/Page.java b/app/src/main/java/common/Page.java new file mode 100644 index 00000000..29d2250a --- /dev/null +++ b/app/src/main/java/common/Page.java @@ -0,0 +1,173 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +/** + * ///////////////////////BIZ////////////////////////////////// + * ///////////////////////PAGE////////////////////////////////// + * 统一的分页结构体 + * 客户端请求带上:snap(第一次为0), offset 和 limit + * 服务器返回: snap, offset(==0,偏移从0开始), limit, total + * 全量列表: offset<0, limit <0 + */ +public final class Page extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Page.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Long DEFAULT_SNAP = 0L; + + public static final Long DEFAULT_OFFSET = 0L; + + public static final Long DEFAULT_LIMIT = 0L; + + public static final Long DEFAULT_TOTAL = 0L; + + /** + * 快照版本号 + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long snap; + + /** + * 偏移 (<0:全量) + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long offset; + + /** + * 长度限制(<0:全量) + */ + @WireField( + tag = 3, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long limit; + + /** + * 总长度 + */ + @WireField( + tag = 4, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long total; + + public Page(Long snap, Long offset, Long limit, Long total) { + this(snap, offset, limit, total, ByteString.EMPTY); + } + + public Page(Long snap, Long offset, Long limit, Long total, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.snap = snap; + this.offset = offset; + this.limit = limit; + this.total = total; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.snap = snap; + builder.offset = offset; + builder.limit = limit; + builder.total = total; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof Page)) return false; + Page o = (Page) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(snap, o.snap) + && Internal.equals(offset, o.offset) + && Internal.equals(limit, o.limit) + && Internal.equals(total, o.total); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (snap != null ? snap.hashCode() : 0); + result = result * 37 + (offset != null ? offset.hashCode() : 0); + result = result * 37 + (limit != null ? limit.hashCode() : 0); + result = result * 37 + (total != null ? total.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Long snap; + + public Long offset; + + public Long limit; + + public Long total; + + public Builder() { + } + + /** + * 快照版本号 + */ + public Builder snap(Long snap) { + this.snap = snap; + return this; + } + + /** + * 偏移 (<0:全量) + */ + public Builder offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * 长度限制(<0:全量) + */ + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * 总长度 + */ + public Builder total(Long total) { + this.total = total; + return this; + } + + @Override + public Page build() { + return new Page(snap, offset, limit, total, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/common/Response.java b/app/src/main/java/common/Response.java new file mode 100644 index 00000000..4aa3cf7e --- /dev/null +++ b/app/src/main/java/common/Response.java @@ -0,0 +1,84 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +/** + * 用一个很通用的名称表征通用response结构 + */ +public final class Response extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Response.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + @WireField( + tag = 1, + adapter = "common.Result#ADAPTER" + ) + public final Result result; + + public Response(Result result) { + this(result, ByteString.EMPTY); + } + + public Response(Result result, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.result = result; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.result = result; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof Response)) return false; + Response o = (Response) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(result, o.result); + } + + @Override + public int hashCode() { + int result_ = super.hashCode; + if (result_ == 0) { + result_ = unknownFields().hashCode(); + result_ = result_ * 37 + (result != null ? result.hashCode() : 0); + super.hashCode = result_; + } + return result_; + } + + public static final class Builder extends Message.Builder { + public Result result; + + public Builder() { + } + + public Builder result(Result result) { + this.result = result; + return this; + } + + @Override + public Response build() { + return new Response(result, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/common/Result.java b/app/src/main/java/common/Result.java new file mode 100644 index 00000000..8bfa7bdf --- /dev/null +++ b/app/src/main/java/common/Result.java @@ -0,0 +1,141 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class Result extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Result.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Long DEFAULT_ERRCODE = 0L; + + public static final String DEFAULT_ERRMSG = ""; + + public static final Long DEFAULT_MAGIC = 0L; + + /** + * 每个协议自己定义, 0-999是系统保留 + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long errcode; + + /** + * 错误信息,可以被用来展示(包含了i18n的功能) + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String errmsg; + + /** + * 兼容处理: 0x4861676f + */ + @WireField( + tag = 3, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long magic; + + public Result(Long errcode, String errmsg, Long magic) { + this(errcode, errmsg, magic, ByteString.EMPTY); + } + + public Result(Long errcode, String errmsg, Long magic, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.errcode = errcode; + this.errmsg = errmsg; + this.magic = magic; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.errcode = errcode; + builder.errmsg = errmsg; + builder.magic = magic; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof Result)) return false; + Result o = (Result) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(errcode, o.errcode) + && Internal.equals(errmsg, o.errmsg) + && Internal.equals(magic, o.magic); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (errcode != null ? errcode.hashCode() : 0); + result = result * 37 + (errmsg != null ? errmsg.hashCode() : 0); + result = result * 37 + (magic != null ? magic.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Long errcode; + + public String errmsg; + + public Long magic; + + public Builder() { + } + + /** + * 每个协议自己定义, 0-999是系统保留 + */ + public Builder errcode(Long errcode) { + this.errcode = errcode; + return this; + } + + /** + * 错误信息,可以被用来展示(包含了i18n的功能) + */ + public Builder errmsg(String errmsg) { + this.errmsg = errmsg; + return this; + } + + /** + * 兼容处理: 0x4861676f + */ + public Builder magic(Long magic) { + this.magic = magic; + return this; + } + + @Override + public Result build() { + return new Result(errcode, errmsg, magic, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/common/YMicroRet.java b/app/src/main/java/common/YMicroRet.java new file mode 100644 index 00000000..1282e0ce --- /dev/null +++ b/app/src/main/java/common/YMicroRet.java @@ -0,0 +1,82 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: common.proto +package common; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +/** + * YMicro框架层返回码 + */ +public enum YMicroRet implements WireEnum { + /** + * 成功 + */ + YMicroRetSuccess(0), + + /** + * 请求非法 + */ + YMicroRetBadRequest(400), + + /** + * 请求未鉴权 + */ + YMicroRetUnauthorized(401), + + /** + * 请求被禁止 + */ + YMicroRetForbidden(403), + + /** + * 请求后端服务未找到 + */ + YMicroRetNotFound(404), + + /** + * 请求后端方法被禁止 + */ + YMicroRetMethodNotAllowed(405), + + /** + * 请求冲突 + */ + YMicroRetConflict(409), + + /** + * 内部服务错误 + */ + YMicroRetInternalServerError(500); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(YMicroRet.class); + + private final int value; + + YMicroRet(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static YMicroRet fromValue(int value) { + switch (value) { + case 0: return YMicroRetSuccess; + case 400: return YMicroRetBadRequest; + case 401: return YMicroRetUnauthorized; + case 403: return YMicroRetForbidden; + case 404: return YMicroRetNotFound; + case 405: return YMicroRetMethodNotAllowed; + case 409: return YMicroRetConflict; + case 500: return YMicroRetInternalServerError; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/java/ikxd/cproxy/CProxy.java b/app/src/main/java/ikxd/cproxy/CProxy.java new file mode 100644 index 00000000..cd661213 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/CProxy.java @@ -0,0 +1,242 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import common.Header; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +public final class CProxy extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(CProxy.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Uri DEFAULT_URI = Uri.kUriNone; + + @WireField( + tag = 1, + adapter = "common.Header#ADAPTER" + ) + public final Header header; + + @WireField( + tag = 2, + adapter = "ikxd.cproxy.Uri#ADAPTER" + ) + public final Uri uri; + + @WireField( + tag = 11, + adapter = "ikxd.cproxy.ToastNotify#ADAPTER" + ) + public final ToastNotify toast_notify; + + @WireField( + tag = 12, + adapter = "ikxd.cproxy.JoinRoomReq#ADAPTER" + ) + public final JoinRoomReq join_room_req; + + @WireField( + tag = 13, + adapter = "ikxd.cproxy.JoinRoomRes#ADAPTER" + ) + public final JoinRoomRes join_room_res; + + @WireField( + tag = 14, + adapter = "ikxd.cproxy.LeaveRoomReq#ADAPTER" + ) + public final LeaveRoomReq leave_room_req; + + @WireField( + tag = 15, + adapter = "ikxd.cproxy.LeaveRoomRes#ADAPTER" + ) + public final LeaveRoomRes leave_room_res; + + @WireField( + tag = 16, + adapter = "ikxd.cproxy.HeartbeatReq#ADAPTER" + ) + public final HeartbeatReq heartbeat_req; + + @WireField( + tag = 17, + adapter = "ikxd.cproxy.HeartbeatRes#ADAPTER" + ) + public final HeartbeatRes heartbeat_res; + + @WireField( + tag = 18, + adapter = "ikxd.cproxy.ProbeNotify#ADAPTER" + ) + public final ProbeNotify probe_notify; + + public CProxy(Header header, Uri uri, ToastNotify toast_notify, JoinRoomReq join_room_req, + JoinRoomRes join_room_res, LeaveRoomReq leave_room_req, LeaveRoomRes leave_room_res, + HeartbeatReq heartbeat_req, HeartbeatRes heartbeat_res, ProbeNotify probe_notify) { + this(header, uri, toast_notify, join_room_req, join_room_res, leave_room_req, leave_room_res, heartbeat_req, heartbeat_res, probe_notify, ByteString.EMPTY); + } + + public CProxy(Header header, Uri uri, ToastNotify toast_notify, JoinRoomReq join_room_req, + JoinRoomRes join_room_res, LeaveRoomReq leave_room_req, LeaveRoomRes leave_room_res, + HeartbeatReq heartbeat_req, HeartbeatRes heartbeat_res, ProbeNotify probe_notify, + ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.header = header; + this.uri = uri; + this.toast_notify = toast_notify; + this.join_room_req = join_room_req; + this.join_room_res = join_room_res; + this.leave_room_req = leave_room_req; + this.leave_room_res = leave_room_res; + this.heartbeat_req = heartbeat_req; + this.heartbeat_res = heartbeat_res; + this.probe_notify = probe_notify; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.header = header; + builder.uri = uri; + builder.toast_notify = toast_notify; + builder.join_room_req = join_room_req; + builder.join_room_res = join_room_res; + builder.leave_room_req = leave_room_req; + builder.leave_room_res = leave_room_res; + builder.heartbeat_req = heartbeat_req; + builder.heartbeat_res = heartbeat_res; + builder.probe_notify = probe_notify; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof CProxy)) return false; + CProxy o = (CProxy) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(header, o.header) + && Internal.equals(uri, o.uri) + && Internal.equals(toast_notify, o.toast_notify) + && Internal.equals(join_room_req, o.join_room_req) + && Internal.equals(join_room_res, o.join_room_res) + && Internal.equals(leave_room_req, o.leave_room_req) + && Internal.equals(leave_room_res, o.leave_room_res) + && Internal.equals(heartbeat_req, o.heartbeat_req) + && Internal.equals(heartbeat_res, o.heartbeat_res) + && Internal.equals(probe_notify, o.probe_notify); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (header != null ? header.hashCode() : 0); + result = result * 37 + (uri != null ? uri.hashCode() : 0); + result = result * 37 + (toast_notify != null ? toast_notify.hashCode() : 0); + result = result * 37 + (join_room_req != null ? join_room_req.hashCode() : 0); + result = result * 37 + (join_room_res != null ? join_room_res.hashCode() : 0); + result = result * 37 + (leave_room_req != null ? leave_room_req.hashCode() : 0); + result = result * 37 + (leave_room_res != null ? leave_room_res.hashCode() : 0); + result = result * 37 + (heartbeat_req != null ? heartbeat_req.hashCode() : 0); + result = result * 37 + (heartbeat_res != null ? heartbeat_res.hashCode() : 0); + result = result * 37 + (probe_notify != null ? probe_notify.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Header header; + + public Uri uri; + + public ToastNotify toast_notify; + + public JoinRoomReq join_room_req; + + public JoinRoomRes join_room_res; + + public LeaveRoomReq leave_room_req; + + public LeaveRoomRes leave_room_res; + + public HeartbeatReq heartbeat_req; + + public HeartbeatRes heartbeat_res; + + public ProbeNotify probe_notify; + + public Builder() { + } + + public Builder header(Header header) { + this.header = header; + return this; + } + + public Builder uri(Uri uri) { + this.uri = uri; + return this; + } + + public Builder toast_notify(ToastNotify toast_notify) { + this.toast_notify = toast_notify; + return this; + } + + public Builder join_room_req(JoinRoomReq join_room_req) { + this.join_room_req = join_room_req; + return this; + } + + public Builder join_room_res(JoinRoomRes join_room_res) { + this.join_room_res = join_room_res; + return this; + } + + public Builder leave_room_req(LeaveRoomReq leave_room_req) { + this.leave_room_req = leave_room_req; + return this; + } + + public Builder leave_room_res(LeaveRoomRes leave_room_res) { + this.leave_room_res = leave_room_res; + return this; + } + + public Builder heartbeat_req(HeartbeatReq heartbeat_req) { + this.heartbeat_req = heartbeat_req; + return this; + } + + public Builder heartbeat_res(HeartbeatRes heartbeat_res) { + this.heartbeat_res = heartbeat_res; + return this; + } + + public Builder probe_notify(ProbeNotify probe_notify) { + this.probe_notify = probe_notify; + return this; + } + + @Override + public CProxy build() { + return new CProxy(header, uri, toast_notify, join_room_req, join_room_res, leave_room_req, leave_room_res, heartbeat_req, heartbeat_res, probe_notify, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/HeartbeatReq.java b/app/src/main/java/ikxd/cproxy/HeartbeatReq.java new file mode 100644 index 00000000..44f14308 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/HeartbeatReq.java @@ -0,0 +1,142 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Boolean; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class HeartbeatReq extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(HeartbeatReq.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_GAME_ID = ""; + + public static final Boolean DEFAULT_CHANGED = false; + + public static final Boolean DEFAULT_BACK_GROUND = false; + + /** + * 传入当前进行的游戏的gameid,如果非游戏中,不填或者填空字符串 + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String game_id; + + /** + * gameid发生变化的时候为true,其他时候为false + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#BOOL" + ) + public final Boolean changed; + + /** + * 是否处于后台,true表示处于后台,false表示处于前台。前后台切换马上发个心跳 + */ + @WireField( + tag = 3, + adapter = "com.squareup.wire.ProtoAdapter#BOOL" + ) + public final Boolean back_ground; + + public HeartbeatReq(String game_id, Boolean changed, Boolean back_ground) { + this(game_id, changed, back_ground, ByteString.EMPTY); + } + + public HeartbeatReq(String game_id, Boolean changed, Boolean back_ground, + ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.game_id = game_id; + this.changed = changed; + this.back_ground = back_ground; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.game_id = game_id; + builder.changed = changed; + builder.back_ground = back_ground; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof HeartbeatReq)) return false; + HeartbeatReq o = (HeartbeatReq) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(game_id, o.game_id) + && Internal.equals(changed, o.changed) + && Internal.equals(back_ground, o.back_ground); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (game_id != null ? game_id.hashCode() : 0); + result = result * 37 + (changed != null ? changed.hashCode() : 0); + result = result * 37 + (back_ground != null ? back_ground.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String game_id; + + public Boolean changed; + + public Boolean back_ground; + + public Builder() { + } + + /** + * 传入当前进行的游戏的gameid,如果非游戏中,不填或者填空字符串 + */ + public Builder game_id(String game_id) { + this.game_id = game_id; + return this; + } + + /** + * gameid发生变化的时候为true,其他时候为false + */ + public Builder changed(Boolean changed) { + this.changed = changed; + return this; + } + + /** + * 是否处于后台,true表示处于后台,false表示处于前台。前后台切换马上发个心跳 + */ + public Builder back_ground(Boolean back_ground) { + this.back_ground = back_ground; + return this; + } + + @Override + public HeartbeatReq build() { + return new HeartbeatReq(game_id, changed, back_ground, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/HeartbeatRes.java b/app/src/main/java/ikxd/cproxy/HeartbeatRes.java new file mode 100644 index 00000000..64454764 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/HeartbeatRes.java @@ -0,0 +1,115 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +public final class HeartbeatRes extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(HeartbeatRes.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Long DEFAULT_NEXT = 0L; + + public static final Long DEFAULT_TIMESTAMP = 0L; + + /** + * 下一次心跳间隔,单位秒 + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long next; + + /** + * 服务器的unix timestamp,单位毫秒,用于客户端校准时间 + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long timestamp; + + public HeartbeatRes(Long next, Long timestamp) { + this(next, timestamp, ByteString.EMPTY); + } + + public HeartbeatRes(Long next, Long timestamp, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.next = next; + this.timestamp = timestamp; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.next = next; + builder.timestamp = timestamp; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof HeartbeatRes)) return false; + HeartbeatRes o = (HeartbeatRes) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(next, o.next) + && Internal.equals(timestamp, o.timestamp); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (next != null ? next.hashCode() : 0); + result = result * 37 + (timestamp != null ? timestamp.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Long next; + + public Long timestamp; + + public Builder() { + } + + /** + * 下一次心跳间隔,单位秒 + */ + public Builder next(Long next) { + this.next = next; + return this; + } + + /** + * 服务器的unix timestamp,单位毫秒,用于客户端校准时间 + */ + public Builder timestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + @Override + public HeartbeatRes build() { + return new HeartbeatRes(next, timestamp, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/Inner.java b/app/src/main/java/ikxd/cproxy/Inner.java new file mode 100644 index 00000000..81df5214 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/Inner.java @@ -0,0 +1,105 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import common.Header; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +/** + * cproxy内部使用 + */ +public final class Inner extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Inner.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Integer DEFAULT_URI = 0; + + @WireField( + tag = 1, + adapter = "common.Header#ADAPTER" + ) + public final Header header; + + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#INT32" + ) + public final Integer uri; + + public Inner(Header header, Integer uri) { + this(header, uri, ByteString.EMPTY); + } + + public Inner(Header header, Integer uri, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.header = header; + this.uri = uri; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.header = header; + builder.uri = uri; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof Inner)) return false; + Inner o = (Inner) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(header, o.header) + && Internal.equals(uri, o.uri); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (header != null ? header.hashCode() : 0); + result = result * 37 + (uri != null ? uri.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Header header; + + public Integer uri; + + public Builder() { + } + + public Builder header(Header header) { + this.header = header; + return this; + } + + public Builder uri(Integer uri) { + this.uri = uri; + return this; + } + + @Override + public Inner build() { + return new Inner(header, uri, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/InnerV2.java b/app/src/main/java/ikxd/cproxy/InnerV2.java new file mode 100644 index 00000000..d41ec546 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/InnerV2.java @@ -0,0 +1,130 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import common.Header; +import java.lang.Integer; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +/** + * cproxy新的解包方式 + */ +public final class InnerV2 extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(InnerV2.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Integer DEFAULT_URI = 0; + + public static final ByteString DEFAULT_PAYLOAD = ByteString.EMPTY; + + @WireField( + tag = 1, + adapter = "common.Header#ADAPTER" + ) + public final Header header; + + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#INT32" + ) + public final Integer uri; + + /** + * 业务包承载 + */ + @WireField( + tag = 3, + adapter = "com.squareup.wire.ProtoAdapter#BYTES" + ) + public final ByteString payload; + + public InnerV2(Header header, Integer uri, ByteString payload) { + this(header, uri, payload, ByteString.EMPTY); + } + + public InnerV2(Header header, Integer uri, ByteString payload, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.header = header; + this.uri = uri; + this.payload = payload; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.header = header; + builder.uri = uri; + builder.payload = payload; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof InnerV2)) return false; + InnerV2 o = (InnerV2) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(header, o.header) + && Internal.equals(uri, o.uri) + && Internal.equals(payload, o.payload); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (header != null ? header.hashCode() : 0); + result = result * 37 + (uri != null ? uri.hashCode() : 0); + result = result * 37 + (payload != null ? payload.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Header header; + + public Integer uri; + + public ByteString payload; + + public Builder() { + } + + public Builder header(Header header) { + this.header = header; + return this; + } + + public Builder uri(Integer uri) { + this.uri = uri; + return this; + } + + /** + * 业务包承载 + */ + public Builder payload(ByteString payload) { + this.payload = payload; + return this; + } + + @Override + public InnerV2 build() { + return new InnerV2(header, uri, payload, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/JoinRoomReq.java b/app/src/main/java/ikxd/cproxy/JoinRoomReq.java new file mode 100644 index 00000000..908ca38b --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/JoinRoomReq.java @@ -0,0 +1,84 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class JoinRoomReq extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(JoinRoomReq.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_ROOM_ID = ""; + + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String room_id; + + public JoinRoomReq(String room_id) { + this(room_id, ByteString.EMPTY); + } + + public JoinRoomReq(String room_id, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.room_id = room_id; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.room_id = room_id; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof JoinRoomReq)) return false; + JoinRoomReq o = (JoinRoomReq) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(room_id, o.room_id); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (room_id != null ? room_id.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String room_id; + + public Builder() { + } + + public Builder room_id(String room_id) { + this.room_id = room_id; + return this; + } + + @Override + public JoinRoomReq build() { + return new JoinRoomReq(room_id, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/JoinRoomRes.java b/app/src/main/java/ikxd/cproxy/JoinRoomRes.java new file mode 100644 index 00000000..1a6a712e --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/JoinRoomRes.java @@ -0,0 +1,84 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class JoinRoomRes extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(JoinRoomRes.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_ROOM_ID = ""; + + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String room_id; + + public JoinRoomRes(String room_id) { + this(room_id, ByteString.EMPTY); + } + + public JoinRoomRes(String room_id, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.room_id = room_id; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.room_id = room_id; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof JoinRoomRes)) return false; + JoinRoomRes o = (JoinRoomRes) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(room_id, o.room_id); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (room_id != null ? room_id.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String room_id; + + public Builder() { + } + + public Builder room_id(String room_id) { + this.room_id = room_id; + return this; + } + + @Override + public JoinRoomRes build() { + return new JoinRoomRes(room_id, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/LeaveRoomReq.java b/app/src/main/java/ikxd/cproxy/LeaveRoomReq.java new file mode 100644 index 00000000..e2839cfd --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/LeaveRoomReq.java @@ -0,0 +1,84 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class LeaveRoomReq extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(LeaveRoomReq.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_ROOM_ID = ""; + + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String room_id; + + public LeaveRoomReq(String room_id) { + this(room_id, ByteString.EMPTY); + } + + public LeaveRoomReq(String room_id, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.room_id = room_id; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.room_id = room_id; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof LeaveRoomReq)) return false; + LeaveRoomReq o = (LeaveRoomReq) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(room_id, o.room_id); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (room_id != null ? room_id.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String room_id; + + public Builder() { + } + + public Builder room_id(String room_id) { + this.room_id = room_id; + return this; + } + + @Override + public LeaveRoomReq build() { + return new LeaveRoomReq(room_id, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/LeaveRoomRes.java b/app/src/main/java/ikxd/cproxy/LeaveRoomRes.java new file mode 100644 index 00000000..daed9004 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/LeaveRoomRes.java @@ -0,0 +1,84 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class LeaveRoomRes extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(LeaveRoomRes.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_ROOM_ID = ""; + + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String room_id; + + public LeaveRoomRes(String room_id) { + this(room_id, ByteString.EMPTY); + } + + public LeaveRoomRes(String room_id, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.room_id = room_id; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.room_id = room_id; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof LeaveRoomRes)) return false; + LeaveRoomRes o = (LeaveRoomRes) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(room_id, o.room_id); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (room_id != null ? room_id.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String room_id; + + public Builder() { + } + + public Builder room_id(String room_id) { + this.room_id = room_id; + return this; + } + + @Override + public LeaveRoomRes build() { + return new LeaveRoomRes(room_id, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/ProbeNotify.java b/app/src/main/java/ikxd/cproxy/ProbeNotify.java new file mode 100644 index 00000000..60eca689 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/ProbeNotify.java @@ -0,0 +1,90 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Long; +import java.lang.Object; +import java.lang.Override; +import okio.ByteString; + +public final class ProbeNotify extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(ProbeNotify.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final Long DEFAULT_TS = 0L; + + /** + * nano seconds + */ + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#INT64" + ) + public final Long ts; + + public ProbeNotify(Long ts) { + this(ts, ByteString.EMPTY); + } + + public ProbeNotify(Long ts, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.ts = ts; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.ts = ts; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof ProbeNotify)) return false; + ProbeNotify o = (ProbeNotify) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(ts, o.ts); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (ts != null ? ts.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public Long ts; + + public Builder() { + } + + /** + * nano seconds + */ + public Builder ts(Long ts) { + this.ts = ts; + return this; + } + + @Override + public ProbeNotify build() { + return new ProbeNotify(ts, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/ToastNotify.java b/app/src/main/java/ikxd/cproxy/ToastNotify.java new file mode 100644 index 00000000..c4ee6f58 --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/ToastNotify.java @@ -0,0 +1,110 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import android.os.Parcelable; +import com.squareup.wire.AndroidMessage; +import com.squareup.wire.Message; +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireField; +import com.squareup.wire.internal.Internal; +import java.lang.Boolean; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import okio.ByteString; + +public final class ToastNotify extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(ToastNotify.class); + + public static final Creator CREATOR = AndroidMessage.newCreator(ADAPTER); + + private static final long serialVersionUID = 0L; + + public static final String DEFAULT_MSG = ""; + + public static final Boolean DEFAULT_LOGOUT = false; + + @WireField( + tag = 1, + adapter = "com.squareup.wire.ProtoAdapter#STRING" + ) + public final String msg; + + /** + * 是否需要客户端退出登陆并删除token,用于踢人 + */ + @WireField( + tag = 2, + adapter = "com.squareup.wire.ProtoAdapter#BOOL" + ) + public final Boolean logout; + + public ToastNotify(String msg, Boolean logout) { + this(msg, logout, ByteString.EMPTY); + } + + public ToastNotify(String msg, Boolean logout, ByteString unknownFields) { + super(ADAPTER, unknownFields); + this.msg = msg; + this.logout = logout; + } + + @Override + public Builder newBuilder() { + Builder builder = new Builder(); + builder.msg = msg; + builder.logout = logout; + builder.addUnknownFields(unknownFields()); + return builder; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof ToastNotify)) return false; + ToastNotify o = (ToastNotify) other; + return unknownFields().equals(o.unknownFields()) + && Internal.equals(msg, o.msg) + && Internal.equals(logout, o.logout); + } + + @Override + public int hashCode() { + int result = super.hashCode; + if (result == 0) { + result = unknownFields().hashCode(); + result = result * 37 + (msg != null ? msg.hashCode() : 0); + result = result * 37 + (logout != null ? logout.hashCode() : 0); + super.hashCode = result; + } + return result; + } + + public static final class Builder extends Message.Builder { + public String msg; + + public Boolean logout; + + public Builder() { + } + + public Builder msg(String msg) { + this.msg = msg; + return this; + } + + /** + * 是否需要客户端退出登陆并删除token,用于踢人 + */ + public Builder logout(Boolean logout) { + this.logout = logout; + return this; + } + + @Override + public ToastNotify build() { + return new ToastNotify(msg, logout, super.buildUnknownFields()); + } + } +} diff --git a/app/src/main/java/ikxd/cproxy/Uri.java b/app/src/main/java/ikxd/cproxy/Uri.java new file mode 100644 index 00000000..8bc652ac --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/Uri.java @@ -0,0 +1,64 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +public enum Uri implements WireEnum { + kUriNone(0), + + kUriToastNotify(11), + + kUriJoinRoomReq(12), + + kUriJoinRoomRes(13), + + kUriLeaveRoomReq(14), + + kUriLeaveRoomRes(15), + + /** + * 由于不同的websocket库不同,有些不支持心跳,因此心跳单独出来 + */ + kUriHeartbeatReq(16), + + kUriHeartbeatRes(17), + + /** + * 探针,原样返回 + */ + kUriProbeNotify(18); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(Uri.class); + + private final int value; + + Uri(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static Uri fromValue(int value) { + switch (value) { + case 0: return kUriNone; + case 11: return kUriToastNotify; + case 12: return kUriJoinRoomReq; + case 13: return kUriJoinRoomRes; + case 14: return kUriLeaveRoomReq; + case 15: return kUriLeaveRoomRes; + case 16: return kUriHeartbeatReq; + case 17: return kUriHeartbeatRes; + case 18: return kUriProbeNotify; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/java/ikxd/cproxy/WsCode.java b/app/src/main/java/ikxd/cproxy/WsCode.java new file mode 100644 index 00000000..4ddc16ee --- /dev/null +++ b/app/src/main/java/ikxd/cproxy/WsCode.java @@ -0,0 +1,68 @@ +// Code generated by Wire protocol buffer compiler, do not edit. +// Source file: cproxy.proto +package ikxd.cproxy; + +import com.squareup.wire.ProtoAdapter; +import com.squareup.wire.WireEnum; +import java.lang.Override; + +/** + * websocket 自定义code约定,代码可以不用 + */ +public enum WsCode implements WireEnum { + kWsCodeNone(0), + + /** + * 以下4000-4100 的错误码下,客户端不要重连 + * 同样的uid在不同设备上发起新连接,则断掉旧连接 + */ + kWsCloseKickOff(4000), + + /** + * 同样的uid在相同的设备上发起新连接,则断掉就连接 + */ + kWsCloseDisconnect(4001), + + /** + * 账号/设备被封禁 + */ + kWsCloseBanned(4002), + + /** + * version not supported any more + */ + kWsCloseVersionNS(4003), + + /** + * token非法 + */ + kWsCloseTokenInvalid(4101); + + public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(WsCode.class); + + private final int value; + + WsCode(int value) { + this.value = value; + } + + /** + * Return the constant for {@code value} or null. + */ + public static WsCode fromValue(int value) { + switch (value) { + case 0: return kWsCodeNone; + case 4000: return kWsCloseKickOff; + case 4001: return kWsCloseDisconnect; + case 4002: return kWsCloseBanned; + case 4003: return kWsCloseVersionNS; + case 4101: return kWsCloseTokenInvalid; + default: return null; + } + } + + @Override + public int getValue() { + return value; + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f71c17d2..ac79acdf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - SVGAPlayer + D-SVGAPlayer Hello world! Settings diff --git a/gradle.properties b/gradle.properties index 1d3591c8..5623b6d8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true + +version=0.1.2 \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index 793d0c5d..66d81bc4 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -29,8 +29,11 @@ android { } dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.squareup.wire:wire-runtime:2.3.0-RC1' +// api fileTree(include: ['*.jar'], dir: 'libs') + compileOnly fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.squareup.okio:okio:2.4.2' + +// implementation 'com.squareup.wire:wire-runtime:3.0.2' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } repositories { diff --git a/library/libs/wire-runtime-jvm-3.1.0-SNAPSHOT.jar b/library/libs/wire-runtime-jvm-3.1.0-SNAPSHOT.jar new file mode 100644 index 00000000..03527d00 Binary files /dev/null and b/library/libs/wire-runtime-jvm-3.1.0-SNAPSHOT.jar differ diff --git a/library/proto/svga.proto b/library/proto/svga.proto new file mode 100644 index 00000000..bfc3aa65 --- /dev/null +++ b/library/proto/svga.proto @@ -0,0 +1,131 @@ +syntax = "proto3"; +package com.opensource.svga; +option objc_class_prefix = "SVGAProto"; +option java_package = "com.opensource.svgaplayer.proto"; + +message MovieParams { + float viewBoxWidth = 1; // 画布宽 + float viewBoxHeight = 2; // 画布高 + int32 fps = 3; // 动画每秒播放帧数,合法值是 [1, 2, 3, 5, 6, 10, 12, 15, 20, 30, 60] 中的任意一个。 + int32 frames = 4; // 动画总帧数 +} + +message SpriteEntity { + string imageKey = 1; // 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。 + repeated FrameEntity frames = 2; // 帧列表 + string matteKey = 3; // 被遮罩图层的 matteKey 对应的是其遮罩图层的 imageKey. +} + +message AudioEntity { + string audioKey = 1; // 音频文件名 + int32 startFrame = 2; // 音频播放起始帧 + int32 endFrame = 3; // 音频播放结束帧 + int32 startTime = 4; // 音频播放起始时间(相对音频长度) + int32 totalTime = 5; // 音频总长度 +} + +message Layout { + float x = 1; + float y = 2; + float width = 3; + float height = 4; +} + +message Transform { + float a = 1; + float b = 2; + float c = 3; + float d = 4; + float tx = 5; + float ty = 6; +} + +message ShapeEntity { + + enum ShapeType { + SHAPE = 0; // 路径 + RECT = 1; // 矩形 + ELLIPSE = 2; // 圆形 + KEEP = 3; // 与前帧一致 + } + + message ShapeArgs { + string d = 1; // SVG 路径 + } + + message RectArgs { + float x = 1; + float y = 2; + float width = 3; + float height = 4; + float cornerRadius = 5; // 圆角半径 + } + + message EllipseArgs { + float x = 1; // 圆中心点 X + float y = 2; // 圆中心点 Y + float radiusX = 3; // 横向半径 + float radiusY = 4; // 纵向半径 + } + + message ShapeStyle { + + message RGBAColor { + float r = 1; + float g = 2; + float b = 3; + float a = 4; + } + + enum LineCap { + LineCap_BUTT = 0; + LineCap_ROUND = 1; + LineCap_SQUARE = 2; + } + + enum LineJoin { + LineJoin_MITER = 0; + LineJoin_ROUND = 1; + LineJoin_BEVEL = 2; + } + + RGBAColor fill = 1; // 填充色 + RGBAColor stroke = 2; // 描边色 + float strokeWidth = 3; // 描边宽 + LineCap lineCap = 4; // 线段端点样式 + LineJoin lineJoin = 5; // 线段连接样式 + float miterLimit = 6; // 尖角限制 + float lineDashI = 7; // 虚线参数 Dash + float lineDashII = 8; // 虚线参数 Gap + float lineDashIII = 9; // 虚线参数 Offset + + } + + ShapeType type = 1; // 矢量类型 + oneof args { + ShapeArgs shape = 2; + RectArgs rect = 3; + EllipseArgs ellipse = 4; + } // 矢量参数 + ShapeStyle styles = 10; // 渲染参数 + Transform transform = 11; // 矢量图层 2D 变换矩阵 + +} + +message FrameEntity { + float alpha = 1; // 透明度 + Layout layout = 2; // 初始约束大小 + Transform transform = 3; // 2D 变换矩阵 + string clipPath = 4; // 遮罩路径,使用 SVG 标准 Path 绘制图案进行 Mask 遮罩。 + repeated ShapeEntity shapes = 5; // 矢量元素列表 +} + +message MovieEntity { + + string version = 1; // SVGA 格式版本号 + MovieParams params = 2; // 动画参数 + map images = 3; // Key 是位图键名,Value 是位图文件名或二进制 PNG 数据。 + repeated SpriteEntity sprites = 4; // 元素列表 + repeated AudioEntity audios = 5; // 音频列表 + +} diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGADynamicEntity.kt b/library/src/main/java/com/opensource/svgaplayer/SVGADynamicEntity.kt index 4b5ac5e4..bf7b4a45 100644 --- a/library/src/main/java/com/opensource/svgaplayer/SVGADynamicEntity.kt +++ b/library/src/main/java/com/opensource/svgaplayer/SVGADynamicEntity.kt @@ -50,7 +50,7 @@ class SVGADynamicEntity { fun setDynamicImage(url: String, forKey: String) { val handler = android.os.Handler() - SVGAParser.threadPoolExecutor.execute { + SVGAExecutorService.executorTask(Runnable { (URL(url).openConnection() as? HttpURLConnection)?.let { try { it.connectTimeout = 20 * 1000 @@ -71,7 +71,10 @@ class SVGADynamicEntity { } } } - } + }) +// SVGAParser.threadPoolExecutor.execute { +// +// } } fun setDynamicText(text: String, textPaint: TextPaint, forKey: String) { diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGAExecutorService.kt b/library/src/main/java/com/opensource/svgaplayer/SVGAExecutorService.kt new file mode 100644 index 00000000..e69b4fb8 --- /dev/null +++ b/library/src/main/java/com/opensource/svgaplayer/SVGAExecutorService.kt @@ -0,0 +1,29 @@ +package com.opensource.svgaplayer + +import java.util.concurrent.Executor + +/** + * Created by huangzhilong on 2019-07-23. + * 设置线程池,没设置则new thread(原来逻辑) + */ + +class SVGAExecutorService { + + companion object { + + private var mExecutorService: Executor? = null + + fun setExecutorService(executorService: Executor?) { + mExecutorService = executorService + } + + fun executorTask(runnable: Runnable) { + if (mExecutorService != null) { + mExecutorService?.execute(runnable) + } else { + var thread = Thread(runnable) + thread.start() + } + } + } +} \ No newline at end of file diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt b/library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt index cca4c26d..7506c34d 100644 --- a/library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt +++ b/library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt @@ -4,7 +4,6 @@ import android.animation.Animator import android.animation.ValueAnimator import android.annotation.SuppressLint import android.content.Context -import android.graphics.drawable.Drawable import android.os.Build import android.util.AttributeSet import android.util.Log @@ -13,7 +12,6 @@ import android.view.View import android.view.animation.LinearInterpolator import android.widget.ImageView import com.opensource.svgaplayer.utils.SVGARange -import java.lang.ref.WeakReference import java.net.URL /** @@ -90,7 +88,7 @@ open class SVGAImageView : ImageView { } typedArray.getString(R.styleable.SVGAImageView_source)?.let { val parser = SVGAParser(context) - Thread { + SVGAExecutorService.executorTask(Runnable { val callback: SVGAParser.ParseCompletion = object : SVGAParser.ParseCompletion { override fun onComplete(videoItem: SVGAVideoEntity) { this@SVGAImageView.post { @@ -110,7 +108,10 @@ open class SVGAImageView : ImageView { } else { parser.parse(it, callback) } - }.start() + }) +// Thread { +// +// }.start() } typedArray.recycle() } @@ -247,7 +248,7 @@ open class SVGAImageView : ImageView { override fun onTouchEvent(event: MotionEvent?): Boolean { event?.let { if(event.action == MotionEvent.ACTION_DOWN){ - val drawable = drawable as? SVGADrawable ?: return false + val drawable = drawable as? SVGADrawable ?: return super.onTouchEvent(event) for((key,value) in drawable.dynamicItem.mClickMap){ if (event.x >= value[0] && event.x <= value[2] && event.y >= value[1] && event.y <= value[3]) { mItemClickAreaListener?.let { diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGAParser.kt b/library/src/main/java/com/opensource/svgaplayer/SVGAParser.kt index caef9192..ecedccfc 100644 --- a/library/src/main/java/com/opensource/svgaplayer/SVGAParser.kt +++ b/library/src/main/java/com/opensource/svgaplayer/SVGAParser.kt @@ -6,13 +6,17 @@ import android.os.Handler import android.util.Log import com.opensource.svgaplayer.proto.MovieEntity import org.json.JSONObject -import java.io.* +import java.io.BufferedInputStream +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.io.File +import java.io.FileInputStream +import java.io.FileOutputStream +import java.io.InputStream +import java.lang.IllegalStateException import java.net.HttpURLConnection import java.net.URL import java.security.MessageDigest -import java.util.concurrent.LinkedBlockingQueue -import java.util.concurrent.ThreadPoolExecutor -import java.util.concurrent.TimeUnit import java.util.zip.Inflater import java.util.zip.ZipInputStream @@ -28,23 +32,27 @@ class SVGAParser(private val context: Context) { fun onComplete(videoItem: SVGAVideoEntity) fun onError() - } open class FileDownloader { var noCache = false - open fun resume(url: URL, complete: (inputStream: InputStream) -> Unit, failure: (e: Exception) -> Unit): () -> Unit { + open fun resume( + url: URL, complete: (inputStream: InputStream) -> Unit, failure: (e: Exception) -> Unit + ): () -> Unit { var cancelled = false val cancelBlock = { cancelled = true } - threadPoolExecutor.execute { + + SVGAExecutorService.executorTask(Runnable { try { if (HttpResponseCache.getInstalled() == null && !noCache) { - Log.e("SVGAParser", "SVGAParser can not handle cache before install HttpResponseCache. see https://github.com/yyued/SVGAPlayer-Android#cache") - Log.e("SVGAParser", "在配置 HttpResponseCache 前 SVGAParser 无法缓存. 查看 https://github.com/yyued/SVGAPlayer-Android#cache ") + Log.e("SVGAParser", + "SVGAParser can not handle cache before install HttpResponseCache. see https://github.com/yyued/SVGAPlayer-Android#cache") + Log.e("SVGAParser", + "在配置 HttpResponseCache 前 SVGAParser 无法缓存. 查看 https://github.com/yyued/SVGAPlayer-Android#cache ") } (url.openConnection() as? HttpURLConnection)?.let { it.connectTimeout = 20 * 1000 @@ -65,7 +73,7 @@ class SVGAParser(private val context: Context) { outputStream.write(buffer, 0, count) } if (cancelled) { - return@execute + return@Runnable } ByteArrayInputStream(outputStream.toByteArray()).use { complete(it) @@ -77,41 +85,47 @@ class SVGAParser(private val context: Context) { e.printStackTrace() failure(e) } - } + }) +// threadPoolExecutor.execute { +// +// } return cancelBlock } - } var fileDownloader = FileDownloader() - companion object { - private val threadPoolBlockingQueue = LinkedBlockingQueue() - internal var threadPoolExecutor = ThreadPoolExecutor(3, 10, 60000, TimeUnit.MILLISECONDS, threadPoolBlockingQueue) - fun setThreadPoolExecutor(executor: ThreadPoolExecutor) { - threadPoolExecutor = executor - } - } +// companion object { +// private val threadPoolBlockingQueue = LinkedBlockingQueue() +// internal var threadPoolExecutor = +// ThreadPoolExecutor(3, 10, 60000, TimeUnit.MILLISECONDS, threadPoolBlockingQueue) +// +// fun setThreadPoolExecutor(executor: ThreadPoolExecutor) { +// threadPoolExecutor = executor +// } +// } fun decodeFromAssets(name: String, callback: ParseCompletion?) { try { context.assets.open(name)?.let { - this.decodeFromInputStream(it, buildCacheKey("file:///assets/$name"), callback, true) + this.decodeFromInputStream(it, buildCacheKey("file:///assets/$name"), callback, + true) } - } - catch (e: java.lang.Exception) { + } catch (e: java.lang.Exception) { this.invokeErrorCallback(e, callback) } } fun decodeFromURL(url: URL, callback: ParseCompletion?): (() -> Unit)? { if (this.isCached(buildCacheKey(url))) { - threadPoolExecutor.execute { + SVGAExecutorService.executorTask(Runnable { this.decodeFromCacheKey(buildCacheKey(url), callback) - } + }) +// threadPoolExecutor.execute { +// +// } return null - } - else { + } else { return fileDownloader.resume(url, { this.decodeFromInputStream(it, this.buildCacheKey(url), callback) }, { @@ -120,8 +134,11 @@ class SVGAParser(private val context: Context) { } } - fun decodeFromInputStream(inputStream: InputStream, cacheKey: String, callback: ParseCompletion?, closeInputStream: Boolean = false) { - threadPoolExecutor.execute { + fun decodeFromInputStream( + inputStream: InputStream, cacheKey: String, callback: ParseCompletion?, + closeInputStream: Boolean = false + ) { + SVGAExecutorService.executorTask(Runnable { try { readAsBytes(inputStream)?.let { bytes -> if (bytes.size > 4 && bytes[0].toInt() == 80 && bytes[1].toInt() == 75 && bytes[2].toInt() == 3 && bytes[3].toInt() == 4) { @@ -131,10 +148,10 @@ class SVGAParser(private val context: Context) { } } this.decodeFromCacheKey(cacheKey, callback) - } - else { + } else { inflate(bytes)?.let { - val videoItem = SVGAVideoEntity(MovieEntity.ADAPTER.decode(it), File(cacheKey)) + val videoItem = + SVGAVideoEntity(MovieEntity.ADAPTER.decode(it), File(cacheKey)) videoItem.prepare { this.invokeCompleteCallback(videoItem, callback) } @@ -148,13 +165,18 @@ class SVGAParser(private val context: Context) { inputStream.close() } } - } + }) + +// threadPoolExecutor.execute { +// +// } } /** * @deprecated from 2.4.0 */ - @Deprecated("This method has been deprecated from 2.4.0.", ReplaceWith("this.decodeFromAssets(assetsName, callback)")) + @Deprecated("This method has been deprecated from 2.4.0.", + ReplaceWith("this.decodeFromAssets(assetsName, callback)")) fun parse(assetsName: String, callback: ParseCompletion?) { this.decodeFromAssets(assetsName, callback) } @@ -162,7 +184,8 @@ class SVGAParser(private val context: Context) { /** * @deprecated from 2.4.0 */ - @Deprecated("This method has been deprecated from 2.4.0.", ReplaceWith("this.decodeFromURL(url, callback)")) + @Deprecated("This method has been deprecated from 2.4.0.", + ReplaceWith("this.decodeFromURL(url, callback)")) fun parse(url: URL, callback: ParseCompletion?) { this.decodeFromURL(url, callback) } @@ -170,8 +193,12 @@ class SVGAParser(private val context: Context) { /** * @deprecated from 2.4.0 */ - @Deprecated("This method has been deprecated from 2.4.0.", ReplaceWith("this.decodeFromInputStream(inputStream, cacheKey, callback, closeInputStream)")) - fun parse(inputStream: InputStream, cacheKey: String, callback: ParseCompletion?, closeInputStream: Boolean = false) { + @Deprecated("This method has been deprecated from 2.4.0.", ReplaceWith( + "this.decodeFromInputStream(inputStream, cacheKey, callback, closeInputStream)")) + fun parse( + inputStream: InputStream, cacheKey: String, callback: ParseCompletion?, + closeInputStream: Boolean = false + ) { this.decodeFromInputStream(inputStream, cacheKey, callback, closeInputStream) } @@ -195,44 +222,55 @@ class SVGAParser(private val context: Context) { private fun decodeFromCacheKey(cacheKey: String, callback: ParseCompletion?) { try { val cacheDir = File(context.cacheDir.absolutePath + "/" + cacheKey + "/") - File(cacheDir, "movie.binary").takeIf { it.isFile }?.let { binaryFile -> + val movieFile = File(cacheDir, "movie.binary") + if (movieFile.exists() && movieFile.isFile) { try { - FileInputStream(binaryFile).use { - this.invokeCompleteCallback(SVGAVideoEntity(MovieEntity.ADAPTER.decode(it), cacheDir), callback) + FileInputStream(movieFile).use { + this.invokeCompleteCallback( + SVGAVideoEntity(MovieEntity.ADAPTER.decode(it), cacheDir), callback) } } catch (e: Exception) { cacheDir.delete() - binaryFile.delete() - throw e + movieFile.delete() + decodeFromSpec(cacheDir, callback) } + } else { + decodeFromSpec(cacheDir, callback) } - File(cacheDir, "movie.spec").takeIf { it.isFile }?.let { jsonFile -> - try { - FileInputStream(jsonFile).use { fileInputStream -> - ByteArrayOutputStream().use { byteArrayOutputStream -> - val buffer = ByteArray(2048) - while (true) { - val size = fileInputStream.read(buffer, 0, buffer.size) - if (size == -1) { - break - } - byteArrayOutputStream.write(buffer, 0, size) + } catch (e: Exception) { + this.invokeErrorCallback(e, callback) + } + } + + private fun decodeFromSpec(cacheDir: File, callback: ParseCompletion?) { + val movieFile = File(cacheDir, "movie.spec") + if (movieFile.exists() && movieFile.isFile) { + try { + FileInputStream(movieFile).use { fileInputStream -> + ByteArrayOutputStream().use { byteArrayOutputStream -> + val buffer = ByteArray(2048) + while (true) { + val size = fileInputStream.read(buffer, 0, buffer.size) + if (size == -1) { + break } - byteArrayOutputStream.toString().let { - JSONObject(it).let { - this.invokeCompleteCallback(SVGAVideoEntity(it, cacheDir), callback) - } + byteArrayOutputStream.write(buffer, 0, size) + } + byteArrayOutputStream.toString().let { + JSONObject(it).let { + this.invokeCompleteCallback(SVGAVideoEntity(it, cacheDir), + callback) } } } - } catch (e: Exception) { - cacheDir.delete() - jsonFile.delete() - throw e } + } catch (e: Exception) { + cacheDir.delete() + movieFile.delete() + throw e } - } catch (e: Exception) { - this.invokeErrorCallback(e, callback) + } else { + throw IllegalStateException("movie.spec and movie.spec is all empty") } } @@ -249,7 +287,8 @@ class SVGAParser(private val context: Context) { private fun buildCacheKey(url: URL): String = buildCacheKey(url.toString()) - private fun buildCacheDir(cacheKey: String): File = File(context.cacheDir.absolutePath + "/" + cacheKey + "/") + private fun buildCacheDir(cacheKey: String): File = + File(context.cacheDir.absolutePath + "/" + cacheKey + "/") private fun readAsBytes(inputStream: InputStream): ByteArray? { ByteArrayOutputStream().use { byteArrayOutputStream -> @@ -258,8 +297,7 @@ class SVGAParser(private val context: Context) { val count = inputStream.read(byteArray, 0, 2048) if (count <= 0) { break - } - else { + } else { byteArrayOutputStream.write(byteArray, 0, count) } } @@ -276,8 +314,7 @@ class SVGAParser(private val context: Context) { val count = inflater.inflate(inflatedBytes, 0, 2048) if (count <= 0) { break - } - else { + } else { inflatedOutputStream.write(inflatedBytes, 0, count) } } diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt b/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt index 542c05c6..9f236299 100644 --- a/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt +++ b/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt @@ -209,6 +209,9 @@ class SVGAVideoEntity { fos.close() audiosFile[it.key] = tmpFile } + } else { + completionBlock() + return@let } this.audios = audios.map { audio -> val item = SVGAAudioEntity(audio) diff --git a/library/src/main/java/com/opensource/svgaplayer/entities/SVGAVideoShapeEntity.kt b/library/src/main/java/com/opensource/svgaplayer/entities/SVGAVideoShapeEntity.kt index bfce0506..1e0c82a2 100644 --- a/library/src/main/java/com/opensource/svgaplayer/entities/SVGAVideoShapeEntity.kt +++ b/library/src/main/java/com/opensource/svgaplayer/entities/SVGAVideoShapeEntity.kt @@ -97,6 +97,7 @@ internal class SVGAVideoShapeEntity { ShapeEntity.ShapeType.RECT -> Type.rect ShapeEntity.ShapeType.ELLIPSE -> Type.ellipse ShapeEntity.ShapeType.KEEP -> Type.keep + else -> Type.shape } } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/AudioEntity.java b/library/src/main/java/com/opensource/svgaplayer/proto/AudioEntity.java index d09adce9..1d4f0fb2 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/AudioEntity.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/AudioEntity.java @@ -1,24 +1,22 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 19:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Integer; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import okio.ByteString; -public final class AudioEntity extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_AudioEntity(); +public final class AudioEntity extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter( + AudioEntity.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -37,7 +35,8 @@ public final class AudioEntity extends Message */ @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#STRING" + adapter = "com.squareup.wire.ProtoAdapter#STRING", + returnDefaultValue = false ) public final String audioKey; @@ -46,7 +45,8 @@ public final class AudioEntity extends Message */ @WireField( tag = 2, - adapter = "com.squareup.wire.ProtoAdapter#INT32" + adapter = "com.squareup.wire.ProtoAdapter#INT32", + returnDefaultValue = false ) public final Integer startFrame; @@ -55,7 +55,8 @@ public final class AudioEntity extends Message */ @WireField( tag = 3, - adapter = "com.squareup.wire.ProtoAdapter#INT32" + adapter = "com.squareup.wire.ProtoAdapter#INT32", + returnDefaultValue = false ) public final Integer endFrame; @@ -64,7 +65,8 @@ public final class AudioEntity extends Message */ @WireField( tag = 4, - adapter = "com.squareup.wire.ProtoAdapter#INT32" + adapter = "com.squareup.wire.ProtoAdapter#INT32", + returnDefaultValue = false ) public final Integer startTime; @@ -73,15 +75,20 @@ public final class AudioEntity extends Message */ @WireField( tag = 5, - adapter = "com.squareup.wire.ProtoAdapter#INT32" + adapter = "com.squareup.wire.ProtoAdapter#INT32", + returnDefaultValue = false ) public final Integer totalTime; - public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Integer startTime, Integer totalTime) { + private boolean __isDefaultInstance; + + public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Integer startTime, + Integer totalTime) { this(audioKey, startFrame, endFrame, startTime, totalTime, ByteString.EMPTY); } - public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Integer startTime, Integer totalTime, ByteString unknownFields) { + public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Integer startTime, + Integer totalTime, ByteString unknownFields) { super(ADAPTER, unknownFields); this.audioKey = audioKey; this.startFrame = startFrame; @@ -90,6 +97,13 @@ public AudioEntity(String audioKey, Integer startFrame, Integer endFrame, Intege this.totalTime = totalTime; } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); @@ -130,27 +144,16 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (audioKey != null) builder.append(", audioKey=").append(audioKey); - if (startFrame != null) builder.append(", startFrame=").append(startFrame); - if (endFrame != null) builder.append(", endFrame=").append(endFrame); - if (startTime != null) builder.append(", startTime=").append(startTime); - if (totalTime != null) builder.append(", totalTime=").append(totalTime); - return builder.replace(0, 2, "AudioEntity{").append('}').toString(); - } - public static final class Builder extends Message.Builder { public String audioKey; - public Integer startFrame; + public int startFrame; - public Integer endFrame; + public int endFrame; - public Integer startTime; + public int startTime; - public Integer totalTime; + public int totalTime; public Builder() { } @@ -200,59 +203,4 @@ public AudioEntity build() { return new AudioEntity(audioKey, startFrame, endFrame, startTime, totalTime, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_AudioEntity extends ProtoAdapter { - ProtoAdapter_AudioEntity() { - super(FieldEncoding.LENGTH_DELIMITED, AudioEntity.class); - } - - @Override - public int encodedSize(AudioEntity value) { - return (value.audioKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.audioKey) : 0) - + (value.startFrame != null ? ProtoAdapter.INT32.encodedSizeWithTag(2, value.startFrame) : 0) - + (value.endFrame != null ? ProtoAdapter.INT32.encodedSizeWithTag(3, value.endFrame) : 0) - + (value.startTime != null ? ProtoAdapter.INT32.encodedSizeWithTag(4, value.startTime) : 0) - + (value.totalTime != null ? ProtoAdapter.INT32.encodedSizeWithTag(5, value.totalTime) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, AudioEntity value) throws IOException { - if (value.audioKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.audioKey); - if (value.startFrame != null) ProtoAdapter.INT32.encodeWithTag(writer, 2, value.startFrame); - if (value.endFrame != null) ProtoAdapter.INT32.encodeWithTag(writer, 3, value.endFrame); - if (value.startTime != null) ProtoAdapter.INT32.encodeWithTag(writer, 4, value.startTime); - if (value.totalTime != null) ProtoAdapter.INT32.encodeWithTag(writer, 5, value.totalTime); - writer.writeBytes(value.unknownFields()); - } - - @Override - public AudioEntity decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.audioKey(ProtoAdapter.STRING.decode(reader)); break; - case 2: builder.startFrame(ProtoAdapter.INT32.decode(reader)); break; - case 3: builder.endFrame(ProtoAdapter.INT32.decode(reader)); break; - case 4: builder.startTime(ProtoAdapter.INT32.decode(reader)); break; - case 5: builder.totalTime(ProtoAdapter.INT32.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public AudioEntity redact(AudioEntity value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/FrameEntity.java b/library/src/main/java/com/opensource/svgaplayer/proto/FrameEntity.java index ac701bb4..e4475f83 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/FrameEntity.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/FrameEntity.java @@ -1,25 +1,24 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 115:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Float; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import java.util.List; + import okio.ByteString; -public final class FrameEntity extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_FrameEntity(); +public final class FrameEntity extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter( + FrameEntity.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -32,7 +31,8 @@ public final class FrameEntity extends Message */ @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float alpha; @@ -41,7 +41,8 @@ public final class FrameEntity extends Message */ @WireField( tag = 2, - adapter = "com.opensource.svgaplayer.proto.Layout#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.Layout#ADAPTER", + returnDefaultValue = false ) public final Layout layout; @@ -50,7 +51,8 @@ public final class FrameEntity extends Message */ @WireField( tag = 3, - adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER", + returnDefaultValue = false ) public final Transform transform; @@ -59,7 +61,8 @@ public final class FrameEntity extends Message */ @WireField( tag = 4, - adapter = "com.squareup.wire.ProtoAdapter#STRING" + adapter = "com.squareup.wire.ProtoAdapter#STRING", + returnDefaultValue = false ) public final String clipPath; @@ -69,15 +72,20 @@ public final class FrameEntity extends Message @WireField( tag = 5, adapter = "com.opensource.svgaplayer.proto.ShapeEntity#ADAPTER", - label = WireField.Label.REPEATED + label = WireField.Label.REPEATED, + returnDefaultValue = false ) public final List shapes; - public FrameEntity(Float alpha, Layout layout, Transform transform, String clipPath, List shapes) { + private boolean __isDefaultInstance; + + public FrameEntity(Float alpha, Layout layout, Transform transform, String clipPath, + List shapes) { this(alpha, layout, transform, clipPath, shapes, ByteString.EMPTY); } - public FrameEntity(Float alpha, Layout layout, Transform transform, String clipPath, List shapes, ByteString unknownFields) { + public FrameEntity(Float alpha, Layout layout, Transform transform, String clipPath, + List shapes, ByteString unknownFields) { super(ADAPTER, unknownFields); this.alpha = alpha; this.layout = layout; @@ -86,6 +94,13 @@ public FrameEntity(Float alpha, Layout layout, Transform transform, String clipP this.shapes = Internal.immutableCopyOf("shapes", shapes); } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); @@ -93,7 +108,7 @@ public Builder newBuilder() { builder.layout = layout; builder.transform = transform; builder.clipPath = clipPath; - builder.shapes = Internal.copyOf("shapes", shapes); + builder.shapes = Internal.copyOf(shapes); builder.addUnknownFields(unknownFields()); return builder; } @@ -126,19 +141,8 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (alpha != null) builder.append(", alpha=").append(alpha); - if (layout != null) builder.append(", layout=").append(layout); - if (transform != null) builder.append(", transform=").append(transform); - if (clipPath != null) builder.append(", clipPath=").append(clipPath); - if (!shapes.isEmpty()) builder.append(", shapes=").append(shapes); - return builder.replace(0, 2, "FrameEntity{").append('}').toString(); - } - public static final class Builder extends Message.Builder { - public Float alpha; + public float alpha; public Layout layout; @@ -198,62 +202,4 @@ public FrameEntity build() { return new FrameEntity(alpha, layout, transform, clipPath, shapes, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_FrameEntity extends ProtoAdapter { - ProtoAdapter_FrameEntity() { - super(FieldEncoding.LENGTH_DELIMITED, FrameEntity.class); - } - - @Override - public int encodedSize(FrameEntity value) { - return (value.alpha != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.alpha) : 0) - + (value.layout != null ? Layout.ADAPTER.encodedSizeWithTag(2, value.layout) : 0) - + (value.transform != null ? Transform.ADAPTER.encodedSizeWithTag(3, value.transform) : 0) - + (value.clipPath != null ? ProtoAdapter.STRING.encodedSizeWithTag(4, value.clipPath) : 0) - + ShapeEntity.ADAPTER.asRepeated().encodedSizeWithTag(5, value.shapes) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, FrameEntity value) throws IOException { - if (value.alpha != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.alpha); - if (value.layout != null) Layout.ADAPTER.encodeWithTag(writer, 2, value.layout); - if (value.transform != null) Transform.ADAPTER.encodeWithTag(writer, 3, value.transform); - if (value.clipPath != null) ProtoAdapter.STRING.encodeWithTag(writer, 4, value.clipPath); - ShapeEntity.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.shapes); - writer.writeBytes(value.unknownFields()); - } - - @Override - public FrameEntity decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.alpha(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.layout(Layout.ADAPTER.decode(reader)); break; - case 3: builder.transform(Transform.ADAPTER.decode(reader)); break; - case 4: builder.clipPath(ProtoAdapter.STRING.decode(reader)); break; - case 5: builder.shapes.add(ShapeEntity.ADAPTER.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public FrameEntity redact(FrameEntity value) { - Builder builder = value.newBuilder(); - if (builder.layout != null) builder.layout = Layout.ADAPTER.redact(builder.layout); - if (builder.transform != null) builder.transform = Transform.ADAPTER.redact(builder.transform); - Internal.redactElements(builder.shapes, ShapeEntity.ADAPTER); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/Layout.java b/library/src/main/java/com/opensource/svgaplayer/proto/Layout.java index 6ea7edb6..11b8c4eb 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/Layout.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/Layout.java @@ -1,24 +1,21 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 27:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Float; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import okio.ByteString; -public final class Layout extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_Layout(); +public final class Layout extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Layout.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -32,28 +29,34 @@ public final class Layout extends Message { @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float x; @WireField( tag = 2, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float y; @WireField( tag = 3, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float width; @WireField( tag = 4, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float height; + private boolean __isDefaultInstance; + public Layout(Float x, Float y, Float width, Float height) { this(x, y, width, height, ByteString.EMPTY); } @@ -66,6 +69,13 @@ public Layout(Float x, Float y, Float width, Float height, ByteString unknownFie this.height = height; } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); @@ -103,24 +113,14 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (x != null) builder.append(", x=").append(x); - if (y != null) builder.append(", y=").append(y); - if (width != null) builder.append(", width=").append(width); - if (height != null) builder.append(", height=").append(height); - return builder.replace(0, 2, "Layout{").append('}').toString(); - } - public static final class Builder extends Message.Builder { - public Float x; + public float x; - public Float y; + public float y; - public Float width; + public float width; - public Float height; + public float height; public Builder() { } @@ -150,56 +150,4 @@ public Layout build() { return new Layout(x, y, width, height, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_Layout extends ProtoAdapter { - ProtoAdapter_Layout() { - super(FieldEncoding.LENGTH_DELIMITED, Layout.class); - } - - @Override - public int encodedSize(Layout value) { - return (value.x != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x) : 0) - + (value.y != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y) : 0) - + (value.width != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.width) : 0) - + (value.height != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.height) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, Layout value) throws IOException { - if (value.x != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x); - if (value.y != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y); - if (value.width != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width); - if (value.height != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height); - writer.writeBytes(value.unknownFields()); - } - - @Override - public Layout decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.x(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.y(ProtoAdapter.FLOAT.decode(reader)); break; - case 3: builder.width(ProtoAdapter.FLOAT.decode(reader)); break; - case 4: builder.height(ProtoAdapter.FLOAT.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public Layout redact(Layout value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/MovieEntity.java b/library/src/main/java/com/opensource/svgaplayer/proto/MovieEntity.java index 6b720af4..f8c07ebd 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/MovieEntity.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/MovieEntity.java @@ -1,25 +1,25 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 123:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import java.util.List; import java.util.Map; + import okio.ByteString; -public final class MovieEntity extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_MovieEntity(); +public final class MovieEntity extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter( + MovieEntity.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -30,7 +30,8 @@ public final class MovieEntity extends Message */ @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#STRING" + adapter = "com.squareup.wire.ProtoAdapter#STRING", + returnDefaultValue = false ) public final String version; @@ -39,7 +40,8 @@ public final class MovieEntity extends Message */ @WireField( tag = 2, - adapter = "com.opensource.svgaplayer.proto.MovieParams#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.MovieParams#ADAPTER", + returnDefaultValue = false ) public final MovieParams params; @@ -49,7 +51,8 @@ public final class MovieEntity extends Message @WireField( tag = 3, keyAdapter = "com.squareup.wire.ProtoAdapter#STRING", - adapter = "com.squareup.wire.ProtoAdapter#BYTES" + adapter = "com.squareup.wire.ProtoAdapter#BYTES", + returnDefaultValue = false ) public final Map images; @@ -59,7 +62,8 @@ public final class MovieEntity extends Message @WireField( tag = 4, adapter = "com.opensource.svgaplayer.proto.SpriteEntity#ADAPTER", - label = WireField.Label.REPEATED + label = WireField.Label.REPEATED, + returnDefaultValue = false ) public final List sprites; @@ -69,15 +73,20 @@ public final class MovieEntity extends Message @WireField( tag = 5, adapter = "com.opensource.svgaplayer.proto.AudioEntity#ADAPTER", - label = WireField.Label.REPEATED + label = WireField.Label.REPEATED, + returnDefaultValue = false ) public final List audios; - public MovieEntity(String version, MovieParams params, Map images, List sprites, List audios) { + private boolean __isDefaultInstance; + + public MovieEntity(String version, MovieParams params, Map images, + List sprites, List audios) { this(version, params, images, sprites, audios, ByteString.EMPTY); } - public MovieEntity(String version, MovieParams params, Map images, List sprites, List audios, ByteString unknownFields) { + public MovieEntity(String version, MovieParams params, Map images, + List sprites, List audios, ByteString unknownFields) { super(ADAPTER, unknownFields); this.version = version; this.params = params; @@ -86,14 +95,21 @@ public MovieEntity(String version, MovieParams params, Map i this.audios = Internal.immutableCopyOf("audios", audios); } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); builder.version = version; builder.params = params; - builder.images = Internal.copyOf("images", images); - builder.sprites = Internal.copyOf("sprites", sprites); - builder.audios = Internal.copyOf("audios", audios); + builder.images = Internal.copyOf(images); + builder.sprites = Internal.copyOf(sprites); + builder.audios = Internal.copyOf(audios); builder.addUnknownFields(unknownFields()); return builder; } @@ -126,17 +142,6 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (version != null) builder.append(", version=").append(version); - if (params != null) builder.append(", params=").append(params); - if (!images.isEmpty()) builder.append(", images=").append(images); - if (!sprites.isEmpty()) builder.append(", sprites=").append(sprites); - if (!audios.isEmpty()) builder.append(", audios=").append(audios); - return builder.replace(0, 2, "MovieEntity{").append('}').toString(); - } - public static final class Builder extends Message.Builder { public String version; @@ -202,64 +207,4 @@ public MovieEntity build() { return new MovieEntity(version, params, images, sprites, audios, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_MovieEntity extends ProtoAdapter { - private final ProtoAdapter> images = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, ProtoAdapter.BYTES); - - ProtoAdapter_MovieEntity() { - super(FieldEncoding.LENGTH_DELIMITED, MovieEntity.class); - } - - @Override - public int encodedSize(MovieEntity value) { - return (value.version != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.version) : 0) - + (value.params != null ? MovieParams.ADAPTER.encodedSizeWithTag(2, value.params) : 0) - + images.encodedSizeWithTag(3, value.images) - + SpriteEntity.ADAPTER.asRepeated().encodedSizeWithTag(4, value.sprites) - + AudioEntity.ADAPTER.asRepeated().encodedSizeWithTag(5, value.audios) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, MovieEntity value) throws IOException { - if (value.version != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.version); - if (value.params != null) MovieParams.ADAPTER.encodeWithTag(writer, 2, value.params); - images.encodeWithTag(writer, 3, value.images); - SpriteEntity.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.sprites); - AudioEntity.ADAPTER.asRepeated().encodeWithTag(writer, 5, value.audios); - writer.writeBytes(value.unknownFields()); - } - - @Override - public MovieEntity decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.version(ProtoAdapter.STRING.decode(reader)); break; - case 2: builder.params(MovieParams.ADAPTER.decode(reader)); break; - case 3: builder.images.putAll(images.decode(reader)); break; - case 4: builder.sprites.add(SpriteEntity.ADAPTER.decode(reader)); break; - case 5: builder.audios.add(AudioEntity.ADAPTER.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public MovieEntity redact(MovieEntity value) { - Builder builder = value.newBuilder(); - if (builder.params != null) builder.params = MovieParams.ADAPTER.redact(builder.params); - Internal.redactElements(builder.sprites, SpriteEntity.ADAPTER); - Internal.redactElements(builder.audios, AudioEntity.ADAPTER); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/MovieParams.java b/library/src/main/java/com/opensource/svgaplayer/proto/MovieParams.java index e8a3a98b..bb851133 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/MovieParams.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/MovieParams.java @@ -1,25 +1,22 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 6:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Float; -import java.lang.Integer; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import okio.ByteString; -public final class MovieParams extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_MovieParams(); +public final class MovieParams extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter( + MovieParams.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -36,7 +33,8 @@ public final class MovieParams extends Message */ @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float viewBoxWidth; @@ -45,7 +43,8 @@ public final class MovieParams extends Message */ @WireField( tag = 2, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float viewBoxHeight; @@ -54,7 +53,8 @@ public final class MovieParams extends Message */ @WireField( tag = 3, - adapter = "com.squareup.wire.ProtoAdapter#INT32" + adapter = "com.squareup.wire.ProtoAdapter#INT32", + returnDefaultValue = false ) public final Integer fps; @@ -63,15 +63,19 @@ public final class MovieParams extends Message */ @WireField( tag = 4, - adapter = "com.squareup.wire.ProtoAdapter#INT32" + adapter = "com.squareup.wire.ProtoAdapter#INT32", + returnDefaultValue = false ) public final Integer frames; + private boolean __isDefaultInstance; + public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames) { this(viewBoxWidth, viewBoxHeight, fps, frames, ByteString.EMPTY); } - public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames, ByteString unknownFields) { + public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer frames, + ByteString unknownFields) { super(ADAPTER, unknownFields); this.viewBoxWidth = viewBoxWidth; this.viewBoxHeight = viewBoxHeight; @@ -79,6 +83,13 @@ public MovieParams(Float viewBoxWidth, Float viewBoxHeight, Integer fps, Integer this.frames = frames; } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); @@ -116,24 +127,14 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (viewBoxWidth != null) builder.append(", viewBoxWidth=").append(viewBoxWidth); - if (viewBoxHeight != null) builder.append(", viewBoxHeight=").append(viewBoxHeight); - if (fps != null) builder.append(", fps=").append(fps); - if (frames != null) builder.append(", frames=").append(frames); - return builder.replace(0, 2, "MovieParams{").append('}').toString(); - } - public static final class Builder extends Message.Builder { - public Float viewBoxWidth; + public float viewBoxWidth; - public Float viewBoxHeight; + public float viewBoxHeight; - public Integer fps; + public int fps; - public Integer frames; + public int frames; public Builder() { } @@ -175,56 +176,4 @@ public MovieParams build() { return new MovieParams(viewBoxWidth, viewBoxHeight, fps, frames, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_MovieParams extends ProtoAdapter { - ProtoAdapter_MovieParams() { - super(FieldEncoding.LENGTH_DELIMITED, MovieParams.class); - } - - @Override - public int encodedSize(MovieParams value) { - return (value.viewBoxWidth != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.viewBoxWidth) : 0) - + (value.viewBoxHeight != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.viewBoxHeight) : 0) - + (value.fps != null ? ProtoAdapter.INT32.encodedSizeWithTag(3, value.fps) : 0) - + (value.frames != null ? ProtoAdapter.INT32.encodedSizeWithTag(4, value.frames) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, MovieParams value) throws IOException { - if (value.viewBoxWidth != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.viewBoxWidth); - if (value.viewBoxHeight != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.viewBoxHeight); - if (value.fps != null) ProtoAdapter.INT32.encodeWithTag(writer, 3, value.fps); - if (value.frames != null) ProtoAdapter.INT32.encodeWithTag(writer, 4, value.frames); - writer.writeBytes(value.unknownFields()); - } - - @Override - public MovieParams decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.viewBoxWidth(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.viewBoxHeight(ProtoAdapter.FLOAT.decode(reader)); break; - case 3: builder.fps(ProtoAdapter.INT32.decode(reader)); break; - case 4: builder.frames(ProtoAdapter.INT32.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public MovieParams redact(MovieParams value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/ShapeEntity.java b/library/src/main/java/com/opensource/svgaplayer/proto/ShapeEntity.java index 024faace..7967a899 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/ShapeEntity.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/ShapeEntity.java @@ -1,25 +1,23 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 43:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireEnum; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Float; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import okio.ByteString; -public final class ShapeEntity extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_ShapeEntity(); +public final class ShapeEntity extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter( + ShapeEntity.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -30,17 +28,24 @@ public final class ShapeEntity extends Message */ @WireField( tag = 1, - adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeType#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeType#ADAPTER", + returnDefaultValue = false ) public final ShapeType type; + /** + * 对应 type 枚举类型的原始int,反序列化出来的值可以从这里取 + */ + private int _type_value = DEFAULT_TYPE.getValue(); + /** * 矢量参数 * 渲染参数 */ @WireField( tag = 10, - adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeStyle#ADAPTER", + returnDefaultValue = false ) public final ShapeStyle styles; @@ -49,38 +54,47 @@ public final class ShapeEntity extends Message */ @WireField( tag = 11, - adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.Transform#ADAPTER", + returnDefaultValue = false ) public final Transform transform; @WireField( tag = 2, - adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeArgs#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.ShapeEntity$ShapeArgs#ADAPTER", + returnDefaultValue = false ) public final ShapeArgs shape; @WireField( tag = 3, - adapter = "com.opensource.svgaplayer.proto.ShapeEntity$RectArgs#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.ShapeEntity$RectArgs#ADAPTER", + returnDefaultValue = false ) public final RectArgs rect; @WireField( tag = 4, - adapter = "com.opensource.svgaplayer.proto.ShapeEntity$EllipseArgs#ADAPTER" + adapter = "com.opensource.svgaplayer.proto.ShapeEntity$EllipseArgs#ADAPTER", + returnDefaultValue = false ) public final EllipseArgs ellipse; - public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, ShapeArgs shape, RectArgs rect, EllipseArgs ellipse) { - this(type, styles, transform, shape, rect, ellipse, ByteString.EMPTY); + private boolean __isDefaultInstance; + + public ShapeEntity(ShapeType type, int _type_value, ShapeStyle styles, Transform transform, + ShapeArgs shape, RectArgs rect, EllipseArgs ellipse) { + this(type, _type_value, styles, transform, shape, rect, ellipse, ByteString.EMPTY); } - public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, ShapeArgs shape, RectArgs rect, EllipseArgs ellipse, ByteString unknownFields) { + public ShapeEntity(ShapeType type, int _type_value, ShapeStyle styles, Transform transform, + ShapeArgs shape, RectArgs rect, EllipseArgs ellipse, ByteString unknownFields) { super(ADAPTER, unknownFields); if (Internal.countNonNull(shape, rect, ellipse) > 1) { throw new IllegalArgumentException("at most one of shape, rect, ellipse may be non-null"); } this.type = type; + this._type_value = _type_value; this.styles = styles; this.transform = transform; this.shape = shape; @@ -88,10 +102,25 @@ public ShapeEntity(ShapeType type, ShapeStyle styles, Transform transform, Shape this.ellipse = ellipse; } + /** + * 对应 type 枚举类型的原始int,反序列化出来的值可以从这里取 + */ + public final int getTypeValue() { + return _type_value; + } + + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); builder.type = type; + builder._type_value = _type_value; builder.styles = styles; builder.transform = transform; builder.shape = shape; @@ -108,6 +137,7 @@ public boolean equals(Object other) { ShapeEntity o = (ShapeEntity) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(type, o.type) + && Internal.equals(_type_value, o._type_value) && Internal.equals(styles, o.styles) && Internal.equals(transform, o.transform) && Internal.equals(shape, o.shape) @@ -121,6 +151,7 @@ public int hashCode() { if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (type != null ? type.hashCode() : 0); + result = result * 37 + _type_value; result = result * 37 + (styles != null ? styles.hashCode() : 0); result = result * 37 + (transform != null ? transform.hashCode() : 0); result = result * 37 + (shape != null ? shape.hashCode() : 0); @@ -131,21 +162,11 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (type != null) builder.append(", type=").append(type); - if (styles != null) builder.append(", styles=").append(styles); - if (transform != null) builder.append(", transform=").append(transform); - if (shape != null) builder.append(", shape=").append(shape); - if (rect != null) builder.append(", rect=").append(rect); - if (ellipse != null) builder.append(", ellipse=").append(ellipse); - return builder.replace(0, 2, "ShapeEntity{").append('}').toString(); - } - public static final class Builder extends Message.Builder { public ShapeType type; + private int _type_value; + public ShapeStyle styles; public Transform transform; @@ -207,7 +228,7 @@ public Builder ellipse(EllipseArgs ellipse) { @Override public ShapeEntity build() { - return new ShapeEntity(type, styles, transform, shape, rect, ellipse, super.buildUnknownFields()); + return new ShapeEntity(type, _type_value, styles, transform, shape, rect, ellipse, super.buildUnknownFields()); } } @@ -230,7 +251,9 @@ public enum ShapeType implements WireEnum { /** * 与前帧一致 */ - KEEP(3); + KEEP(3), + + UNRECOGNIZED(-1); public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(ShapeType.class); @@ -249,7 +272,7 @@ public static ShapeType fromValue(int value) { case 1: return RECT; case 2: return ELLIPSE; case 3: return KEEP; - default: return null; + default: return UNRECOGNIZED; } } @@ -259,8 +282,10 @@ public int getValue() { } } - public static final class ShapeArgs extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_ShapeArgs(); + public static final class ShapeArgs extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(ShapeArgs.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -271,10 +296,13 @@ public static final class ShapeArgs extends Message { public String d; @@ -338,53 +366,12 @@ public ShapeArgs build() { return new ShapeArgs(d, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_ShapeArgs extends ProtoAdapter { - ProtoAdapter_ShapeArgs() { - super(FieldEncoding.LENGTH_DELIMITED, ShapeArgs.class); - } - - @Override - public int encodedSize(ShapeArgs value) { - return (value.d != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.d) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, ShapeArgs value) throws IOException { - if (value.d != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.d); - writer.writeBytes(value.unknownFields()); - } - - @Override - public ShapeArgs decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.d(ProtoAdapter.STRING.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public ShapeArgs redact(ShapeArgs value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } - public static final class RectArgs extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_RectArgs(); + public static final class RectArgs extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(RectArgs.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -400,25 +387,29 @@ public static final class RectArgs extends Message { @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float x; @WireField( tag = 2, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float y; @WireField( tag = 3, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float width; @WireField( tag = 4, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float height; @@ -427,15 +418,19 @@ public static final class RectArgs extends Message { */ @WireField( tag = 5, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float cornerRadius; + private boolean __isDefaultInstance; + public RectArgs(Float x, Float y, Float width, Float height, Float cornerRadius) { this(x, y, width, height, cornerRadius, ByteString.EMPTY); } - public RectArgs(Float x, Float y, Float width, Float height, Float cornerRadius, ByteString unknownFields) { + public RectArgs(Float x, Float y, Float width, Float height, Float cornerRadius, + ByteString unknownFields) { super(ADAPTER, unknownFields); this.x = x; this.y = y; @@ -444,6 +439,13 @@ public RectArgs(Float x, Float y, Float width, Float height, Float cornerRadius, this.cornerRadius = cornerRadius; } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); @@ -484,27 +486,16 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (x != null) builder.append(", x=").append(x); - if (y != null) builder.append(", y=").append(y); - if (width != null) builder.append(", width=").append(width); - if (height != null) builder.append(", height=").append(height); - if (cornerRadius != null) builder.append(", cornerRadius=").append(cornerRadius); - return builder.replace(0, 2, "RectArgs{").append('}').toString(); - } - public static final class Builder extends Message.Builder { - public Float x; + public float x; - public Float y; + public float y; - public Float width; + public float width; - public Float height; + public float height; - public Float cornerRadius; + public float cornerRadius; public Builder() { } @@ -542,65 +533,12 @@ public RectArgs build() { return new RectArgs(x, y, width, height, cornerRadius, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_RectArgs extends ProtoAdapter { - ProtoAdapter_RectArgs() { - super(FieldEncoding.LENGTH_DELIMITED, RectArgs.class); - } - - @Override - public int encodedSize(RectArgs value) { - return (value.x != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x) : 0) - + (value.y != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y) : 0) - + (value.width != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.width) : 0) - + (value.height != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.height) : 0) - + (value.cornerRadius != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(5, value.cornerRadius) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, RectArgs value) throws IOException { - if (value.x != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x); - if (value.y != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y); - if (value.width != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.width); - if (value.height != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.height); - if (value.cornerRadius != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.cornerRadius); - writer.writeBytes(value.unknownFields()); - } - - @Override - public RectArgs decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.x(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.y(ProtoAdapter.FLOAT.decode(reader)); break; - case 3: builder.width(ProtoAdapter.FLOAT.decode(reader)); break; - case 4: builder.height(ProtoAdapter.FLOAT.decode(reader)); break; - case 5: builder.cornerRadius(ProtoAdapter.FLOAT.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public RectArgs redact(RectArgs value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } - public static final class EllipseArgs extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_EllipseArgs(); + public static final class EllipseArgs extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(EllipseArgs.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -617,7 +555,8 @@ public static final class EllipseArgs extends Message { - public Float x; + public float x; - public Float y; + public float y; - public Float radiusX; + public float radiusX; - public Float radiusY; + public float radiusY; public Builder() { } @@ -756,62 +697,12 @@ public EllipseArgs build() { return new EllipseArgs(x, y, radiusX, radiusY, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_EllipseArgs extends ProtoAdapter { - ProtoAdapter_EllipseArgs() { - super(FieldEncoding.LENGTH_DELIMITED, EllipseArgs.class); - } - - @Override - public int encodedSize(EllipseArgs value) { - return (value.x != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.x) : 0) - + (value.y != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.y) : 0) - + (value.radiusX != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.radiusX) : 0) - + (value.radiusY != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.radiusY) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, EllipseArgs value) throws IOException { - if (value.x != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.x); - if (value.y != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.y); - if (value.radiusX != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.radiusX); - if (value.radiusY != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.radiusY); - writer.writeBytes(value.unknownFields()); - } - - @Override - public EllipseArgs decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.x(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.y(ProtoAdapter.FLOAT.decode(reader)); break; - case 3: builder.radiusX(ProtoAdapter.FLOAT.decode(reader)); break; - case 4: builder.radiusY(ProtoAdapter.FLOAT.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public EllipseArgs redact(EllipseArgs value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } - public static final class ShapeStyle extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_ShapeStyle(); + public static final class ShapeStyle extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(ShapeStyle.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -834,7 +725,8 @@ public static final class ShapeStyle extends Message { public RGBAColor fill; public RGBAColor stroke; - public Float strokeWidth; + public float strokeWidth; public LineCap lineCap; + private int _lineCap_value; + public LineJoin lineJoin; - public Float miterLimit; + private int _lineJoin_value; + + public float miterLimit; - public Float lineDashI; + public float lineDashI; - public Float lineDashII; + public float lineDashII; - public Float lineDashIII; + public float lineDashIII; public Builder() { } @@ -1090,12 +1024,14 @@ public Builder lineDashIII(Float lineDashIII) { @Override public ShapeStyle build() { - return new ShapeStyle(fill, stroke, strokeWidth, lineCap, lineJoin, miterLimit, lineDashI, lineDashII, lineDashIII, super.buildUnknownFields()); + return new ShapeStyle(fill, stroke, strokeWidth, lineCap, _lineCap_value, lineJoin, _lineJoin_value, miterLimit, lineDashI, lineDashII, lineDashIII, super.buildUnknownFields()); } } - public static final class RGBAColor extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_RGBAColor(); + public static final class RGBAColor extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(RGBAColor.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -1109,28 +1045,34 @@ public static final class RGBAColor extends Message { - public Float r; + public float r; - public Float g; + public float g; - public Float b; + public float b; - public Float a; + public float a; public Builder() { } @@ -1227,58 +1166,6 @@ public RGBAColor build() { return new RGBAColor(r, g, b, a, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_RGBAColor extends ProtoAdapter { - ProtoAdapter_RGBAColor() { - super(FieldEncoding.LENGTH_DELIMITED, RGBAColor.class); - } - - @Override - public int encodedSize(RGBAColor value) { - return (value.r != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.r) : 0) - + (value.g != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.g) : 0) - + (value.b != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.b) : 0) - + (value.a != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.a) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, RGBAColor value) throws IOException { - if (value.r != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.r); - if (value.g != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.g); - if (value.b != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.b); - if (value.a != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.a); - writer.writeBytes(value.unknownFields()); - } - - @Override - public RGBAColor decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.r(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.g(ProtoAdapter.FLOAT.decode(reader)); break; - case 3: builder.b(ProtoAdapter.FLOAT.decode(reader)); break; - case 4: builder.a(ProtoAdapter.FLOAT.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public RGBAColor redact(RGBAColor value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } public enum LineCap implements WireEnum { @@ -1286,7 +1173,9 @@ public enum LineCap implements WireEnum { LineCap_ROUND(1), - LineCap_SQUARE(2); + LineCap_SQUARE(2), + + UNRECOGNIZED(-1); public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(LineCap.class); @@ -1304,7 +1193,7 @@ public static LineCap fromValue(int value) { case 0: return LineCap_BUTT; case 1: return LineCap_ROUND; case 2: return LineCap_SQUARE; - default: return null; + default: return UNRECOGNIZED; } } @@ -1319,7 +1208,9 @@ public enum LineJoin implements WireEnum { LineJoin_ROUND(1), - LineJoin_BEVEL(2); + LineJoin_BEVEL(2), + + UNRECOGNIZED(-1); public static final ProtoAdapter ADAPTER = ProtoAdapter.newEnumAdapter(LineJoin.class); @@ -1337,7 +1228,7 @@ public static LineJoin fromValue(int value) { case 0: return LineJoin_MITER; case 1: return LineJoin_ROUND; case 2: return LineJoin_BEVEL; - default: return null; + default: return UNRECOGNIZED; } } @@ -1346,158 +1237,5 @@ public int getValue() { return value; } } - - private static final class ProtoAdapter_ShapeStyle extends ProtoAdapter { - ProtoAdapter_ShapeStyle() { - super(FieldEncoding.LENGTH_DELIMITED, ShapeStyle.class); - } - - @Override - public int encodedSize(ShapeStyle value) { - return (value.fill != null ? RGBAColor.ADAPTER.encodedSizeWithTag(1, value.fill) : 0) - + (value.stroke != null ? RGBAColor.ADAPTER.encodedSizeWithTag(2, value.stroke) : 0) - + (value.strokeWidth != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.strokeWidth) : 0) - + (value.lineCap != null ? LineCap.ADAPTER.encodedSizeWithTag(4, value.lineCap) : 0) - + (value.lineJoin != null ? LineJoin.ADAPTER.encodedSizeWithTag(5, value.lineJoin) : 0) - + (value.miterLimit != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(6, value.miterLimit) : 0) - + (value.lineDashI != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(7, value.lineDashI) : 0) - + (value.lineDashII != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(8, value.lineDashII) : 0) - + (value.lineDashIII != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(9, value.lineDashIII) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, ShapeStyle value) throws IOException { - if (value.fill != null) RGBAColor.ADAPTER.encodeWithTag(writer, 1, value.fill); - if (value.stroke != null) RGBAColor.ADAPTER.encodeWithTag(writer, 2, value.stroke); - if (value.strokeWidth != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.strokeWidth); - if (value.lineCap != null) LineCap.ADAPTER.encodeWithTag(writer, 4, value.lineCap); - if (value.lineJoin != null) LineJoin.ADAPTER.encodeWithTag(writer, 5, value.lineJoin); - if (value.miterLimit != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 6, value.miterLimit); - if (value.lineDashI != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 7, value.lineDashI); - if (value.lineDashII != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 8, value.lineDashII); - if (value.lineDashIII != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 9, value.lineDashIII); - writer.writeBytes(value.unknownFields()); - } - - @Override - public ShapeStyle decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.fill(RGBAColor.ADAPTER.decode(reader)); break; - case 2: builder.stroke(RGBAColor.ADAPTER.decode(reader)); break; - case 3: builder.strokeWidth(ProtoAdapter.FLOAT.decode(reader)); break; - case 4: { - try { - builder.lineCap(LineCap.ADAPTER.decode(reader)); - } catch (ProtoAdapter.EnumConstantNotFoundException e) { - builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); - } - break; - } - case 5: { - try { - builder.lineJoin(LineJoin.ADAPTER.decode(reader)); - } catch (ProtoAdapter.EnumConstantNotFoundException e) { - builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); - } - break; - } - case 6: builder.miterLimit(ProtoAdapter.FLOAT.decode(reader)); break; - case 7: builder.lineDashI(ProtoAdapter.FLOAT.decode(reader)); break; - case 8: builder.lineDashII(ProtoAdapter.FLOAT.decode(reader)); break; - case 9: builder.lineDashIII(ProtoAdapter.FLOAT.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public ShapeStyle redact(ShapeStyle value) { - Builder builder = value.newBuilder(); - if (builder.fill != null) builder.fill = RGBAColor.ADAPTER.redact(builder.fill); - if (builder.stroke != null) builder.stroke = RGBAColor.ADAPTER.redact(builder.stroke); - builder.clearUnknownFields(); - return builder.build(); - } - } - } - - private static final class ProtoAdapter_ShapeEntity extends ProtoAdapter { - ProtoAdapter_ShapeEntity() { - super(FieldEncoding.LENGTH_DELIMITED, ShapeEntity.class); - } - - @Override - public int encodedSize(ShapeEntity value) { - return (value.type != null ? ShapeType.ADAPTER.encodedSizeWithTag(1, value.type) : 0) - + (value.styles != null ? ShapeStyle.ADAPTER.encodedSizeWithTag(10, value.styles) : 0) - + (value.transform != null ? Transform.ADAPTER.encodedSizeWithTag(11, value.transform) : 0) - + (value.shape != null ? ShapeArgs.ADAPTER.encodedSizeWithTag(2, value.shape) : 0) - + (value.rect != null ? RectArgs.ADAPTER.encodedSizeWithTag(3, value.rect) : 0) - + (value.ellipse != null ? EllipseArgs.ADAPTER.encodedSizeWithTag(4, value.ellipse) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, ShapeEntity value) throws IOException { - if (value.type != null) ShapeType.ADAPTER.encodeWithTag(writer, 1, value.type); - if (value.styles != null) ShapeStyle.ADAPTER.encodeWithTag(writer, 10, value.styles); - if (value.transform != null) Transform.ADAPTER.encodeWithTag(writer, 11, value.transform); - if (value.shape != null) ShapeArgs.ADAPTER.encodeWithTag(writer, 2, value.shape); - if (value.rect != null) RectArgs.ADAPTER.encodeWithTag(writer, 3, value.rect); - if (value.ellipse != null) EllipseArgs.ADAPTER.encodeWithTag(writer, 4, value.ellipse); - writer.writeBytes(value.unknownFields()); - } - - @Override - public ShapeEntity decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: { - try { - builder.type(ShapeType.ADAPTER.decode(reader)); - } catch (ProtoAdapter.EnumConstantNotFoundException e) { - builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); - } - break; - } - case 10: builder.styles(ShapeStyle.ADAPTER.decode(reader)); break; - case 11: builder.transform(Transform.ADAPTER.decode(reader)); break; - case 2: builder.shape(ShapeArgs.ADAPTER.decode(reader)); break; - case 3: builder.rect(RectArgs.ADAPTER.decode(reader)); break; - case 4: builder.ellipse(EllipseArgs.ADAPTER.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public ShapeEntity redact(ShapeEntity value) { - Builder builder = value.newBuilder(); - if (builder.styles != null) builder.styles = ShapeStyle.ADAPTER.redact(builder.styles); - if (builder.transform != null) builder.transform = Transform.ADAPTER.redact(builder.transform); - if (builder.shape != null) builder.shape = ShapeArgs.ADAPTER.redact(builder.shape); - if (builder.rect != null) builder.rect = RectArgs.ADAPTER.redact(builder.rect); - if (builder.ellipse != null) builder.ellipse = EllipseArgs.ADAPTER.redact(builder.ellipse); - builder.clearUnknownFields(); - return builder.build(); - } } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/SpriteEntity.java b/library/src/main/java/com/opensource/svgaplayer/proto/SpriteEntity.java index bc9120b5..c4d53fef 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/SpriteEntity.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/SpriteEntity.java @@ -1,24 +1,24 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 13:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import java.util.List; + import okio.ByteString; -public final class SpriteEntity extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_SpriteEntity(); +public final class SpriteEntity extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter( + SpriteEntity.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -31,7 +31,8 @@ public final class SpriteEntity extends Message frames; @@ -50,26 +52,37 @@ public final class SpriteEntity extends Message frames, String matteKey) { this(imageKey, frames, matteKey, ByteString.EMPTY); } - public SpriteEntity(String imageKey, List frames, String matteKey, ByteString unknownFields) { + public SpriteEntity(String imageKey, List frames, String matteKey, + ByteString unknownFields) { super(ADAPTER, unknownFields); this.imageKey = imageKey; this.frames = Internal.immutableCopyOf("frames", frames); this.matteKey = matteKey; } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); builder.imageKey = imageKey; - builder.frames = Internal.copyOf("frames", frames); + builder.frames = Internal.copyOf(frames); builder.matteKey = matteKey; builder.addUnknownFields(unknownFields()); return builder; @@ -99,15 +112,6 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (imageKey != null) builder.append(", imageKey=").append(imageKey); - if (!frames.isEmpty()) builder.append(", frames=").append(frames); - if (matteKey != null) builder.append(", matteKey=").append(matteKey); - return builder.replace(0, 2, "SpriteEntity{").append('}').toString(); - } - public static final class Builder extends Message.Builder { public String imageKey; @@ -149,54 +153,4 @@ public SpriteEntity build() { return new SpriteEntity(imageKey, frames, matteKey, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_SpriteEntity extends ProtoAdapter { - ProtoAdapter_SpriteEntity() { - super(FieldEncoding.LENGTH_DELIMITED, SpriteEntity.class); - } - - @Override - public int encodedSize(SpriteEntity value) { - return (value.imageKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.imageKey) : 0) - + FrameEntity.ADAPTER.asRepeated().encodedSizeWithTag(2, value.frames) - + (value.matteKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(3, value.matteKey) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, SpriteEntity value) throws IOException { - if (value.imageKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.imageKey); - FrameEntity.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.frames); - if (value.matteKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 3, value.matteKey); - writer.writeBytes(value.unknownFields()); - } - - @Override - public SpriteEntity decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.imageKey(ProtoAdapter.STRING.decode(reader)); break; - case 2: builder.frames.add(FrameEntity.ADAPTER.decode(reader)); break; - case 3: builder.matteKey(ProtoAdapter.STRING.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public SpriteEntity redact(SpriteEntity value) { - Builder builder = value.newBuilder(); - Internal.redactElements(builder.frames, FrameEntity.ADAPTER); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/java/com/opensource/svgaplayer/proto/Transform.java b/library/src/main/java/com/opensource/svgaplayer/proto/Transform.java index c4c4941d..dc33a713 100644 --- a/library/src/main/java/com/opensource/svgaplayer/proto/Transform.java +++ b/library/src/main/java/com/opensource/svgaplayer/proto/Transform.java @@ -1,24 +1,21 @@ // Code generated by Wire protocol buffer compiler, do not edit. -// Source file: svga.proto at 34:1 +// Source file: svga.proto package com.opensource.svgaplayer.proto; -import com.squareup.wire.FieldEncoding; +import android.os.Parcelable; + +import com.squareup.wire.AndroidMessage; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; -import com.squareup.wire.ProtoReader; -import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; -import java.io.IOException; -import java.lang.Float; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; + import okio.ByteString; -public final class Transform extends Message { - public static final ProtoAdapter ADAPTER = new ProtoAdapter_Transform(); +public final class Transform extends AndroidMessage { + public static final ProtoAdapter ADAPTER = ProtoAdapter.newMessageAdapter(Transform.class); + + public static final Parcelable.Creator CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; @@ -36,45 +33,54 @@ public final class Transform extends Message { @WireField( tag = 1, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float a; @WireField( tag = 2, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float b; @WireField( tag = 3, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float c; @WireField( tag = 4, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float d; @WireField( tag = 5, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float tx; @WireField( tag = 6, - adapter = "com.squareup.wire.ProtoAdapter#FLOAT" + adapter = "com.squareup.wire.ProtoAdapter#FLOAT", + returnDefaultValue = false ) public final Float ty; + private boolean __isDefaultInstance; + public Transform(Float a, Float b, Float c, Float d, Float tx, Float ty) { this(a, b, c, d, tx, ty, ByteString.EMPTY); } - public Transform(Float a, Float b, Float c, Float d, Float tx, Float ty, ByteString unknownFields) { + public Transform(Float a, Float b, Float c, Float d, Float tx, Float ty, + ByteString unknownFields) { super(ADAPTER, unknownFields); this.a = a; this.b = b; @@ -84,6 +90,13 @@ public Transform(Float a, Float b, Float c, Float d, Float tx, Float ty, ByteStr this.ty = ty; } + /** + * true--反序列化为null,给一个默认的实例;false--反序列化出来的实例 + */ + public final boolean __isDefaultInstance() { + return __isDefaultInstance; + } + @Override public Builder newBuilder() { Builder builder = new Builder(); @@ -127,30 +140,18 @@ public int hashCode() { return result; } - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - if (a != null) builder.append(", a=").append(a); - if (b != null) builder.append(", b=").append(b); - if (c != null) builder.append(", c=").append(c); - if (d != null) builder.append(", d=").append(d); - if (tx != null) builder.append(", tx=").append(tx); - if (ty != null) builder.append(", ty=").append(ty); - return builder.replace(0, 2, "Transform{").append('}').toString(); - } - public static final class Builder extends Message.Builder { - public Float a; + public float a; - public Float b; + public float b; - public Float c; + public float c; - public Float d; + public float d; - public Float tx; + public float tx; - public Float ty; + public float ty; public Builder() { } @@ -190,62 +191,4 @@ public Transform build() { return new Transform(a, b, c, d, tx, ty, super.buildUnknownFields()); } } - - private static final class ProtoAdapter_Transform extends ProtoAdapter { - ProtoAdapter_Transform() { - super(FieldEncoding.LENGTH_DELIMITED, Transform.class); - } - - @Override - public int encodedSize(Transform value) { - return (value.a != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(1, value.a) : 0) - + (value.b != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(2, value.b) : 0) - + (value.c != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(3, value.c) : 0) - + (value.d != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(4, value.d) : 0) - + (value.tx != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(5, value.tx) : 0) - + (value.ty != null ? ProtoAdapter.FLOAT.encodedSizeWithTag(6, value.ty) : 0) - + value.unknownFields().size(); - } - - @Override - public void encode(ProtoWriter writer, Transform value) throws IOException { - if (value.a != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 1, value.a); - if (value.b != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 2, value.b); - if (value.c != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 3, value.c); - if (value.d != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 4, value.d); - if (value.tx != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 5, value.tx); - if (value.ty != null) ProtoAdapter.FLOAT.encodeWithTag(writer, 6, value.ty); - writer.writeBytes(value.unknownFields()); - } - - @Override - public Transform decode(ProtoReader reader) throws IOException { - Builder builder = new Builder(); - long token = reader.beginMessage(); - for (int tag; (tag = reader.nextTag()) != -1;) { - switch (tag) { - case 1: builder.a(ProtoAdapter.FLOAT.decode(reader)); break; - case 2: builder.b(ProtoAdapter.FLOAT.decode(reader)); break; - case 3: builder.c(ProtoAdapter.FLOAT.decode(reader)); break; - case 4: builder.d(ProtoAdapter.FLOAT.decode(reader)); break; - case 5: builder.tx(ProtoAdapter.FLOAT.decode(reader)); break; - case 6: builder.ty(ProtoAdapter.FLOAT.decode(reader)); break; - default: { - FieldEncoding fieldEncoding = reader.peekFieldEncoding(); - Object value = fieldEncoding.rawProtoAdapter().decode(reader); - builder.addUnknownField(tag, fieldEncoding, value); - } - } - } - reader.endMessage(token); - return builder.build(); - } - - @Override - public Transform redact(Transform value) { - Builder builder = value.newBuilder(); - builder.clearUnknownFields(); - return builder.build(); - } - } } diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index 475f5534..bced8aeb 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - SVGAPlayer + D-SVGAPlayer