use of android.app.FragmentManager in project kcanotify by antest1.
the class SettingActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(getString(R.string.action_settings));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
silentText = getString(R.string.settings_string_silent);
FragmentManager fm = getFragmentManager();
fm.beginTransaction().replace(R.id.fragment_container, new PrefsFragment()).commit();
}
use of android.app.FragmentManager in project WordPress-Android by wordpress-mobile.
the class CommentsActivity method onCommentSelected.
/*
* called from comment list when user taps a comment
*/
@Override
public void onCommentSelected(long commentId) {
FragmentManager fm = getFragmentManager();
if (fm == null) {
return;
}
mComment = mCommentStore.getCommentBySiteAndRemoteId(mSite, commentId);
fm.executePendingTransactions();
CommentsListFragment listFragment = getListFragment();
FragmentTransaction ft = fm.beginTransaction();
String tagForFragment = getString(R.string.fragment_tag_comment_detail);
CommentDetailFragment detailFragment = CommentDetailFragment.newInstance(mSite, mComment);
ft.add(R.id.layout_fragment_container, detailFragment, tagForFragment).addToBackStack(tagForFragment).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
if (listFragment != null) {
ft.hide(listFragment);
}
ft.commitAllowingStateLoss();
}
use of android.app.FragmentManager in project WordPress-Android by wordpress-mobile.
the class CommentsActivity method onModerateComment.
@Override
public void onModerateComment(final SiteModel site, final CommentModel comment, final CommentStatus newStatus) {
FragmentManager fm = getFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
}
if (newStatus == CommentStatus.APPROVED || newStatus == CommentStatus.UNAPPROVED) {
getListFragment().updateEmptyView();
comment.setStatus(newStatus.toString());
mDispatcher.dispatch(CommentActionBuilder.newUpdateCommentAction(comment));
mDispatcher.dispatch(CommentActionBuilder.newPushCommentAction(new RemoteCommentPayload(mSite, comment)));
} else if (newStatus == CommentStatus.SPAM || newStatus == CommentStatus.TRASH || newStatus == CommentStatus.DELETED) {
mTrashedComments.add(comment);
getListFragment().removeComment(comment);
String message = (newStatus == CommentStatus.TRASH ? getString(R.string.comment_trashed) : newStatus == CommentStatus.SPAM ? getString(R.string.comment_spammed) : getString(R.string.comment_deleted_permanently));
View.OnClickListener undoListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
mTrashedComments.remove(comment);
getListFragment().loadComments();
}
};
Snackbar snackbar = Snackbar.make(getListFragment().getView(), message, Snackbar.LENGTH_LONG).setAction(R.string.undo, undoListener);
// do the actual moderation once the undo bar has been hidden
snackbar.setCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
// comment will no longer exist in moderating list if action was undone
if (!mTrashedComments.contains(comment)) {
return;
}
mTrashedComments.remove(comment);
moderateComment(comment, newStatus);
}
});
snackbar.show();
}
}
use of android.app.FragmentManager in project WordPress-Android by wordpress-mobile.
the class CommentDetailFragment method addDetailFragment.
private void addDetailFragment(String noteId) {
// Now we'll add a detail fragment list
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
mNotificationsDetailListFragment = NotificationsDetailListFragment.newInstance(noteId);
mNotificationsDetailListFragment.setFooterView(mLayoutButtons);
fragmentTransaction.replace(mCommentContentLayout.getId(), mNotificationsDetailListFragment);
fragmentTransaction.commitAllowingStateLoss();
}
use of android.app.FragmentManager in project WordPress-Android by wordpress-mobile.
the class PeopleManagementActivity method navigateBackToPeopleListFragment.
private boolean navigateBackToPeopleListFragment() {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.people);
}
return true;
}
return false;
}
Aggregations