@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);
  }
Exemplo n.º 5
0
 @Override
 public void onHiddenChanged(boolean hidden) {
   super.onHiddenChanged(hidden);
   if (!hidden) {
     buildActionBarNav();
     //            ((MainTimeLineActivity) getActivity()).setCurrentFragment(this);
   }
 }
Exemplo n.º 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);
  }
Exemplo n.º 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);
  }
Exemplo n.º 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);
   }
 }
Exemplo n.º 10
0
 @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;
       }
     }
   }
 }
Exemplo n.º 11
0
 @Override
 protected void newMsgOnPostExecute(ListBean<MessageBean> newValue) {
   showNewMsgToastMessage(newValue);
   super.newMsgOnPostExecute(newValue);
 }
Exemplo n.º 12
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   Utility.cancelTasks(dbTask);
   GlobalContext.getInstance().unRegisterForAccountChangeListener(this);
 }
Exemplo n.º 13
0
 @Override
 protected void onListViewScrollStateFling() {
   super.onListViewScrollStateFling();
   stopDownloadingOtherPicturesOnWifiNetworkEnvironment();
 }
Exemplo n.º 14
0
 @Override
 protected void afterGetNewMsg() {
   super.afterGetNewMsg();
   getActivity().getActionBar().getTabAt(0).setText(getString(R.string.home));
   clearAndReplaceValue(selectedId, bean);
 }
Exemplo n.º 15
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
 }
Exemplo n.º 16
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.actionbar_menu_friendstimelinefragment, menu);
 }
Exemplo n.º 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);
  }
Exemplo n.º 18
0
 @Override
 public void onPause() {
   super.onPause();
   removeRefresh();
   if (autoRefreshTask != null) autoRefreshTask.cancel(true);
 }
Exemplo n.º 19
0
 @Override
 public void onResume() {
   super.onResume();
   addRefresh();
 }
Exemplo n.º 20
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setRetainInstance(true);
   setHasOptionsMenu(true);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   Utility.cancelTasks(dbTask);
 }