Skip to content

Commit 73afaa5

Browse files
author
guofang
committed
Merge branch 'dev_yunce' into 'dev_2.9.0'
fix 一些云测的Bug See merge request Mobile/VideoOS-Android-SDK!19
2 parents d535d28 + f5d1fe9 commit 73afaa5

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,23 @@ public void startVisionProgram(final String appletId, final String data, final i
652652
if (mContentView != null) {
653653
mContentView.setVisibility(View.VISIBLE);
654654
}
655-
this.mPlatform = initPlatform(mVideoPlusAdapter);
655+
if (this.mPlatform == null) {
656+
this.mPlatform = initPlatform(mVideoPlusAdapter);
657+
}
656658
VisionProgramConfigModel model = new VisionProgramConfigModel(mPlatform, appletId, isH5Type, new VisionProgramConfigModel.VisionProgramConfigCallback() {
657659

658660
@Override
659661
public void downComplete(final String entranceLua, boolean isUpdateByNet, boolean nvgShow) {
660662
VenvyLog.d("vision program downComplete : " + isUpdateByNet + " - " + entranceLua);
663+
if (mPlatform == null) {
664+
mPlatform = initPlatform(mVideoPlusAdapter);
665+
}
661666
mPlatform.setNvgShow(false);
662667
VenvyUIUtil.runOnUIThread(new Runnable() {
663668
@Override
664669
public void run() {
665670
String luaId = entranceLua;
666-
if (entranceLua.contains(".")) {
671+
if (entranceLua != null && entranceLua.contains(".")) {
667672
luaId = entranceLua.split("\\.")[0];
668673
}
669674
//LuaView://applets?appletId=xxxx&template=xxxx.lua&id=xxxx&(priority=x)

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,15 @@ private void init() {
8484
@Override
8585
public void onClick(View view) {
8686
if (VenvyDeviceUtil.isNetworkAvailable(getContext())) {
87-
VideoOSLuaView osLuaView = getCurrentLuaView();
88-
HashMap<String, String> map = new HashMap<>();
89-
map.put("eventType", "2");
90-
map.put("appletActionType", "1");
91-
map.put("data", retryData);
92-
osLuaView.callLuaFunction("event", map);
87+
if(getCurrentLuaView() instanceof VideoOSLuaView){
88+
VideoOSLuaView osLuaView = (VideoOSLuaView)getCurrentLuaView();
89+
HashMap<String, String> map = new HashMap<>();
90+
map.put("eventType", "2");
91+
map.put("appletActionType", "1");
92+
map.put("data", retryData);
93+
osLuaView.callLuaFunction("event", map);
94+
}
95+
9396
}
9497
}
9598
});
@@ -229,17 +232,19 @@ public void notifyLua(String data) {
229232
VenvyLog.d("call event function");
230233

231234
// 通知正在展示的lua refresh
232-
VideoOSLuaView osLuaView = getCurrentLuaView();
233-
HashMap<String, String> map = new HashMap<>();
234-
map.put("eventType", "2");
235-
map.put("appletActionType", "2");
236-
map.put("data", data);
237-
osLuaView.callLuaFunction("event", map);
235+
if (getCurrentLuaView() instanceof VideoOSLuaView) {
236+
VideoOSLuaView osLuaView = (VideoOSLuaView) getCurrentLuaView();
237+
HashMap<String, String> map = new HashMap<>();
238+
map.put("eventType", "2");
239+
map.put("appletActionType", "2");
240+
map.put("data", data);
241+
osLuaView.callLuaFunction("event", map);
242+
}
238243

239244
}
240245

241-
public VideoOSLuaView getCurrentLuaView() {
242-
return (VideoOSLuaView) videoProgramView.getChildAt(videoProgramView.getChildCount() - 1);
246+
public View getCurrentLuaView() {
247+
return videoProgramView.getChildAt(videoProgramView.getChildCount() - 1);
243248
}
244249

245250
public void launchLuaScript(String template, final String id, String data) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public void start(@NonNull String appletId, String data, int orientationType, bo
197197
* @param url
198198
*/
199199
public void startH5(String url, String developerUserId) {
200+
if (currentH5Program == null) return;
200201
currentH5Program.addDeveloperUserIdToJsBridge(developerUserId);
201202
currentH5Program.setWebViewCloseListener(new VideoWebToolBarView.WebViewCloseListener() {
202203
@Override
@@ -345,8 +346,6 @@ public void onScreenChanged(boolean isHorizontal) {
345346
*/
346347
@Override
347348
public void notifyChanged(VenvyObservable observable, String tag, Bundle bundle) {
348-
// TODO : bundle maybe is null..
349-
350349
if (VenvyObservableTarget.TAG_ADD_LUA_SCRIPT_TO_VISION_PROGRAM.equals(tag)) {
351350
if (bundle != null) {
352351
String appletId = bundle.getString(VenvyObservableTarget.KEY_APPLETS_ID);

0 commit comments

Comments
 (0)