示例#1
0
  @Override
  public void onOpen() {
    invalidateOptionsMenu();
    sThreadShowing = 0;

    // Notify the content that it is being closed, since the menu (i.e. conversation list) is being
    // opened.
    if (mContent != null) mContent.onContentClosing();

    // Hide the soft keyboard
    KeyboardUtils.hide(this, getCurrentFocus());

    showBackButton(false);
  }
示例#2
0
  @Override
  public void onClose() {
    invalidateOptionsMenu();

    // Notify the content that it is being opened, since the menu (i.e. conversation list) is being
    // closed.
    if (mContent != null) {
      mContent.onContentOpening();
    }

    if (mContent != null && mContent instanceof MessageListFragment) {
      sThreadShowing = ((MessageListFragment) mContent).getThreadId();
    } else {
      sThreadShowing = 0;
    }

    // Hide the soft keyboard
    KeyboardUtils.hide(this, getCurrentFocus());

    showBackButton(true);
  }
示例#3
0
  public void switchContent(ContentFragment fragment, boolean animate) {
    // Make sure that the activity isn't destroyed before making fragment transactions.
    if (fragment != null && !mIsDestroyed) {
      KeyboardUtils.hide(this);

      mContent = fragment;
      FragmentManager m = getFragmentManager();

      // Only do a replace if it is a different fragment.
      if (fragment != m.findFragmentById(R.id.content_frame)) {
        getFragmentManager()
            .beginTransaction()
            .replace(R.id.content_frame, (Fragment) fragment)
            .commitAllowingStateLoss();
      }

      mSlidingMenu.showContent(animate);
      invalidateOptionsMenu();

    } else {
      Log.w(TAG, "Null fragment, can't switch content");
    }
  }