Search in sources :

Example 1 with FragmentTransaction

use of android.app.FragmentTransaction in project UltimateAndroid by cymcsg.

the class DisplayItemAdapter method getView.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    String desc = getItem(position);
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.drive_image_view_item, parent, false);
    }
    String ftext = "photo number " + (position + 1) + " of " + MainFragment.samplePictures.length;
    DriveImageModel m = new DriveImageModel(desc, ftext, MainFragment.samplePictures[position]);
    DriveImageView view = (DriveImageView) convertView.findViewById(R.id.driveImageView);
    view.setDriveImageModel(m);
    view.setBackgroundColor(MainFragment.sampleColours[position]);
    view.setCustomFolderSpacing(100f);
    view.setAlphaValue(0.7f);
    view.setCustomHeight(MainFragment.sampleHeights[position]);
    view.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            DetailFragment detailFragment = DetailFragment.newInstance(position);
            fragmentTransaction.replace(R.id.fragment_container, detailFragment);
            fragmentTransaction.addToBackStack("detail");
            fragmentTransaction.commit();
        }
    });
    return convertView;
}
Also used : DriveImageModel(ch.haclyon.driveimageview.DriveImageModel) FragmentTransaction(android.app.FragmentTransaction) DriveImageView(ch.haclyon.driveimageview.DriveImageView) DetailFragment(com.marshalchen.common.demoofui.driveimageview.fragments.DetailFragment) View(android.view.View) DriveImageView(ch.haclyon.driveimageview.DriveImageView)

Example 2 with FragmentTransaction

use of android.app.FragmentTransaction in project UltimateAndroid by cymcsg.

the class DriveImageViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.drive_image_view_activity_main_fragment);
    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
    MainFragment mainFragment = new MainFragment();
    fragmentTransaction.replace(R.id.fragment_container, mainFragment);
    fragmentTransaction.commit();
//        getActionBar().setDisplayHomeAsUpEnabled(false);
}
Also used : FragmentTransaction(android.app.FragmentTransaction) MainFragment(com.marshalchen.common.demoofui.driveimageview.fragments.MainFragment)

Example 3 with FragmentTransaction

use of android.app.FragmentTransaction in project jmonkeyengine by jMonkeyEngine.

the class TestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);
    fragment = new JmeFragment();
    // Supply index input as an argument.
    Bundle args = new Bundle();
    Bundle bundle = savedInstanceState;
    if (bundle == null) {
        bundle = getIntent().getExtras();
    }
    String appClass = bundle.getString(MainActivity.SELECTED_APP_CLASS);
    args.putString(MainActivity.SELECTED_APP_CLASS, appClass);
    //        Log.d(TestActivity.class.getSimpleName(), "AppClass="+appClass);
    boolean mouseEnabled = bundle.getBoolean(MainActivity.ENABLE_MOUSE_EVENTS, true);
    args.putBoolean(MainActivity.ENABLE_MOUSE_EVENTS, mouseEnabled);
    //        Log.d(TestActivity.class.getSimpleName(), "MouseEnabled="+mouseEnabled);
    boolean joystickEnabled = bundle.getBoolean(MainActivity.ENABLE_JOYSTICK_EVENTS, true);
    args.putBoolean(MainActivity.ENABLE_JOYSTICK_EVENTS, joystickEnabled);
    //        Log.d(TestActivity.class.getSimpleName(), "JoystickEnabled="+joystickEnabled);
    boolean keyEnabled = bundle.getBoolean(MainActivity.ENABLE_KEY_EVENTS, true);
    args.putBoolean(MainActivity.ENABLE_KEY_EVENTS, keyEnabled);
    //        Log.d(TestActivity.class.getSimpleName(), "KeyEnabled="+keyEnabled);
    boolean verboseLogging = bundle.getBoolean(MainActivity.VERBOSE_LOGGING, true);
    args.putBoolean(MainActivity.VERBOSE_LOGGING, verboseLogging);
    //        Log.d(TestActivity.class.getSimpleName(), "VerboseLogging="+verboseLogging);
    fragment.setArguments(args);
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    // Replace whatever is in the fragment_container view with this fragment,
    // and add the transaction to the back stack so the user can navigate back
    transaction.add(R.id.fragmentContainer, fragment);
    transaction.addToBackStack(null);
    // Commit the transaction
    transaction.commit();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Bundle(android.os.Bundle)

Example 4 with FragmentTransaction

use of android.app.FragmentTransaction in project SeriesGuide by UweTrottmann.

the class UpcomingEpisodeSettingsActivity method onCreate.

public void onCreate(Bundle savedInstanceState) {
    // set a theme based on user preference
    setTheme(SeriesGuidePreferences.THEME);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_singlepane);
    setupActionBar();
    if (savedInstanceState == null) {
        Fragment f = new SettingsFragment();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.content_frame, f);
        ft.commit();
    }
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment) PreferenceFragment(android.preference.PreferenceFragment)

Example 5 with FragmentTransaction

use of android.app.FragmentTransaction in project SeriesGuide by UweTrottmann.

the class SeriesGuidePreferences method switchToSettings.

public void switchToSettings(String settingsId) {
    Bundle args = new Bundle();
    args.putString(EXTRA_SETTINGS_SCREEN, settingsId);
    Fragment f = new SettingsFragment();
    f.setArguments(args);
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.replace(R.id.containerSettings, f);
    ft.addToBackStack(null);
    ft.commit();
}
Also used : FragmentTransaction(android.app.FragmentTransaction) Bundle(android.os.Bundle) Fragment(android.app.Fragment) PreferenceFragment(android.preference.PreferenceFragment)

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