Beispiel #1
0
  @Override
  public void onPageSelected(int index) {
    topMenuLayout.check(index);

    selectedIndex = index;
    if ((index == SYSTEM_NOTICE && noticeData.size() == 0)
        || (index == USER_MESSAGE && titleData.size() == 0)) {
      loadData();
    }
  }
Beispiel #2
0
  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();
  }
Beispiel #3
0
 @Override
 protected void onResume() {
   super.onResume();
   if (toLogin) {
     toLogin = false;
     if (((LotteryApp) getApplication()).getUsername() != null) {
       selectedIndex = USER_MESSAGE;
       if (titleData.size() != 0) {
         viewRefreshMessage.headerRefreshing();
       }
       onRefresh();
     } else {
       topMenuLayout.check(SYSTEM_NOTICE);
     }
   }
 }
Beispiel #4
0
 private void setupMainViews() {
   topMenuLayout = (TopMenuLayout) this.findViewById(R.id.top_menu_layout);
   topMenuLayout.setTabSelectedListener(this);
   viewPager = (ViewPager) this.findViewById(R.id.view_pager);
 }