@Override public void clickOnImage(Integer i) { /* remove previous image. */ Fragment fragment = getSupportFragmentManager().findFragmentByTag("image"); if (fragment != null) { getSupportFragmentManager().beginTransaction().remove(fragment).commit(); } ContentFragment content = new ContentFragment(); content.setImageId(i); getSupportFragmentManager() .beginTransaction() .add(R.id.container_image, content, "image") .commit(); }
/** * Implementation for TitlesFragment.OnItemSelectedListener. When the TitlesFragment receives an * onclick event for a list item, it's passed back to this activity through this method so that we * can deliver it to the ContentFragment in the manner appropriate */ public void onItemSelected(int category, int position) { if (!mDualFragments) { // If showing only the TitlesFragment, start the ContentActivity and // pass it the info about the selected item Intent intent = new Intent(this, ContentActivity.class); intent.putExtra("category", category); intent.putExtra("position", position); intent.putExtra("theme", mThemeId); startActivity(intent); } else { // If showing both fragments, directly update the ContentFragment ContentFragment frag = (ContentFragment) getSupportFragmentManager().findFragmentById(R.id.content_frag); frag.updateContentAndRecycleBitmap(category, position); } }
@Override protected void onPause() { super.onPause(); sThreadShowing = 0; if (!mSlidingMenu.isMenuShowing()) { mContent.onContentClosed(); } }
@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); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); menu.clear(); if (mSlidingMenu.isMenuShowing() || mContent == null) { showBackButton(false); mConversationList.inflateToolbar(menu, inflater, this); } else { showBackButton(true); mContent.inflateToolbar(menu, inflater, this); } return super.onPrepareOptionsMenu(menu); }
@Override protected void onResume() { super.onResume(); if (!mSlidingMenu.isMenuShowing()) { mContent.onContentOpened(); } if (mContent != null && mContent instanceof MessageListFragment) { sThreadShowing = ((MessageListFragment) mContent).getThreadId(); QKReplyActivity.dismiss(sThreadShowing); } else { sThreadShowing = 0; } NotificationManager.initQuickCompose(this, false, false); }
@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); }
@Override public Fragment getItem(int PageNumber) { return ContentFragment.newInstance(PageNumber); }
private void loadScrollRevealFragment() { replaceFragment(ContentFragment.newInstance()); }
@Override public void onChanging(float percentOpen) { if (mContent != null) mContent.onMenuChanging(percentOpen); }
@Override public void onClosed() { // When the menu (i.e. the conversation list) has been closed, the content has been opened. // So notify the content fragment. if (mContent != null && ((Fragment) mContent).isAdded()) mContent.onContentOpened(); }
@Override public void onOpened() { // When the menu (i.e. the conversation list) has been opened, the content has been opened. // So notify the content fragment. if (mContent != null) mContent.onContentClosed(); }