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;
}
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);
}
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);
}
}
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));
}
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);
}
Aggregations