Search in sources :

Example 71 with FragmentTransaction

use of android.app.FragmentTransaction in project android_frameworks_base by ResurrectionRemix.

the class BiDiTestActivity method onListItemClick.

private void onListItemClick(ListView lv, View v, int position, long id) {
    // Show the test
    Map<String, Object> map = (Map<String, Object>) lv.getItemAtPosition(position);
    int fragmentId = (Integer) map.get(KEY_FRAGMENT_ID);
    Fragment fragment = getFragmentManager().findFragmentById(fragmentId);
    if (fragment == null) {
        try {
            // Create an instance of the test
            Class<? extends Fragment> clazz = (Class<? extends Fragment>) map.get(KEY_CLASS);
            fragment = clazz.newInstance();
            // Replace the old test fragment with the new one
            FragmentTransaction ft = getFragmentManager().beginTransaction();
            ft.replace(R.id.testframe, fragment);
            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            ft.commit();
        } catch (InstantiationException e) {
        } catch (IllegalAccessException e) {
        }
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) HashMap(java.util.HashMap) Map(java.util.Map) Fragment(android.app.Fragment)

Example 72 with FragmentTransaction

use of android.app.FragmentTransaction in project android_frameworks_base by ResurrectionRemix.

the class WindowDecorActionBar method selectTab.

@Override
public void selectTab(Tab tab) {
    if (getNavigationMode() != NAVIGATION_MODE_TABS) {
        mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
        return;
    }
    final FragmentTransaction trans = mDecorToolbar.getViewGroup().isInEditMode() ? null : mActivity.getFragmentManager().beginTransaction().disallowAddToBackStack();
    if (mSelectedTab == tab) {
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
            mTabScrollView.animateToTab(tab.getPosition());
        }
    } else {
        mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
        }
        mSelectedTab = (TabImpl) tab;
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
        }
    }
    if (trans != null && !trans.isEmpty()) {
        trans.commit();
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction)

Example 73 with FragmentTransaction

use of android.app.FragmentTransaction in project android_frameworks_base by ResurrectionRemix.

the class OperationDialogFragment method show.

public static void show(FragmentManager fm, @DialogType int dialogType, ArrayList<DocumentInfo> failedSrcList, DocumentStack dstStack, @OpType int operationType) {
    final Bundle args = new Bundle();
    args.putInt(FileOperationService.EXTRA_DIALOG_TYPE, dialogType);
    args.putInt(FileOperationService.EXTRA_OPERATION, operationType);
    args.putParcelableArrayList(FileOperationService.EXTRA_SRC_LIST, failedSrcList);
    final FragmentTransaction ft = fm.beginTransaction();
    final OperationDialogFragment fragment = new OperationDialogFragment();
    fragment.setArguments(args);
    ft.add(fragment, TAG);
    ft.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Bundle(android.os.Bundle)

Example 74 with FragmentTransaction

use of android.app.FragmentTransaction in project android_frameworks_base by ResurrectionRemix.

the class PickFragment method show.

public static void show(FragmentManager fm) {
    // Fragment can be restored by FragmentManager automatically.
    if (get(fm) != null) {
        return;
    }
    final PickFragment fragment = new PickFragment();
    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.container_save, fragment, TAG);
    ft.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction)

Example 75 with FragmentTransaction

use of android.app.FragmentTransaction in project android_frameworks_base by ResurrectionRemix.

the class RecentsCreateFragment method show.

public static void show(FragmentManager fm) {
    final RecentsCreateFragment fragment = new RecentsCreateFragment();
    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.container_directory, fragment);
    ft.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)266 FragmentManager (android.app.FragmentManager)84 Fragment (android.app.Fragment)82 Bundle (android.os.Bundle)44 DialogFragment (android.app.DialogFragment)20 Intent (android.content.Intent)18 FragmentActivity (android.support.v4.app.FragmentActivity)16 PreferenceFragment (android.support.v14.preference.PreferenceFragment)7 HashMap (java.util.HashMap)7 View (android.view.View)6 File (java.io.File)6 SuppressLint (android.annotation.SuppressLint)5 Uri (android.net.Uri)5 StorageManager (android.os.storage.StorageManager)5 VolumeInfo (android.os.storage.VolumeInfo)5 Fade (android.transition.Fade)5 TextView (android.widget.TextView)5 Selection (com.android.documentsui.dirlist.MultiSelectManager.Selection)5 IOException (java.io.IOException)5 Map (java.util.Map)4