Skip to content

Commit 269cefb

Browse files
author
videopls
committed
Merge branch 'dev_2.9.0_rr_2.10.3_test' into dev_2.10.1
2 parents 5413d3f + 23a6763 commit 269cefb

File tree

2 files changed

+39
-38
lines changed

2 files changed

+39
-38
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import cn.com.venvy.PlatformInfo;
2626
import cn.com.venvy.VenvyRegisterLibsManager;
2727
import cn.com.venvy.VideoCopyLuaAssetsHelper;
28+
import cn.com.venvy.VideoPositionHelper;
2829
import cn.com.venvy.common.debug.DebugHelper;
2930
import cn.com.venvy.common.interf.ActionType;
3031
import cn.com.venvy.common.interf.CallbackType;
@@ -303,7 +304,6 @@ public void stop() {
303304
mContentView.removeAllViews();
304305
mContentView.setVisibility(View.GONE);
305306
}
306-
307307
}
308308

309309
void destroy() {
@@ -409,10 +409,12 @@ protected void navigation(Uri uri, HashMap<String, String> params, IRouterCallba
409409
return;
410410
}
411411

412-
if (mPlatform == null) {
413-
mPlatform = initPlatform(mVideoPlusAdapter);
412+
if (mContentView.getVisibility() == View.GONE || mContentView.getVisibility() == View.INVISIBLE) {
413+
mContentView.setVisibility(View.VISIBLE);
414414
}
415415

416+
mPlatform = initPlatform(mVideoPlusAdapter);
417+
416418
PostInfo postInfo = VenvyRouterManager.getInstance().setUri(uri)
417419
.withTargetPlatform("platform", mPlatform)
418420
.withTargetViewParent(mContentView);
@@ -694,9 +696,7 @@ public void startVisionProgram(final String appletId, final String data, final i
694696
if (mContentView != null) {
695697
mContentView.setVisibility(View.VISIBLE);
696698
}
697-
if (this.mPlatform == null) {
698-
this.mPlatform = initPlatform(mVideoPlusAdapter);
699-
}
699+
this.mPlatform = initPlatform(mVideoPlusAdapter);
700700
VisionProgramConfigModel model = new VisionProgramConfigModel(mPlatform, appletId, isH5Type, new VisionProgramConfigModel.VisionProgramConfigCallback() {
701701

702702
@Override
@@ -776,9 +776,7 @@ public void refreshRecentHistory(String appId) {
776776
}
777777

778778
public void downloadAdsRes(Bundle bundle) {
779-
if (this.mPlatform == null) {
780-
this.mPlatform = initPlatform(mVideoPlusAdapter);
781-
}
779+
this.mPlatform = initPlatform(mVideoPlusAdapter);
782780
if (videoAdsHandler == null) {
783781
videoAdsHandler = new VideoAdsHandler(mPlatform);
784782
}

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

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.HashMap;
1818

1919
import cn.com.venvy.App;
20+
import cn.com.venvy.VideoPositionHelper;
2021
import cn.com.venvy.common.interf.IServiceCallback;
2122
import cn.com.venvy.common.interf.ServiceType;
2223
import cn.com.venvy.common.observer.VenvyObservableTarget;
@@ -32,7 +33,6 @@
3233

3334
public abstract class VideoPlusView<T extends VideoPlusController> extends FrameLayout {
3435

35-
3636
// 顶层小程序容器 4
3737
protected VideoProgramView programTopLevel;
3838
// A 类小程序 0,1
@@ -51,39 +51,15 @@ public abstract class VideoPlusView<T extends VideoPlusController> extends Frame
5151
private Pair<Float, Float> videoModeDeskOffset; // 视联网模式桌面偏移量
5252

5353
public VideoPlusView(Context context) {
54-
super(context);
55-
init();
54+
this(context,null);
5655
}
5756

5857
public VideoPlusView(Context context, AttributeSet attrs) {
59-
super(context, attrs);
60-
init();
58+
this(context, attrs, 0);
6159
}
6260

6361
public VideoPlusView(Context context, AttributeSet attrs, int defStyleAttr) {
6462
super(context, attrs, defStyleAttr);
65-
init();
66-
}
67-
68-
69-
@Override
70-
protected void onDetachedFromWindow() {
71-
super.onDetachedFromWindow();
72-
if (plusViewHelper != null) {
73-
plusViewHelper.detachedFromWindow();
74-
}
75-
}
76-
77-
@Override
78-
protected void onConfigurationChanged(Configuration newConfig) {
79-
super.onConfigurationChanged(newConfig);
80-
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
81-
// 手机竖屏
82-
83-
} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
84-
// 手机横屏
85-
86-
}
8763
}
8864

8965
private void init() {
@@ -95,6 +71,7 @@ private void init() {
9571
addView(programViewB);
9672
addView(programTopLevel);
9773
programViewB.setClickable(false);
74+
initViewAdapter();
9875
}
9976

10077
/**
@@ -106,7 +83,6 @@ private VideoProgramView createTypeAProgram() {
10683
return new VideoProgramView(getContext());
10784
}
10885

109-
11086
/**
11187
* 生成B类小程序容器
11288
*
@@ -189,6 +165,10 @@ public void closeInfoView() {
189165
}
190166

191167
public void setVideoOSAdapter(VideoPlusAdapter adapter) {
168+
this.adapter = adapter;
169+
}
170+
171+
private void initViewAdapter() {
192172
if (programTopLevel != null) {
193173
programTopLevel.setVideoOSAdapter(adapter);
194174
}
@@ -198,23 +178,46 @@ public void setVideoOSAdapter(VideoPlusAdapter adapter) {
198178
if (programViewB != null) {
199179
programViewB.setVideoOSAdapter(adapter);
200180
}
201-
this.adapter = adapter;
202181
}
203182

204183
public VideoPlusAdapter getAdapter() {
205184
return adapter;
206185
}
207186

208187
public void start() {
188+
init();
209189
if (programViewA != null) {
210190
programViewA.start();
211191
}
212192
}
213193

214194
public void stop() {
195+
if (plusViewHelper != null) {
196+
plusViewHelper.detachedFromWindow();
197+
plusViewHelper = null;
198+
}
199+
215200
if (programViewA != null) {
216201
programViewA.stop();
202+
VideoPositionHelper.getInstance().cancel();
203+
programViewA = null;
204+
}
205+
206+
if (programViewB != null) {
207+
programViewB.closeAllProgram();
208+
programViewB = null;
209+
}
210+
211+
if (programTopLevel != null) {
212+
programTopLevel.stop();
213+
programTopLevel = null;
214+
}
215+
216+
if (programViewDesktop != null) {
217+
programViewDesktop.stop();
218+
programViewDesktop = null;
217219
}
220+
this.removeAllViews();
218221
}
219222

220223
/**

0 commit comments

Comments
 (0)