Commit b9f4b07e b9f4b07e61de9fab2d1e5c4c5d3138b18374ced2 by 金学艇

1.解决首页偶尔闪屏的问题

1 parent 2467b3d1
...@@ -5708,8 +5708,8 @@ ...@@ -5708,8 +5708,8 @@
5708 } 5708 }
5709 ], 5709 ],
5710 "_useOriginalSize": false, 5710 "_useOriginalSize": false,
5711 "_string": "v0.9.0.2020031313", 5711 "_string": "v0.9.0.2020031610",
5712 "_N$string": "v0.9.0.2020031313", 5712 "_N$string": "v0.9.0.2020031610",
5713 "_fontSize": 24, 5713 "_fontSize": 24,
5714 "_lineHeight": 24, 5714 "_lineHeight": 24,
5715 "_enableWrapText": true, 5715 "_enableWrapText": true,
......
...@@ -71,7 +71,8 @@ cc.Class({ ...@@ -71,7 +71,8 @@ cc.Class({
71 this._bAbleHotUpdate = false; 71 this._bAbleHotUpdate = false;
72 this._bIsDataListMoving = false; 72 this._bIsDataListMoving = false;
73 this._bIsScrollViewMoving = false; 73 this._bIsScrollViewMoving = false;
74 this._bInitCategoryListSuccess = true; 74 this._bInitCategoryListSuccess = false;
75 this._bInitRecommendDataSuccess = false;
75 this._scrollview = this.node.getComponent(cc.ScrollView); 76 this._scrollview = this.node.getComponent(cc.ScrollView);
76 this._oSceneContext.focusPath = "scrollContent/TopNavi/topNavi1"; 77 this._oSceneContext.focusPath = "scrollContent/TopNavi/topNavi1";
77 this._oSceneContext._iPageIndex = 1; 78 this._oSceneContext._iPageIndex = 1;
...@@ -621,6 +622,9 @@ cc.Class({ ...@@ -621,6 +622,9 @@ cc.Class({
621 // cc.log("子节点:"+nodeLayout.childrenCount); 622 // cc.log("子节点:"+nodeLayout.childrenCount);
622 } 623 }
623 624
625 this._bInitRecommendDataSuccess = true;
626 this.checkDataReadyAndInitFocus();
627
624 // this.node.getChildByName("scrollContent").height = 2300; //这里暂且写死,scrollView有bug 628 // this.node.getChildByName("scrollContent").height = 2300; //这里暂且写死,scrollView有bug
625 // this._scrollview.scrollToTop(); 629 // this._scrollview.scrollToTop();
626 } catch (error) { 630 } catch (error) {
...@@ -633,13 +637,13 @@ cc.Class({ ...@@ -633,13 +637,13 @@ cc.Class({
633 }, 637 },
634 638
635 recoverFocusPath: function () { 639 recoverFocusPath: function () {
636 if (this._oSceneContext._iCurrentLeftIndex == 1) { 640 // if (this._oSceneContext._iCurrentLeftIndex == 1) {//在调用处已经判断了,不需要重复判断
637 if (this._oSceneContext._iPageIndex == 1) { 641 if (this._oSceneContext._iPageIndex == 1) {
638 this.scheduleOnce(() => { 642 this.scheduleOnce(() => {
639 let fiFocusTarget = cc.find(this._oSceneContext.focusPath, this.node).getComponent(FocusInfo); 643 let fiFocusTarget = cc.find(this._oSceneContext.focusPath, this.node).getComponent(FocusInfo);
640 this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, null, null); 644 this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, null, null);
641 return; 645 return;
642 }, 0) 646 }, 0);
643 } 647 }
644 let height = this._aBgHeight[this._oSceneContext._iPageIndex - 1] || 0; //-1,打补丁:解决回退回来页面对不上的bug 648 let height = this._aBgHeight[this._oSceneContext._iPageIndex - 1] || 0; //-1,打补丁:解决回退回来页面对不上的bug
645 this.onScrollViewScrollStart(); 649 this.onScrollViewScrollStart();
...@@ -652,9 +656,9 @@ cc.Class({ ...@@ -652,9 +656,9 @@ cc.Class({
652 // cc.log("执行恢复跳转。。。" + this._oSceneContext.focusPath); 656 // cc.log("执行恢复跳转。。。" + this._oSceneContext.focusPath);
653 let fiFocusTarget = cc.find(this._oSceneContext.focusPath, this.node).getComponent(FocusInfo); 657 let fiFocusTarget = cc.find(this._oSceneContext.focusPath, this.node).getComponent(FocusInfo);
654 this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, null, null); 658 this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, null, null);
655 this.scheduleOnce(showFocusCallback, 0.2); 659 this.scheduleOnce(showFocusCallback, 0.5);
656 }, 0.3); 660 }, 0.5);
657 } 661 // }
658 662
659 }, 663 },
660 664
...@@ -813,7 +817,7 @@ cc.Class({ ...@@ -813,7 +817,7 @@ cc.Class({
813 this._bInitCategoryListSuccess = true; 817 this._bInitCategoryListSuccess = true;
814 this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage(); 818 this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
815 819
816 this.checkDataReadyAndInitFocus(this._bInitCategoryListSuccess); 820 this.checkDataReadyAndInitFocus();
817 }); 821 });
818 // }, 822 // },
819 // null, 823 // null,
...@@ -824,7 +828,8 @@ cc.Class({ ...@@ -824,7 +828,8 @@ cc.Class({
824 }, 828 },
825 829
826 checkDataReadyAndInitFocus: function () { 830 checkDataReadyAndInitFocus: function () {
827 if (!this._bIsFocusInit) { 831 // cc.log("checkDataReadyAndInitFocus:"+(!this._bIsFocusInit && (this._bInitRecommendDataSuccess || this._bInitCategoryListSuccess)));
832 if (!this._bIsFocusInit && (this._bInitRecommendDataSuccess || this._bInitCategoryListSuccess)) {
828 this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行 833 this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行
829 this.initFocus(); 834 this.initFocus();
830 }, 0); 835 }, 0);
...@@ -868,19 +873,21 @@ cc.Class({ ...@@ -868,19 +873,21 @@ cc.Class({
868 Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true); 873 Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true);
869 this._cFocus.hide(); 874 this._cFocus.hide();
870 875
871 if (this._oSceneContext.focusPath != "scrollContent/TopNavi/topNavi1") 876 if (!Common._bIsHotUpdate) {
877 Common._bIsHotUpdate = true;
878 this.checkUpdate(); //热更新
879 }
880
881 if (this._oSceneContext.focusPath != "scrollContent/TopNavi/topNavi1" && this._oSceneContext._iCurrentLeftIndex == 1) {
872 this.recoverFocusPath(); //有必要的话去恢复焦点记忆 882 this.recoverFocusPath(); //有必要的话去恢复焦点记忆
883 return;
884 }
873 885
874 if (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆 886 if (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆
875 this.scheduleOnce(function () { 887 this.scheduleOnce(function () {
876 this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null); 888 this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null);
877 }, 0); 889 }, 0);
878 } 890 }
879
880 if (!Common._bIsHotUpdate) {
881 Common._bIsHotUpdate = true;
882 this.checkUpdate(); //热更新
883 }
884 }, 891 },
885 892
886 keyDownDirection: function (Direct) { 893 keyDownDirection: function (Direct) {
...@@ -917,9 +924,9 @@ cc.Class({ ...@@ -917,9 +924,9 @@ cc.Class({
917 // cc.log("目标节点名称:" + fiFocusTarget.node.name); 924 // cc.log("目标节点名称:" + fiFocusTarget.node.name);
918 var leftNavLayout = this.targetAry[0].target; 925 var leftNavLayout = this.targetAry[0].target;
919 926
920 if (!this._bInitCategoryListSuccess) { 927 // if (!this._bInitCategoryListSuccess) {
921 return [null, oScrollParameter]; 928 // return [null, oScrollParameter];
922 } 929 // }
923 930
924 if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("topNavi") || 0 == fiFocusTarget.node.name.indexOf("topCell")) { 931 if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("topNavi") || 0 == fiFocusTarget.node.name.indexOf("topCell")) {
925 if (0 != this._fiCurrentFocus.node.name.indexOf("topNavi") && 0 != this._fiCurrentFocus.node.name.indexOf("topCell")) {//如果不是TypeList之间跳转,则哪里来回哪里去 932 if (0 != this._fiCurrentFocus.node.name.indexOf("topNavi") && 0 != this._fiCurrentFocus.node.name.indexOf("topCell")) {//如果不是TypeList之间跳转,则哪里来回哪里去
......
1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:id="@+id/ll_single"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent"
6 android:visibility="gone">
7
8 <ImageView
9 android:id="@+id/iv"
10 android:layout_width="match_parent"
11 android:layout_height="match_parent"
12 android:src="@mipmap/icon_bg"/>
13
14 </RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -151,8 +151,8 @@ public class TopdrawSDKWrapper { ...@@ -151,8 +151,8 @@ public class TopdrawSDKWrapper {
151 public static void startGame(String apkName, final String strJSCallBack) { 151 public static void startGame(String apkName, final String strJSCallBack) {
152 Log.d(TAG, "TopdrawSDKWrapper starGame start..." + apkName); 152 Log.d(TAG, "TopdrawSDKWrapper starGame start..." + apkName);
153 153
154 View view = _activity.getProgressBarView();
155 final View singleColorView = _activity.getSingleColorView(); 154 final View singleColorView = _activity.getSingleColorView();
155 View view = _activity.getProgressBarView();
156 final RelativeLayout relativeLayout = view.findViewById(R.id.rl_img); 156 final RelativeLayout relativeLayout = view.findViewById(R.id.rl_img);
157 if (pluginLoaded) { 157 if (pluginLoaded) {
158 return; 158 return;
...@@ -248,6 +248,7 @@ public class TopdrawSDKWrapper { ...@@ -248,6 +248,7 @@ public class TopdrawSDKWrapper {
248 return; 248 return;
249 } 249 }
250 pluginLoaded = true; 250 pluginLoaded = true;
251 final View obiView = _activity.getObiView();
251 final String packageName = apkName; 252 final String packageName = apkName;
252 final String className = claName; 253 final String className = claName;
253 OBiPluginLoader.getInstance().start(downloadUrl, packageName, new OBiPluginLoader.OnResultListener() { 254 OBiPluginLoader.getInstance().start(downloadUrl, packageName, new OBiPluginLoader.OnResultListener() {
...@@ -268,19 +269,12 @@ public class TopdrawSDKWrapper { ...@@ -268,19 +269,12 @@ public class TopdrawSDKWrapper {
268 } 269 }
269 } 270 }
270 271
271 // _activity.runOnUiThread(new Runnable() { //直接加载游戏,传回去进度是100 272 _activity.runOnUiThread(new Runnable() { //直接加载游戏,传回去进度是100
272 // @Override 273 @Override
273 // public void run() { 274 public void run() {
274 // _activity.runOnGLThread(new Runnable() { 275 obiView.setVisibility(View.VISIBLE);
275 // @Override 276 }
276 // public void run() { 277 });
277 // Cocos2dxJavascriptJavaBridge.evalString(
278 // "cc.find('Canvas',cc.director.getScene()).getComponent(cc.Topdraw.TVCanvas)." + strJSCallBack + "('" + 100 + "');" //modify jerry
279 // );
280 // }
281 // });
282 // }
283 // });
284 278
285 } else if (-10 == i) { 279 } else if (-10 == i) {
286 Toast.makeText(_activity, msg, Toast.LENGTH_LONG).show(); 280 Toast.makeText(_activity, msg, Toast.LENGTH_LONG).show();
......
...@@ -60,8 +60,10 @@ public class AppActivity extends Cocos2dxActivity { ...@@ -60,8 +60,10 @@ public class AppActivity extends Cocos2dxActivity {
60 private BroadcastReceiver receiver = null; 60 private BroadcastReceiver receiver = null;
61 private View view; 61 private View view;
62 private View singleView; 62 private View singleView;
63 private View obiView;
63 private RelativeLayout relativeLayout; 64 private RelativeLayout relativeLayout;
64 private RelativeLayout mRLSingleColor; 65 private RelativeLayout mRLSingleColor;
66 private RelativeLayout mOBiLayout;
65 67
66 @Override 68 @Override
67 protected void onCreate(Bundle savedInstanceState) { 69 protected void onCreate(Bundle savedInstanceState) {
...@@ -71,6 +73,11 @@ public class AppActivity extends Cocos2dxActivity { ...@@ -71,6 +73,11 @@ public class AppActivity extends Cocos2dxActivity {
71 mRLSingleColor = singleView.findViewById(R.id.ll_single); 73 mRLSingleColor = singleView.findViewById(R.id.ll_single);
72 mFrameLayout.addView(singleView); 74 mFrameLayout.addView(singleView);
73 //---- end 75 //---- end
76 //----解决奥比游戏安装时,露出详情页不能刷新的问题
77 obiView = LayoutInflater.from(this).inflate(R.layout.activity_main_obi_bg, null);
78 mOBiLayout = obiView.findViewById(R.id.ll_single);
79 mFrameLayout.addView(obiView);
80 //---- end
74 //添加加载小游戏进度条(暂时将Cocos2dxActivity中的this.mGLSurfaceView.setZOrderOnTop(true);注释,否则显示不出来) 81 //添加加载小游戏进度条(暂时将Cocos2dxActivity中的this.mGLSurfaceView.setZOrderOnTop(true);注释,否则显示不出来)
75 view = LayoutInflater.from(this).inflate(R.layout.activity_main, null); 82 view = LayoutInflater.from(this).inflate(R.layout.activity_main, null);
76 relativeLayout = view.findViewById(R.id.rl_img); 83 relativeLayout = view.findViewById(R.id.rl_img);
...@@ -143,6 +150,7 @@ public class AppActivity extends Cocos2dxActivity { ...@@ -143,6 +150,7 @@ public class AppActivity extends Cocos2dxActivity {
143 super.onResume(); 150 super.onResume();
144 SDKWrapper.getInstance().onResume(); 151 SDKWrapper.getInstance().onResume();
145 mRLSingleColor.setVisibility(View.GONE); 152 mRLSingleColor.setVisibility(View.GONE);
153 mOBiLayout.setVisibility(View.GONE);
146 } 154 }
147 155
148 @Override 156 @Override
...@@ -248,6 +256,10 @@ public class AppActivity extends Cocos2dxActivity { ...@@ -248,6 +256,10 @@ public class AppActivity extends Cocos2dxActivity {
248 return mRLSingleColor; 256 return mRLSingleColor;
249 } 257 }
250 258
259 public View getObiView() {
260 return mOBiLayout;
261 }
262
251 //打出场景日志 Info 263 //打出场景日志 Info
252 public static void logInSceneI(String strLog) { 264 public static void logInSceneI(String strLog) {
253 Log.i("logInSceneI", strLog); 265 Log.i("logInSceneI", strLog);
......