切换成一行4列

dev
linruijn 1 year ago
parent 7baa4b3e3b
commit 6763645fa2
  1. 2
      app/.gitignore
  2. 67
      app/src/main/assets/My.json
  3. 36
      app/src/main/java/com/unionmed/unionmedtv/fragment/ContentFragment.java

2
app/.gitignore vendored

@ -7,3 +7,5 @@ gradlew.bat
local.properties
# 各个模块下build文件夹
app/build/
/build
*/build

@ -79,73 +79,6 @@
]
}
, {
"id": 9966,
"title": "Banner",
"showTitle": "false",
"contentCode": 103,
"widgets": [
{
"id": 13,
"contentCode": "1081",
"name": "1大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic9.iqiyipic.com/image/20190714/b3/f9/a_100010085_m_601_m2_260_360.jpg"
},
{
"id": 13,
"contentCode": "1081",
"name": "2大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic2.iqiyipic.com/image/20181106/fd/89/a_100010437_m_601_m4_260_360.jpg"
},
{
"id": 13,
"contentCode": "1081",
"name": "3大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic6.iqiyipic.com/image/20190712/d6/53/a_100011364_m_601_m3_260_360.jpg"
},
{
"id": 13,
"contentCode": "1081",
"name": "4大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic2.iqiyipic.com/image/20190702/ed/98/a_100008476_m_601_m2_260_360.jpg"
},
{
"id": 13,
"contentCode": "1081",
"name": "5大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic2.iqiyipic.com/image/20181120/84/ab/a_50392791_m_601_m3_260_360.jpg"
}
,
{
"id": 13,
"contentCode": "1081",
"name": "6大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic2.iqiyipic.com/image/20181120/84/ab/a_50392791_m_601_m3_260_360.jpg"
}
,
{
"id": 13,
"contentCode": "1081",
"name": "7大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic2.iqiyipic.com/image/20181120/84/ab/a_50392791_m_601_m3_260_360.jpg"
}
,
{
"id": 13,
"contentCode": "1081",
"name": "8大闹天宫",
"desc": "大闹天宫是孙悟空的故事",
"url": "https://pic2.iqiyipic.com/image/20181120/84/ab/a_50392791_m_601_m3_260_360.jpg"
}
]
}

@ -92,7 +92,7 @@ public class ContentFragment extends BaseLazyLoadFragment {
Content.DataBean dataBean = dataBeans.get(i);
addItem(dataBean);
}
addFooter();
// addFooter();
mPbLoading.setVisibility(View.GONE);
mVerticalGridView.setVisibility(View.VISIBLE);
break;
@ -178,11 +178,16 @@ public class ContentFragment extends BaseLazyLoadFragment {
mVerticalGridView = mRootView.findViewById(R.id.hg_content);
mVerticalGridView.setTabView(mActivity.getHorizontalGridView());
mVerticalGridView.setGroup(mActivity.getGroup());
mVerticalGridView.setNumColumns(4);
mVerticalGridView.setVerticalSpacing(FontDisplayUtil.dip2px(mActivity, 24));
ContentPresenterSelector presenterSelector = new ContentPresenterSelector();
mAdapter = new ArrayObjectAdapter(presenterSelector);
mAdapter = new ArrayObjectAdapter(new TypeDoctorPresenter());
ItemBridgeAdapter itemBridgeAdapter = new ItemBridgeAdapter(mAdapter);
mVerticalGridView.setAdapter(itemBridgeAdapter);
@ -228,6 +233,7 @@ public class ContentFragment extends BaseLazyLoadFragment {
@Override
public void onSucceed(HttpData<ApiResponse<GetNearDoctorApi.DoctorInfo>> stringHttpData) {
LogUtils.e("成功:" + stringHttpData);
}
@Override
@ -378,21 +384,27 @@ public class ContentFragment extends BaseLazyLoadFragment {
break;
case Constants.TYPE_THREE://附近医生
ArrayObjectAdapter arrayObjectAdapterThree = new ArrayObjectAdapter(new TypeDoctorPresenter());
List<Content.DataBean.WidgetsBean> listThree = dataBean.getWidgets();
if (listThree == null) {
return;
}
if (listThree.size() > 4) {
listThree = listThree.subList(0, 4);
}
arrayObjectAdapterThree.addAll(0, listThree);
HeaderItem headerItemThree = null;
if (dataBean.getShowTitle()) {
headerItemThree = new HeaderItem(dataBean.getTitle());
}
ListRow listRowThree = new ListRow(headerItemThree, arrayObjectAdapterThree);
addWithTryCatch(listRowThree);
mAdapter.setItems(listThree,null);
// if (listThree.size() > 4) {
// listThree = listThree.subList(0, 4);
// }
// arrayObjectAdapterThree.addAll(0, listThree);
// HeaderItem headerItemThree = null;
// if (dataBean.getShowTitle()) {
// headerItemThree = new HeaderItem(dataBean.getTitle());
// }
// ListRow listRowThree = new ListRow(headerItemThree, arrayObjectAdapterThree);
// addWithTryCatch(listRowThree);
break;
case Constants.TYPE_FOUR:

Loading…
Cancel
Save