Esempio n. 1
0
 /** �����ϸ��� */
 public void refreshFromWeb() {
   if (!isLoadingData) {
     isLoadingData = true;
     mManageAdapter.loadDataFromWeb();
   }
 }
Esempio n. 2
0
 /** ���»���� */
 public void refreshEvents() {
   mManageAdapter.loadDataByFilter(4);
 }
Esempio n. 3
0
  @Override
  protected View initView(LayoutInflater inflater, ViewGroup container) {
    //		super.initView(inflater,container);
    mView = inflater.inflate(R.layout.fragment_tab_home, container, false);
    plvManage = (PullToRefreshListView) mView.findViewById(R.id.plvEvents);
    plvManage.setOnRefreshListener(
        new OnRefreshListener<ListView>() {
          @Override
          public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            //				System.err.println("onRefresh   isLoadingData  "+isLoadingData+"
            // isNeedCloseOnRefreshing:"+isNeedCloseOnRefreshing);
            if (isNeedCloseOnRefreshing) {
              final Handler hand =
                  new Handler() {
                    @Override
                    public void handleMessage(Message msg) {
                      plvManage.onRefreshComplete();
                      isNeedCloseOnRefreshing = false;
                      super.handleMessage(msg);
                    }
                  };
              hand.postDelayed(
                  new Runnable() {
                    @Override
                    public void run() {
                      hand.sendEmptyMessage(1);
                    }
                  },
                  100);
              return;
            }
            if (!isLoadingData) {
              refreshFromWeb();
            }
          }
        });
    mManageAdapter = new SocialEventUpdatesAdapter(getActivity(), plvManage);
    plvManage.setAdapter(mManageAdapter);
    mManageAdapter.setCompletedListener(
        new LoadDataCompletedListener() {
          @Override
          public void onCompleted() {
            isNeedCloseOnRefreshing = !MainHomeFragment.this.isResumed();
            isLoadingData = false;
            //				System.err.println("------------setCompletedListener  onCompleted isResumed:
            // "+MainHomeFragment.this.isResumed());
            //				autoLoadDataFromWeb();
          }

          @Override
          public void dateChange() {
            refreshEvents();
          }
        });
    IntentFilter intentFilter = new IntentFilter(FDConstant.NEW_GROUP_MESSAGE_ACTION);
    getActivity().registerReceiver(updatesGroupMsgReceiver, intentFilter);
    initSearchComponent();
    initCreateComponent();
    initScheduleButton();
    initImageLoader(getActivity());
    initSchdule();
    refreshEvents();
    return mView;
  }