Search in sources :

Example 56 with FragmentManager

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();
}
Also used : FragmentManager(android.app.FragmentManager)

Example 57 with FragmentManager

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();
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction)

Example 58 with FragmentManager

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();
    }
}
Also used : FragmentManager(android.app.FragmentManager) View(android.view.View) RemoteCommentPayload(org.wordpress.android.fluxc.store.CommentStore.RemoteCommentPayload) Snackbar(android.support.design.widget.Snackbar)

Example 59 with FragmentManager

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();
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction)

Example 60 with FragmentManager

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;
}
Also used : FragmentManager(android.app.FragmentManager) ActionBar(android.support.v7.app.ActionBar)

Aggregations

FragmentManager (android.app.FragmentManager)177 FragmentTransaction (android.app.FragmentTransaction)84 Fragment (android.app.Fragment)51 Bundle (android.os.Bundle)22 DocumentInfo (com.android.documentsui.model.DocumentInfo)20 DialogFragment (android.app.DialogFragment)15 RootInfo (com.android.documentsui.model.RootInfo)15 ActionBar (android.support.v7.app.ActionBar)12 Intent (android.content.Intent)11 File (java.io.File)6 MediaRouter (android.media.MediaRouter)5 Uri (android.net.Uri)5 StorageManager (android.os.storage.StorageManager)5 VolumeInfo (android.os.storage.VolumeInfo)5 MenuItem (android.view.MenuItem)5 IOException (java.io.IOException)5 Toolbar (android.support.v7.widget.Toolbar)4 View (android.view.View)4 DialogInterface (android.content.DialogInterface)3 ViewGroup (android.view.ViewGroup)3