Exemple #1
0
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    if (intent == null) return;

    String action = intent.getAction();

    MenuBean menuBean = MenuGenerator.generateMenu(getActionType(intent, action));

    lastSelectedMenu = menuBean;

    onMenuSelected(menuBean, true, null);

    if ("1".equals(menuBean.getType())) {
      menuFragment.setAccountItem();
      menuFragment.setSelectedMenu(menuBean);
    }

    if (isDrawerOpened()) closeDrawer();
  }
Exemple #2
0
  public boolean onMenuSelected(MenuBean menu, boolean replace, View view) {
    if (!replace && lastSelectedMenu != null && lastSelectedMenu.getType().equals(menu.getType())) {
      closeDrawer();
      return true;
    }

    int type = Integer.parseInt(menu.getType());

    ABaseFragment fragment = null;
    if (mStripView != null) mStripView.clearAnimation();
    mStripView = null;
    if (animatorSet != null) {
      animatorSet.removeAllListeners();
      animatorSet.end();
      animatorSet = null;
    }
    mToolbar.setTranslationY(0);

    switch (type) {
        // 微博首页
      case 1:
        fragment = TimelineTabsFragment.newInstance();
        break;
        // 提及
      case 2:
        fragment = MentionTabsFragment.newInstance();
        break;
        // 评论
      case 3:
        fragment = CommentTabsFragment.newInstance();
        break;
        // 朋友关系
      case 4:
        fragment = FriendshipTabsFragment.newInstance();
        break;
        // 设置
      case 5:
        closeDrawer();

        SettingsPagerFragment.launch(this);
        return true;
        // 草稿箱
      case 6:
        fragment = DraftFragment.newInstance();
        break;
        // 私信
      case 10:
        new DMAction(this).run();
        return true;
        // 热门微博
      case 11:
        WeiboClientActivity.launchHotStatuses(this);

        closeDrawer();
        return true;
    }

    if (fragment == null) return true;

    getSupportActionBar().setSubtitle(null);
    getSupportActionBar().setTitle(menu.getTitleRes());

    FragmentTransaction ft = getFragmentManager().beginTransaction();
    //		ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out,
    //									android.R.animator.fade_in, android.R.animator.fade_out);
    ft.replace(R.id.content_frame, fragment, FRAGMENT_TAG).commit();

    lastSelectedMenu = menu;
    menuFragment.setSelectedMenu(menu);

    setFabType();

    return false;
  }