Search in sources :

Example 66 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project glide by bumptech.

the class RequestManagerRetrieverTest method testSupportCanGetRequestManagerFromFragment.

@Test
public void testSupportCanGetRequestManagerFromFragment() {
    FragmentActivity activity = Robolectric.buildActivity(FragmentActivity.class).create().start().resume().get();
    Fragment fragment = new Fragment();
    activity.getSupportFragmentManager().beginTransaction().add(fragment, PARENT_TAG).commit();
    activity.getSupportFragmentManager().executePendingTransactions();
    RequestManager manager = retriever.get(fragment);
    assertEquals(manager, retriever.get(fragment));
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) RequestManager(com.bumptech.glide.RequestManager) Fragment(android.support.v4.app.Fragment) Test(org.junit.Test)

Example 67 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project material-dialogs by afollestad.

the class FolderChooserDialog method show.

public void show(FragmentActivity context) {
    final String tag = getBuilder().tag;
    Fragment frag = context.getSupportFragmentManager().findFragmentByTag(tag);
    if (frag != null) {
        ((DialogFragment) frag).dismiss();
        context.getSupportFragmentManager().beginTransaction().remove(frag).commit();
    }
    show(context.getSupportFragmentManager(), tag);
}
Also used : DialogFragment(android.support.v4.app.DialogFragment) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment)

Example 68 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project scdl by passy.

the class PreferencesMenuTest method shouldStartPreferencesInActivity.

private void shouldStartPreferencesInActivity(Fragment fragment) {
    final ActivityController<FragmentActivity> controller = Robolectric.buildActivity(FragmentActivity.class);
    controller.create().start().resume();
    final FragmentActivity activity = controller.get();
    activity.getSupportFragmentManager().beginTransaction().add(fragment, null).commit();
    final MenuItem item = new TestMenuItem(R.id.preferences);
    fragment.onOptionsItemSelected(item);
    final ShadowActivity shadowActivity = Robolectric.shadowOf(activity);
    final Intent startedActivity = shadowActivity.getNextStartedActivity();
    // Intent was actually started
    assertThat(startedActivity, notNullValue());
    final ShadowIntent intent = Robolectric.shadowOf(startedActivity);
    assertThat(intent.getComponent().getClassName(), equalTo(ApplicationPreferencesActivity.class.getName()));
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) ShadowIntent(org.robolectric.shadows.ShadowIntent) TestMenuItem(org.robolectric.tester.android.view.TestMenuItem) ShadowActivity(org.robolectric.shadows.ShadowActivity) TestMenuItem(org.robolectric.tester.android.view.TestMenuItem) MenuItem(android.view.MenuItem) ShadowIntent(org.robolectric.shadows.ShadowIntent) Intent(android.content.Intent)

Example 69 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project fitscales by paulburton.

the class BoardFragment method dataReport.

private void dataReport(float tl, float tr, float bl, float br) {
    synchronized (this) {
        if (stabiliseThread != null)
            stabiliseThread.setData(tl, tr, bl, br);
        if (stabiliseWeighinThread != null)
            stabiliseWeighinThread.setData(tl, tr, bl, br);
    }
    boardView.setWeightData(tl, tr, bl, br);
    FragmentActivity act = BoardFragment.this.getActivity();
    if (act instanceof Listener)
        ((Listener) act).onBoardData(tl, tr, bl, br);
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity)

Example 70 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project Qachee by nicolasjafelle.

the class CharacterListFragment method replace.

public void replace(FragmentActivity activity, Fragment newFragment) {
    FragmentManager fragmentManager = activity.getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.replace(R.id.container, newFragment).commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)84 FragmentTransaction (android.app.FragmentTransaction)16 FragmentManager (android.support.v4.app.FragmentManager)16 FragmentTransaction (android.support.v4.app.FragmentTransaction)16 Fragment (android.support.v4.app.Fragment)11 Intent (android.content.Intent)6 Bundle (android.os.Bundle)5 View (android.view.View)4 DialogFragment (android.support.v4.app.DialogFragment)3 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)3 SearchView (android.widget.SearchView)3 TextView (android.widget.TextView)3 Fragment (android.app.Fragment)2 ActionBar (android.support.v7.app.ActionBar)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)2 MediaRouteDialogFactory (android.support.v7.app.MediaRouteDialogFactory)2 RecyclerView (android.support.v7.widget.RecyclerView)2 InjectView (butterknife.InjectView)2 RequestManager (com.bumptech.glide.RequestManager)2 FacebookException (com.facebook.FacebookException)2