Search in sources :

Example 16 with FragmentManager

use of android.app.FragmentManager in project cardslib by gabrielemariotti.

the class MainActivity method openDialogFragment.

private void openDialogFragment(DialogFragment dialogStandardFragment) {
    if (dialogStandardFragment != null) {
        FragmentManager fm = getFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Fragment prev = fm.findFragmentByTag("carddemo_dialog");
        if (prev != null) {
            ft.remove(prev);
        }
        //ft.addToBackStack(null);
        dialogStandardFragment.show(ft, "carddemo_dialog");
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) BaseFragment(it.gmariotti.cardslib.demo.fragment.BaseFragment) ThumbnailFragment(it.gmariotti.cardslib.demo.fragment.v1.ThumbnailFragment) GridBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.GridBaseFragment) ListGplayCursorCardCABFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCursorCardCABFragment) GridGplayCABFragment(it.gmariotti.cardslib.demo.fragment.v1.GridGplayCABFragment) ListSectionedCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListSectionedCardFragment) BirthDayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.BirthDayCardFragment) GridGplayFragment(it.gmariotti.cardslib.demo.fragment.v1.GridGplayFragment) DismissAnimFragment(it.gmariotti.cardslib.demo.fragment.v1.DismissAnimFragment) ShadowFragment(it.gmariotti.cardslib.demo.fragment.v1.ShadowFragment) ListCursorCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListCursorCardFragment) ListColorFragment(it.gmariotti.cardslib.demo.fragment.v1.ListColorFragment) ListDifferentInnerBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.ListDifferentInnerBaseFragment) GPlayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.GPlayCardFragment) ListGplayCardCABFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCardCABFragment) CardFragment(it.gmariotti.cardslib.demo.fragment.v1.CardFragment) StockCardFragment(it.gmariotti.cardslib.demo.fragment.v1.StockCardFragment) ListGplayUndoCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayUndoCardFragment) GridCursorCardFragment(it.gmariotti.cardslib.demo.fragment.v1.GridCursorCardFragment) CardExpandFragment(it.gmariotti.cardslib.demo.fragment.v1.CardExpandFragment) CardWithListFragment(it.gmariotti.cardslib.demo.fragment.v1.CardWithListFragment) DialogFragment(android.app.DialogFragment) ListBaseFragment(it.gmariotti.cardslib.demo.fragment.v1.ListBaseFragment) Fragment(android.app.Fragment) MiscCardFragment(it.gmariotti.cardslib.demo.fragment.v1.MiscCardFragment) ListExpandCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListExpandCardFragment) ListGplayCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ListGplayCardFragment) ChangeValueCardFragment(it.gmariotti.cardslib.demo.fragment.v1.ChangeValueCardFragment) HeaderFragment(it.gmariotti.cardslib.demo.fragment.v1.HeaderFragment)

Example 17 with FragmentManager

use of android.app.FragmentManager in project cardslib by gabrielemariotti.

the class MainActivity method openFragment.

private void openFragment(BaseFragment baseFragment) {
    if (baseFragment != null) {
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.fragment_main, baseFragment);
        //fragmentTransaction.addToBackStack(null);
        fragmentTransaction.commit();
        if (baseFragment.getTitleResourceId() > 0)
            mCurrentTitle = baseFragment.getTitleResourceId();
    }
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction)

Example 18 with FragmentManager

use of android.app.FragmentManager in project cardslib by gabrielemariotti.

the class MainNativeActivity method onCreate.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.demo_activity_main);
    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    _initMenu();
    mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer);
    mDrawer.setDrawerListener(mDrawerToggle);
    // ---------------------------------------------------------------
    // ...
    String base64EncodedPublicKey = IabUtil.key;
    // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, base64EncodedPublicKey);
    mHelper.enableDebugLogging(true);
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {

        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d(TAG, "Problem setting up In-app Billing: " + result);
                return;
            }
            // Have we been disposed of in the meantime? If so, quit.
            if (mHelper == null)
                return;
            // Hooray, IAB is fully set up!
            IabUtil.getInstance().retrieveData(mHelper);
        }
    });
    //BaseFragment baseFragment = null;
    if (savedInstanceState != null) {
        mSelectedFragment = savedInstanceState.getInt(BUNDLE_SELECTEDFRAGMENT);
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        if (fragmentManager.findFragmentById(R.id.fragment_main) == null)
            mBaseFragment = selectFragment(mSelectedFragment);
    //if (mBaseFragment==null)
    //    mBaseFragment = selectFragment(mSelectedFragment);
    } else {
        mBaseFragment = new TodoNativeCardFragment();
        openFragment(mBaseFragment);
    }
//-----------------------------------------------------------------
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) IabResult(it.gmariotti.cardslib.demo.iabutils.IabResult) IabHelper(it.gmariotti.cardslib.demo.iabutils.IabHelper) TodoNativeCardFragment(it.gmariotti.cardslib.demo.fragment.nativeview.TodoNativeCardFragment)

Example 19 with FragmentManager

use of android.app.FragmentManager in project cardslib by gabrielemariotti.

the class IabUtil method showBeer.

public static void showBeer(Activity activity, IabHelper helper) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_purchase");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    new PurchaseDialog(helper).show(ft, "dialog_purchase");
}
Also used : FragmentManager(android.app.FragmentManager) FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment) DialogFragment(android.app.DialogFragment)

Example 20 with FragmentManager

use of android.app.FragmentManager in project WeChatLuckyMoney by geeeeeeeeek.

the class SettingsActivity method prepareSettings.

private void prepareSettings() {
    String title, fragId;
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        title = bundle.getString("title");
        fragId = bundle.getString("frag_id");
    } else {
        title = getString(R.string.preference);
        fragId = "GeneralSettingsFragment";
    }
    TextView textView = (TextView) findViewById(R.id.settings_bar);
    textView.setText(title);
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if ("GeneralSettingsFragment".equals(fragId)) {
        fragmentTransaction.replace(R.id.preferences_fragment, new GeneralSettingsFragment());
    } else if ("CommentSettingsFragment".equals(fragId)) {
        fragmentTransaction.replace(R.id.preferences_fragment, new CommentSettingsFragment());
    }
    fragmentTransaction.commit();
}
Also used : FragmentManager(android.app.FragmentManager) GeneralSettingsFragment(xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment) CommentSettingsFragment(xyz.monkeytong.hongbao.fragments.CommentSettingsFragment) FragmentTransaction(android.app.FragmentTransaction) Bundle(android.os.Bundle) TextView(android.widget.TextView)

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