Commit b994d0fb b994d0fbd9d852eba636e8a8fde551766a52cba4 by 金学艇

1.解决首页瀑布流和分类页的光标记忆问题

1 parent 74e4a3d7
......@@ -189,7 +189,7 @@
"array": [
0,
0,
271.0659484863281,
265.0037841796875,
0,
0,
0,
......
......@@ -5708,8 +5708,8 @@
}
],
"_useOriginalSize": false,
"_string": "v1.0.2.2020031115",
"_N$string": "v1.0.2.2020031115",
"_string": "v0.9.0.2020031117",
"_N$string": "v0.9.0.2020031117",
"_fontSize": 24,
"_lineHeight": 24,
"_enableWrapText": true,
......
......@@ -147,6 +147,39 @@ cc.Class({
},
onKeyUp: function (event) {
try {
this._super(event);
var fiFocusTarget = null;
var fiCurrentFocus = this._fiCurrentFocus;
var oScrollParameter = null;
let nodeFrom = null;
let nodeTo = null;
if (event.keyCode == cc.macro.KEY.right || event.keyCode == Common.ANDROID_KEY.right) {
if (fiCurrentFocus.node.name == "ProgressBtn" || this._fiCurrentFocus.node.name == "Play") {
this._ComOperation.resumePlayState();
this._iFakeProgressStep = 0;
this._bFakeProgressStart = false;
this.unschedule(this.fakeStepForward);
}
}
if (event.keyCode == cc.macro.KEY.left || event.keyCode == Common.ANDROID_KEY.left) {
if (fiCurrentFocus.node.name == "ProgressBtn" || this._fiCurrentFocus.node.name == "Play") {
this._ComOperation.resumePlayState();
this._iFakeProgressStep = 0;
this._bFakeProgressStart = false;
this.unschedule(this.fakeStepBackward);
}
}
} catch (error) {
if (cc.sys.isNative) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "onKeyUp Error in VarietyVideo==>" + error);
}
}
},
onKeyDown: function (event) {
try {
this._super(event);
......@@ -196,7 +229,7 @@ cc.Class({
// if (!this._bMediaFree && this._fiCurrentFocus.node.name == "ProgressBtn") {
// fiFocusTarget = cc.find("VideoArea/PlayPanel/Operation/Group/Collect", this.node).getComponent(FocusInfo);
// }
cc.log("向下滑动:"+fiFocusTarget.node.name);
cc.log("向下滑动:" + fiFocusTarget.node.name);
this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, 1.0, oScrollParameter);
}
if (this._fiCurrentFocus.node.name == "Play" && this._bShowProgress) {
......@@ -488,7 +521,7 @@ cc.Class({
this._ComOperation.initPlayer(0, 0, Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, true, true); //测试
let options = {};
options.playurl = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/playlist.m3u8";
options.playurl = "http://mirror.aarnet.edu.au/pub/TED-talks/911Mothers_2010W-480p.mp4";
this._ComOperation.setURL(options); //测试播放地址
} catch (error) {
if (cc.sys.isNative) {
......
......@@ -457,9 +457,9 @@ cc.Topdraw.TVCanvas =
this._oNextSceneParameter.sceneName = strForwardSceneName;
aSceneParameter.push(this._oNextSceneParameter);
aSceneContext.push(this._oSceneContext);
this._cLog.screenI("跳转场景1111111");
// this._cLog.screenI("跳转场景1111111");
this._ComOperation && this._ComOperation.end();
this._cLog.screenI("跳转场景2222222");
// this._cLog.screenI("跳转场景2222222");
Common.g_strCurrentSceneName = strForwardSceneName;
cc.director.loadScene(strForwardSceneName);
}
......
......@@ -26,7 +26,20 @@ cc.Class({
this._super();
this._oInit = {};
this._oSceneContext._iCurrentLeftIndex = 0;
this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
this._bIsDataListMoving = false;
this._bInitCategoryListSuccess = false;
if (this._cApplication.getBackStatus()) {
//恢复上下文 包括
//光标位置 focusPath
let oSceneContext = this._cApplication.popSceneContext();
if (oSceneContext) {
this._oSceneContext = oSceneContext;
cc.log(this._oSceneContext);
}
this._cApplication.setBackStatus(false);
}
this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node);
this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper);
......@@ -110,7 +123,7 @@ cc.Class({
);
this._aFocusTargets[0]["topNavi" + i] = node;
}
this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
// this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
this.checkDataReadyAndInitFocus();
// this.requestMediaList(1);
this.getSimulateRequest();
......@@ -258,13 +271,10 @@ cc.Class({
iStart1, (lvCategoryList.getShowCellRows() + lvCategoryList.getAlphaCellRows()) * lvCategoryList.getCellCountEachRow(),
null, null
);
// lvCategoryList.loadData(
// function (strResponse) {
// cc.log("/////" + this._oInit[this._oSceneContext._iCurrentLeftIndex]);
// let strResponse = this.aCategoryListJson[this._oSceneContext._iCurrentLeftIndex];
let strResponse = this._oInit[this._oSceneContext._iCurrentLeftIndex];
lvCategoryList.loadData(
function (strResponse) {
lvCategoryList.renderInitData(strResponse, function () {
// cc.log("InitCategoryList-------------------->");
var oJSONResult = JSON.parse(strResponse);
// if (oJSONResult.resultSet.length <= 0) { //没有数据就显示占位图
// cc.find('BlankIcon', this.node).opacity = 255;
......@@ -274,18 +284,16 @@ cc.Class({
this._bInitCategoryListSuccess = true;
this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
this.checkDataReadyAndInitFocus(this._bInitCategoryListSuccess);
this.checkDataReadyAndInitFocus();
});
// },
// null,
// this
// );
}, null, this, strResponse
);
},
checkDataReadyAndInitFocus: function () {
if (!this._bIsFocusInit) {
if (!this._bIsFocusInit && this._bInitCategoryListSuccess) {
this.scheduleOnce(() => { //指定0让回调函数在下一帧立即执行
this.initFocus();
}, 0);
......@@ -303,7 +311,10 @@ cc.Class({
this._cFocus.init('focusContainer', this,
nodeInitFocus.getComponent(FocusInfo),
Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 10, 6, 1.1, true);
if (0 == nodeInitFocus.name.indexOf("topNavi")) {
this._cFocus.hide();
}
//处理焦点位于下方问题
if (this._oSceneContext.typeListY) {
......@@ -378,6 +389,7 @@ cc.Class({
// cc.log("当前时多少条目:" + index);
let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
if (lvCategoryList.scrollARowUp(index, this._oInit[this._oSceneContext._iCurrentLeftIndex])) {
this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
return;
}
}
......@@ -396,6 +408,7 @@ cc.Class({
var index = parseInt(this._fiCurrentFocus.node.getName().replace('CategoryListCell', ''));
let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
if (lvCategoryList.scrollARowDown(null, index, this._oInit[this._oSceneContext._iCurrentLeftIndex])) {
this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();
return;
}
}
......@@ -532,13 +545,15 @@ cc.Class({
// );
}
if (0 == fiFrom.node.getName().indexOf('topNavi')) {
this._oSceneContext._iCurrentLeftIndex = iIndex;
this._oSceneContext.categoryRecordIndexOfFirstCell = 0; //将列表记录置空
this.scheduleOnce(function () {
// this.requestMediaList(1); //重新渲染CategoryList
this.getSimulateRequest();
}, 0);
}
}
if (0 == fiTo.node.getName().indexOf('CategoryListCell')) {
fiTo.node.getChildByName("Normal").active = false;
......
......@@ -39,7 +39,7 @@
"name": "frame1",
"resultSet": [
{
"name": "Carousel0",
"name": "Carousel1",
"code": "promotionItem_fd456495-2e32-44e1-9d92-450227d4afa3",
"left": 64,
"top": 0,
......@@ -49,7 +49,7 @@
"height": 167
},
{
"name": "dailyRecommend",
"name": "dailyRecommend2",
"code": "promotionItem_4ca66642-33d0-41c9-9913-df131a79a375",
"left": 359,
"top": 0,
......@@ -59,7 +59,7 @@
"height": 167
},
{
"name": "dailyRecommend",
"name": "dailyRecommend3",
"code": "promotionItem_c5f58c16-48a5-4796-ab52-rwvh6u5j55",
"left": 652,
"top": 0,
......@@ -69,7 +69,7 @@
"height": 167
},
{
"name": "dailyRecommend",
"name": "dailyRecommend4",
"code": "promotionItem_c5f58c16-48a5-4796-ab52-41679fc88a6d",
"left": 946,
"top": 0,
......@@ -141,19 +141,19 @@
"code": "promotionItem_e29b33e4-8954-4eerthy6rthg54er"
},
{
"name": "Subject3",
"name": "Subject4",
"imageURL": "upload/image/main/block4_4.png",
"tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}",
"code": "promotionItem_e29b33e4-8954-vwregv54thw6"
},
{
"name": "Subject3",
"name": "Subject5",
"imageURL": "upload/image/main/block4_5.png",
"tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}",
"code": "promotionItem_e29b33e4-8954-bq4wrjhwbt4t"
},
{
"name": "Subject4",
"name": "Subject6",
"imageURL": "upload/image/main/block4_6.png",
"tvlink": "{\"click\":[{\"action\":\"ChangeScene\",\"parameters\":{\"sceneName\":\"sceneGameCategory\"}}]}",
"code": "promotionItem_57aea4b3-7716-4we5j56trhgser2"
......@@ -184,7 +184,7 @@
"disable": true
},
{
"name": "SingerList",
"name": "SingerList1",
"code": "promotionItem_0a911d4c-9223-4d49-se5hj54uh4w5g45w",
"left": 63,
"top": 64,
......@@ -194,7 +194,7 @@
"height": 228
},
{
"name": "SingerList",
"name": "SingerList2",
"code": "promotionItem_c388af5a-0351-43c4-e5sjhu45h54wh45h",
"left": 653,
"top": 64,
......@@ -214,7 +214,7 @@
"name": "frame3",
"resultSet": [
{
"name": "SingerList",
"name": "SingerList3",
"code": "promotionItem_c388af5a-0351-43c4we5jh45j45jh54hj",
"left": 63,
"top": 24,
......@@ -224,7 +224,7 @@
"height": 228
},
{
"name": "SingerList",
"name": "SingerList4",
"code": "promotionItem_c388af5a-0351-43c4j56j54hw4h54",
"left": 456,
"top": 24,
......@@ -234,7 +234,7 @@
"height": 228
},
{
"name": "SingerList",
"name": "SingerList5",
"code": "promotionItem_c388af5a-0351-43c4-w45jh45h54h5h",
"left": 848,
"top": 24,
......