Search in sources :

Example 16 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project mechanoid by robotoworks.

the class SupportOperationManager method create.

public static SupportOperationManager create(FragmentActivity activity, OperationManagerCallbacks callbacks, boolean enableLogging) {
    String tag = "Tags." + callbacks.getClass().getName();
    SupportOperationManager operationManager = null;
    FragmentManager fm = activity.getSupportFragmentManager();
    PersistenceFragment frag = (PersistenceFragment) fm.findFragmentByTag(tag);
    if (frag == null) {
        if (enableLogging) {
            Log.d(TAG, String.format("[Create Fragment] tag:%s", tag));
        }
        frag = new PersistenceFragment();
        operationManager = new SupportOperationManager(callbacks, enableLogging);
        frag.setOperationManager(operationManager);
        fm.beginTransaction().add(frag, tag).commit();
    } else {
        if (enableLogging) {
            Log.d(TAG, String.format("[Recover Fragment] tag:%s", tag));
        }
        operationManager = (SupportOperationManager) frag.getOperationManager();
        if (operationManager == null) {
            if (enableLogging) {
                Log.d(TAG, String.format("[Create Manager] tag:%s", tag));
            }
            operationManager = new SupportOperationManager(callbacks, enableLogging);
            frag.setOperationManager(operationManager);
        } else {
            if (enableLogging) {
                Log.d(TAG, String.format("[Recover Manager] tag:%s", tag));
            }
            operationManager.mCallbacks = callbacks;
        }
    }
    return operationManager;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager)

Example 17 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project glitch-hq-android by tinyspeck.

the class SkillDetailFragment method InitUpdateSkillRemainingTimer.

private void InitUpdateSkillRemainingTimer() {
    if (m_RemainingTimer != null)
        m_RemainingTimer.cancel();
    m_RemainingTimer = new Timer();
    m_RemainingTimer.scheduleAtFixedRate(new TimerTask() {

        public void run() {
            FragmentActivity act = getActivity();
            if (act != null) {
                act.runOnUiThread(new Runnable() {

                    public void run() {
                        if (m_currentSkill.learning && !m_currentSkill.paused && !m_currentSkill.got && !m_fromUnlearn)
                            UpdateSkillDetailProgress();
                        else if (m_currentSkill.unlearning)
                            UpdateUnlearnDetailProgress();
                    }
                });
            }
        }
    }, 1000, 1000);
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Timer(java.util.Timer) TimerTask(java.util.TimerTask)

Example 18 with FragmentActivity

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

the class RequestManagerRetriever method get.

public RequestManager get(FragmentActivity activity) {
    if (Util.isOnBackgroundThread()) {
        return get(activity.getApplicationContext());
    } else {
        assertNotDestroyed(activity);
        FragmentManager fm = activity.getSupportFragmentManager();
        return supportFragmentGet(activity, fm, null);
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager)

Example 19 with FragmentActivity

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

the class RequestManagerRetrieverTest method testSupportCanGetRequestManagerFromActivity.

@Test
public void testSupportCanGetRequestManagerFromActivity() {
    FragmentActivity fragmentActivity = Robolectric.buildActivity(FragmentActivity.class).create().start().get();
    RequestManager manager = retriever.get(fragmentActivity);
    assertEquals(manager, retriever.get(fragmentActivity));
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) RequestManager(com.bumptech.glide.RequestManager) Test(org.junit.Test)

Example 20 with FragmentActivity

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

the class RequestManagerRetrieverTest method helpTestSupportCanGetRequestManagerFromDetachedFragment.

private void helpTestSupportCanGetRequestManagerFromDetachedFragment() {
    FragmentActivity activity = Robolectric.buildActivity(FragmentActivity.class).create().start().resume().get();
    Fragment fragment = new Fragment();
    activity.getSupportFragmentManager().beginTransaction().add(fragment, PARENT_TAG).detach(fragment).commit();
    activity.getSupportFragmentManager().executePendingTransactions();
    assertTrue(fragment.isDetached());
    retriever.get(fragment);
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Fragment(android.support.v4.app.Fragment)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)91 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 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)11 Intent (android.content.Intent)7 Bundle (android.os.Bundle)5 View (android.view.View)5 TextView (android.widget.TextView)4 DialogFragment (android.support.v4.app.DialogFragment)3 SearchView (android.widget.SearchView)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 ImageView (android.widget.ImageView)2 InjectView (butterknife.InjectView)2 RequestManager (com.bumptech.glide.RequestManager)2