@Override
  public void onActivityCreated(Bundle savedInstanceState) {

    if (savedInstanceState != null) {
      userBean = (UserBean) savedInstanceState.getSerializable("userBean");
      accountBean = (AccountBean) savedInstanceState.getSerializable("account");
      token = savedInstanceState.getString("token");

      hashMap = (HashMap) savedInstanceState.getSerializable("hashmap");
      selectedId = savedInstanceState.getString("selectedId");

      clearAndReplaceValue((MessageListBean) savedInstanceState.getSerializable("bean"));
      timeLineAdapter.notifyDataSetChanged();

      refreshLayout(bean);
    } else {
      if (dbTask == null || dbTask.getStatus() == MyAsyncTask.Status.FINISHED) {
        dbTask = new DBCacheTask();
        dbTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
      }

      hashMap.put("0", new MessageListBean());
      hashMap.put("1", new MessageListBean());
    }

    super.onActivityCreated(savedInstanceState);

    groupTask = new GroupTask();
    groupTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {

    commander = ((AbstractAppActivity) getActivity()).getBitmapDownloader();

    switch (getCurrentState(savedInstanceState)) {
      case FIRST_TIME_START:
        if (Utility.isTaskStopped(dbTask)) {
          dbTask = new DBCacheTask();
          dbTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        }
        break;
      case SCREEN_ROTATE:
        // nothing
        refreshLayout(getList());
        break;
      case ACTIVITY_DESTROY_AND_CREATE:
        getList().addNewData((MessageListBean) savedInstanceState.getSerializable("bean"));
        userBean = (UserBean) savedInstanceState.getSerializable("userBean");
        token = savedInstanceState.getString("token");
        getAdapter().notifyDataSetChanged();
        refreshLayout(bean);
        break;
    }

    super.onActivityCreated(savedInstanceState);
  }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putSerializable("bean", bean);
   outState.putSerializable("userBean", userBean);
   outState.putString("token", token);
 }
  @Override
  public void onDetach() {
    super.onDetach();

    if (dbTask != null) dbTask.cancel(true);

    if (groupTask != null) groupTask.cancel(true);
  }
Пример #5
0
 @Override
 public void onHiddenChanged(boolean hidden) {
   super.onHiddenChanged(hidden);
   if (!hidden) {
     buildActionBarNav();
     //            ((MainTimeLineActivity) getActivity()).setCurrentFragment(this);
   }
 }
Пример #6
0
 @Override
 public void onPause() {
   super.onPause();
   if (!getActivity().isChangingConfigurations()) {
     savePositionToDB();
     saveGroupIdToDB();
   }
   removeRefresh();
   stopDownloadingOtherPicturesOnWifiNetworkEnvironment();
 }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putSerializable("account", accountBean);
    outState.putSerializable("bean", bean);
    outState.putSerializable("userBean", userBean);
    outState.putString("token", token);

    outState.putSerializable("hashmap", hashMap);
    outState.putString("selectedId", selectedId);
  }
Пример #8
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable("account", accountBean);
    outState.putParcelable("userBean", userBean);
    outState.putString("token", token);

    //        outState.putSerializable("bean", getList());
    //        outState.putSerializable("groupDataCache", groupDataCache);
    //        outState.putString("currentGroupId", currentGroupId);
  }
Пример #9
0
 @Override
 public void onResume() {
   super.onResume();
   addRefresh();
   GlobalContext.getInstance().registerForAccountChangeListener(this);
   if (SettingUtility.getEnableAutoRefresh()) {
     this.newMsgTipBar.setType(TopTipBar.Type.ALWAYS);
   } else {
     this.newMsgTipBar.setType(TopTipBar.Type.AUTO);
   }
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.actionbar_menu_friendstimelinefragment, menu);
   name = menu.findItem(R.id.group_name);
   if (selectedId.equals("0")) {
     name.setTitle(userBean.getScreen_name());
   }
   if (selectedId.equals("1")) {
     name.setTitle(getString(R.string.bilateral));
   } else {
     for (GroupBean b : GlobalContext.getInstance().getGroup().getLists()) {
       if (b.getIdstr().equals(selectedId)) {
         name.setTitle(b.getName());
         return;
       }
     }
   }
 }
 @Override
 protected void newMsgOnPostExecute(ListBean<MessageBean> newValue) {
   showNewMsgToastMessage(newValue);
   super.newMsgOnPostExecute(newValue);
 }
Пример #12
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   Utility.cancelTasks(dbTask);
   GlobalContext.getInstance().unRegisterForAccountChangeListener(this);
 }
Пример #13
0
 @Override
 protected void onListViewScrollStateFling() {
   super.onListViewScrollStateFling();
   stopDownloadingOtherPicturesOnWifiNetworkEnvironment();
 }
 @Override
 protected void afterGetNewMsg() {
   super.afterGetNewMsg();
   getActivity().getActionBar().getTabAt(0).setText(getString(R.string.home));
   clearAndReplaceValue(selectedId, bean);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
 }
Пример #16
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.actionbar_menu_friendstimelinefragment, menu);
 }
Пример #17
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {

    switch (getCurrentState(savedInstanceState)) {
      case FIRST_TIME_START:
        if (Utility.isTaskStopped(dbTask) && getList().getSize() == 0) {
          dbTask = new DBCacheTask(this, accountBean.getUid());
          dbTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
          GroupInfoTask groupInfoTask =
              new GroupInfoTask(
                  GlobalContext.getInstance().getSpecialToken(),
                  GlobalContext.getInstance().getCurrentAccountId());
          groupInfoTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        } else {
          getAdapter().notifyDataSetChanged();
          refreshLayout(getList());
        }

        groupDataCache.put(ALL_GROUP_ID, new MessageListBean());
        groupDataCache.put(BILATERAL_GROUP_ID, new MessageListBean());

        if (getList().getSize() > 0) {
          groupDataCache.put(ALL_GROUP_ID, getList().copy());
        }
        buildActionBarNav();

        break;
      case SCREEN_ROTATE:
        // nothing
        refreshLayout(getList());
        buildActionBarNav();
        setListViewPositionFromPositionsCache();
        break;
      case ACTIVITY_DESTROY_AND_CREATE:
        userBean = savedInstanceState.getParcelable("userBean");
        accountBean = savedInstanceState.getParcelable("account");
        token = savedInstanceState.getString("token");

        if (Utility.isTaskStopped(dbTask) && getList().getSize() == 0) {
          dbTask = new DBCacheTask(this, accountBean.getUid());
          dbTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
          GroupInfoTask groupInfoTask =
              new GroupInfoTask(
                  GlobalContext.getInstance().getSpecialToken(),
                  GlobalContext.getInstance().getCurrentAccountId());
          groupInfoTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        } else {
          getAdapter().notifyDataSetChanged();
          refreshLayout(getList());
        }

        groupDataCache.put(ALL_GROUP_ID, new MessageListBean());
        groupDataCache.put(BILATERAL_GROUP_ID, new MessageListBean());

        if (getList().getSize() > 0) {
          groupDataCache.put(ALL_GROUP_ID, getList().copy());
        }
        buildActionBarNav();

        break;
    }

    super.onActivityCreated(savedInstanceState);
  }
 @Override
 public void onPause() {
   super.onPause();
   removeRefresh();
   if (autoRefreshTask != null) autoRefreshTask.cancel(true);
 }
 @Override
 public void onResume() {
   super.onResume();
   addRefresh();
 }
Пример #20
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setRetainInstance(true);
   setHasOptionsMenu(true);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   Utility.cancelTasks(dbTask);
 }