private void init() { mySpanableSet = new MySpanableSet(this); viewPagerAdapter = new ViewPagerAdapter(viewList); viewPagerAdapter.setTabContent(tabContent); viewPager.setAdapter(viewPagerAdapter); viewPager.setOnPageChangeListener(this); noticeAdapter = new NoticeListAdapter(MessageCenter.this, noticeData); noticeListView.setAdapter(noticeAdapter); messageAdapter = new UserMessageAdapter(MessageCenter.this, titleData, messageData); messageListView.setAdapter(messageAdapter); messageListView.setGroupIndicator(null); messageListView.setChildIndicator(null); messageListView.setOnGroupClickListener( new OnGroupClickListener() { @Override public boolean onGroupClick( ExpandableListView parent, View v, int groupPosition, long id) { UserMessageData message = (UserMessageData) parent.getExpandableListAdapter().getGroup(groupPosition); if (message.getIsRead() == false) { titleData.get(groupPosition).setIsRead(true); messageAdapter.notifyDataSetChanged(); SendMessageReadTask messageIsRead = new SendMessageReadTask(); messageIsRead.execute(message.getId()); appState.setMessageNumber(appState.getMessageNumber() - 1); if (appState.getMessageNumber() <= 0) { OperateInfUtils.broadcast(MessageCenter.this, "invalidate_notice"); } } return false; } }); topMenuLayout.setTopMenuItemContent(tabContent); topMenuLayout.check(selectedIndex); loadData(); }
private void showFail() { if (selectedIndex == SYSTEM_NOTICE) { if (noticeData.size() == 0) { noticeListView.setVisibility(View.GONE); layoutEmptyNotice.setVisibility(View.VISIBLE); layoutEmptyNotice.showFailPage(); } else { ViewUtil.showTipsToast(this, failTips); noticeListView.showFootText(); } } else if (selectedIndex == USER_MESSAGE) { if (titleData.size() == 0) { messageListView.setVisibility(View.GONE); layoutEmptyMessage.setVisibility(View.VISIBLE); layoutEmptyMessage.showFailPage(); } else { ViewUtil.showTipsToast(this, failTips); messageListView.showFootText(); } } }
private void setupMessageViews() { LayoutInflater inflater = getLayoutInflater(); View viewMessage = inflater.inflate(R.layout.include_new_viewpager_expandable_listview, null); messageListView = (AutoLoadExpandableListView) viewMessage.findViewById(R.id.expandable_listview); messageListView.setOnLoadDataListener(this); layoutEmptyMessage = (EmptyLayout) viewMessage.findViewById(R.id.empty_layout); layoutEmptyMessage.setOnGetDataAgainListener(this); viewRefreshMessage = (RefreshLayout) viewMessage.findViewById(R.id.pull_refresh_view); viewRefreshMessage.setOnHeaderRefreshListener(this); viewList.add(viewMessage); }
private void showNoData() { if (selectedIndex == SYSTEM_NOTICE) { if (noticeData.size() == 0) { layoutEmptyNotice.setVisibility(View.VISIBLE); layoutEmptyNotice.showNoDataPage(NO_NOTICE_DATA); noticeListView.setVisibility(View.GONE); } } else if (selectedIndex == USER_MESSAGE) { if (titleData.size() == 0) { layoutEmptyMessage.setVisibility(View.VISIBLE); layoutEmptyMessage.showNoDataPage(NO_MESSAGE_DATA); messageListView.setVisibility(View.GONE); } } }
private void showNetWorkErrorPage() { if (selectedIndex == SYSTEM_NOTICE) { if (noticeData.size() == 0) { layoutEmptyMessage.setVisibility(View.VISIBLE); layoutEmptyNotice.showNetErrorPage(); } else { ViewUtil.showTipsToast(this, noNetTips); noticeListView.showFootText(); } } else if (selectedIndex == USER_MESSAGE) { if (messageData.size() == 0) { layoutEmptyMessage.setVisibility(View.VISIBLE); layoutEmptyMessage.showNetErrorPage(); } else { ViewUtil.showTipsToast(this, noNetTips); messageListView.showFootText(); } } }