Search in sources :

Example 26 with FragmentTransaction

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

the class ColorPickerPreference method showFragment.

private void showFragment(Bundle state) {
    SettingsActivity sa = null;
    if (getContext() instanceof ContextThemeWrapper) {
        if (((ContextThemeWrapper) getContext()).getBaseContext() instanceof SettingsActivity) {
            sa = (SettingsActivity) ((ContextThemeWrapper) getContext()).getBaseContext();
        }
    }
    if (sa == null) {
        return;
    }
    Bundle arguments;
    if (state != null) {
        arguments = new Bundle(state);
    } else {
        SharedPreferences prefs = sa.getSharedPreferences("color_picker_fragment", Activity.MODE_PRIVATE);
        boolean showHelpScreen = prefs.getBoolean("show_help_screen", true);
        arguments = new Bundle();
        arguments.putInt("new_color", mValue);
        arguments.putInt("old_color", mValue);
        arguments.putBoolean("help_screen_visible", showHelpScreen);
    }
    arguments.putInt("initial_color", mValue);
    arguments.putInt("reset_color_1", mResetColor1);
    arguments.putInt("reset_color_2", mResetColor2);
    arguments.putCharSequence("reset_color_1_title", mResetColor1Title);
    arguments.putCharSequence("reset_color_2_title", mResetColor2Title);
    arguments.putBoolean("alpha_slider_visible", mAlphaSliderVisible);
    mPickerFragment = new ColorPickerFragment();
    mPickerFragment.setArguments(arguments);
    mPickerFragment.setOnColorChangedListener(this);
    FragmentTransaction transaction = sa.getFragmentManager().beginTransaction();
    transaction.replace(R.id.main_content, mPickerFragment);
    transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    transaction.addToBackStack(":settings:prefs");
    transaction.setBreadCrumbTitle(R.string.color_picker_fragment_title);
    transaction.commitAllowingStateLoss();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) ContextThemeWrapper(android.view.ContextThemeWrapper) SharedPreferences(android.content.SharedPreferences) Bundle(android.os.Bundle) ColorPickerFragment(net.margaritov.preference.colorpicker.fragment.ColorPickerFragment) SettingsActivity(com.android.settings.SettingsActivity)

Example 27 with FragmentTransaction

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

the class BackgroundCheckSummary method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;
    View rootView = mInflater.inflate(R.layout.background_check_summary, container, false);
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
    }
    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE, true), "appops");
    ft.commitAllowingStateLoss();
    return rootView;
}
Also used : FragmentTransaction(android.app.FragmentTransaction) PreferenceFrameLayout(android.preference.PreferenceFrameLayout) View(android.view.View)

Example 28 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 29 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 30 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)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)419 Fragment (android.app.Fragment)125 FragmentManager (android.app.FragmentManager)120 Bundle (android.os.Bundle)56 Test (org.junit.Test)36 FragmentActivity (android.support.v4.app.FragmentActivity)27 Intent (android.content.Intent)25 DialogFragment (android.app.DialogFragment)22 View (android.view.View)20 PreferenceFragment (android.support.v14.preference.PreferenceFragment)13 TextView (android.widget.TextView)12 MapCalibrationFragment (com.peterlaurence.trekadvisor.menu.mapcalibration.MapCalibrationFragment)8 MapImportFragment (com.peterlaurence.trekadvisor.menu.mapimport.MapImportFragment)8 MapListFragment (com.peterlaurence.trekadvisor.menu.maplist.MapListFragment)8 MapSettingsFragment (com.peterlaurence.trekadvisor.menu.maplist.MapSettingsFragment)8 MapViewFragment (com.peterlaurence.trekadvisor.menu.mapview.MapViewFragment)8 MarkerManageFragment (com.peterlaurence.trekadvisor.menu.mapview.components.markermanage.MarkerManageFragment)8 TracksManageFragment (com.peterlaurence.trekadvisor.menu.mapview.components.tracksmanage.TracksManageFragment)8 RecordFragment (com.peterlaurence.trekadvisor.menu.record.RecordFragment)8 Uri (android.net.Uri)7