Skip to content

Commit 55e3804

Browse files
author
guofang
committed
Merge branch 'dev_jlzhang' into 'dev_2.9.0'
增加category/extendDict及支持lua和h5 See merge request Mobile/VideoOS-Android-SDK!28
2 parents 81c08f7 + 0640de1 commit 55e3804

File tree

6 files changed

+39
-24
lines changed

6 files changed

+39
-24
lines changed

VideoOS/LuaViewSDK/src/cn/com/venvy/lua/plugin/LVVideoPlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static class GetExtendJSONString extends VarArgFunction {
7575

7676
@Override
7777
public Varargs invoke(Varargs args) {
78-
return mPlatform != null && mPlatform.getPlatformInfo().getExtendJSONString() != null ? LuaValue.valueOf(mPlatform.getPlatformInfo().getExtendJSONString()) : LuaValue.NIL;
78+
return mPlatform != null && mPlatform.getPlatformInfo() != null && mPlatform.getPlatformInfo().getExtendDict() != null && mPlatform.getPlatformInfo().getExtendDict().size() > 0 ? LuaUtil.toTable(mPlatform.getPlatformInfo().getExtendDict()) : LuaValue.NIL;
7979
}
8080
}
8181

@@ -403,8 +403,8 @@ public Varargs invoke(Varargs args) {
403403
if (!TextUtils.isEmpty(platformInfo.getVideoCategory())) {
404404
table.set("category", platformInfo.getVideoCategory());
405405
}
406-
if (!TextUtils.isEmpty(platformInfo.getExtendJSONString())) {
407-
table.set("extendJSONString", platformInfo.getExtendJSONString());
406+
if (platformInfo.getExtendDict() != null && platformInfo.getExtendDict().size() > 0) {
407+
table.set("extendDict", LuaUtil.toTable(platformInfo.getExtendDict()));
408408
}
409409
return table;
410410
}

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/PlatformInfo.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import android.os.Parcel;
44
import android.os.Parcelable;
55

6+
import java.util.Map;
7+
68
import cn.com.venvy.common.interf.ScreenStatus;
79
import cn.com.venvy.common.interf.VideoType;
810

@@ -25,7 +27,7 @@ public class PlatformInfo implements Parcelable {
2527
private ScreenStatus mDirection;
2628
private VideoType mVideoType;
2729
private final String mVideoCategory;
28-
private final String mExtendJSONString;
30+
private Map mExtendDict;
2931
private final String mCustomerPackageName;
3032
private final String mFileProviderAuth;
3133

@@ -43,7 +45,7 @@ private PlatformInfo(Builder builder) {
4345
mDirection = builder.mInitDirection == null ? ScreenStatus.SMALL_VERTICAL : builder.mInitDirection;
4446
mVideoType = builder.mVideoType == null ? VideoType.VIDEOOS : builder.mVideoType;
4547
mVideoCategory = builder.videoCategory;
46-
mExtendJSONString = builder.extendJsonString;
48+
mExtendDict = builder.extendDict;
4749
mCustomerPackageName = builder.mCustomerPackageName;
4850
mFileProviderAuth = builder.fileProviderAuth;
4951
}
@@ -54,8 +56,8 @@ public void updateDirection(ScreenStatus status) {
5456
}
5557
}
5658

57-
public String getExtendJSONString() {
58-
return mExtendJSONString;
59+
public Map getExtendDict() {
60+
return mExtendDict;
5961
}
6062

6163
public String getVideoCategory() {
@@ -134,7 +136,7 @@ public static class Builder {
134136
private ScreenStatus mInitDirection;
135137
private VideoType mVideoType;
136138
private String videoCategory;
137-
private String extendJsonString;
139+
private Map extendDict;
138140
private String mCustomerPackageName;
139141
private String fileProviderAuth;
140142

@@ -143,8 +145,8 @@ public Builder setCustomerPackageName(String mCustomerPackageName) {
143145
return this;
144146
}
145147

146-
public Builder setExtendJSONString(String extendJsonString) {
147-
this.extendJsonString = extendJsonString;
148+
public Builder setExtendDict(Map extendDict) {
149+
this.extendDict = extendDict;
148150
return this;
149151
}
150152

@@ -256,7 +258,7 @@ public void writeToParcel(Parcel dest, int flags) {
256258
dest.writeInt(this.mDirection == null ? -1 : this.mDirection.getId());
257259
dest.writeInt(this.mVideoType == null ? 0 : this.mVideoType.getId());
258260
dest.writeString(this.mVideoCategory);
259-
dest.writeString(this.mExtendJSONString);
261+
dest.writeMap(this.mExtendDict);
260262
dest.writeString(this.mCustomerPackageName);
261263
dest.writeString(this.mFileProviderAuth);
262264
}
@@ -276,7 +278,7 @@ protected PlatformInfo(Parcel in) {
276278
this.mDirection = tmpMInitDirection == -1 ? ScreenStatus.SMALL_VERTICAL : ScreenStatus.getStatusById(tmpMInitDirection);
277279
this.mVideoType = tmpMInitDirection == -1 ? VideoType.VIDEOOS : VideoType.getStatusById(tmpMInitDirection);
278280
this.mVideoCategory = in.readString();
279-
this.mExtendJSONString = in.readString();
281+
in.readMap(this.mExtendDict,Map.class.getClassLoader());
280282
this.mCustomerPackageName = in.readString();
281283
this.mFileProviderAuth = in.readString();
282284
}

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/webview/JsBridge.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,23 @@ private JSONObject getVideoInfo() {
858858

859859
try {
860860
if (mPlatform != null) {
861-
jsonObject.put("videoID", mPlatform.getPlatformInfo().getVideoId());
861+
if(mPlatform.getPlatformInfo() != null){
862+
if(!TextUtils.isEmpty(mPlatform.getPlatformInfo().getVideoId())){
863+
jsonObject.put("videoID", mPlatform.getPlatformInfo().getVideoId());
864+
}
865+
if (!TextUtils.isEmpty(mPlatform.getPlatformInfo().getVideoCategory())) {
866+
jsonObject.put("category", mPlatform.getPlatformInfo().getVideoCategory());
867+
}
868+
if (mPlatform.getPlatformInfo().getExtendDict() != null && mPlatform.getPlatformInfo().getExtendDict().size() > 0) {
869+
jsonObject.put("extendDict", new JSONObject(mPlatform.getPlatformInfo().getExtendDict()));
870+
}
871+
}
862872
IMediaControlListener mediaControlListener = mPlatform.getMediaControlListener();
863873
if (mediaControlListener != null) {
864874
jsonObject.put("title", TextUtils.isEmpty(mediaControlListener.getVideoTitle()) ? "" : mediaControlListener.getVideoTitle());
865875
jsonObject.put("episode", TextUtils.isEmpty(mediaControlListener.getVideoEpisode()) ? "" : mediaControlListener.getVideoEpisode());
866876
}
877+
867878
}
868879
} catch (JSONException e) {
869880
e.printStackTrace();

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/Provider.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.os.Parcelable;
55
import android.text.TextUtils;
66

7+
import java.util.Map;
8+
79
import cn.com.venvy.common.interf.ScreenStatus;
810
import cn.com.venvy.common.interf.VideoType;
911

@@ -40,7 +42,7 @@ public class Provider implements Parcelable {
4042
@Deprecated
4143
private final int mVerticalSmallVideoWidth;
4244

43-
private final String mExtendJSONString;
45+
private Map mExtendDict;
4446

4547
private final String mFileProviderAuth;
4648

@@ -61,12 +63,12 @@ private Provider(Builder builder) {
6163
this.mPackageName = builder.mPackageName;
6264
this.mCustomUDID = builder.mCustomUDID;
6365
this.mVideoCategory = builder.videoCategory;
64-
this.mExtendJSONString = builder.mExtendJSONString;
66+
this.mExtendDict = builder.mExtendDict;
6567
this.mFileProviderAuth = builder.mFileProviderAuth;
6668
}
6769

68-
public String getExtendJSONString() {
69-
return mExtendJSONString;
70+
public Map getExtendDict() {
71+
return mExtendDict;
7072
}
7173

7274
public String getVideoCategory() {
@@ -150,16 +152,16 @@ public static class Builder {
150152
private String mPackageName;
151153
private String mCustomUDID;
152154
private String videoCategory;
153-
private String mExtendJSONString;
155+
private Map mExtendDict;
154156
private String mFileProviderAuth;
155157

156158
@Deprecated
157159
public Builder setTestUserId(String testUserId) {
158160
return this;
159161
}
160162

161-
public Builder setExtendJSONString(String extendJSONString) {
162-
this.mExtendJSONString = extendJSONString;
163+
public Builder setExtendDict(Map extendDict) {
164+
this.mExtendDict = extendDict;
163165
return this;
164166
}
165167

@@ -304,7 +306,7 @@ public void writeToParcel(Parcel dest, int flags) {
304306
dest.writeInt(this.mVerticalSmallVideoWidth);
305307
dest.writeString(this.mCustomUDID);
306308
dest.writeString(this.mVideoCategory);
307-
dest.writeString(this.mExtendJSONString);
309+
dest.writeMap(this.mExtendDict);
308310
dest.writeString(this.mFileProviderAuth);
309311
}
310312

@@ -324,7 +326,7 @@ protected Provider(Parcel in) {
324326
this.mVerticalSmallVideoWidth = in.readInt();
325327
this.mCustomUDID = in.readString();
326328
this.mVideoCategory = in.readString();
327-
this.mExtendJSONString = in.readString();
329+
in.readMap(this.mExtendDict, Map.class.getClassLoader());
328330
this.mFileProviderAuth = in.readString();
329331
}
330332

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoPlusController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ protected PlatformInfo initPlatformInfo(Provider provider) {
372372
.setInitDirection(provider.getDirection())
373373
.setVideoType(provider.getVideoType())
374374
.setVideoCategory(provider.getVideoCategory())
375-
.setExtendJSONString(provider.getExtendJSONString())
375+
.setExtendDict(provider.getExtendDict())
376376
.setFileProviderAuth(provider.getFileProviderAuth())
377377
.setAppKey(provider.getAppKey()).setAppSecret(provider.getAppSecret());
378378
return platformInfoBuilder.builder();

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoPlusH5Controller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected PlatformInfo initPlatformInfo(Provider provider) {
9090
.setInitDirection(provider.getDirection())
9191
.setVideoType(provider.getVideoType())
9292
.setVideoCategory(provider.getVideoCategory())
93-
.setExtendJSONString(provider.getExtendJSONString())
93+
.setExtendDict(provider.getExtendDict())
9494
.setAppKey(provider.getAppKey()).setAppSecret(provider.getAppSecret());
9595
return platformInfoBuilder.builder();
9696
}

0 commit comments

Comments
 (0)