Back to project page khandroid.
The source code is released under:
Apache License
If you think the Android project khandroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.khandroid.rest; /* w ww. j av a 2 s . co m*/ import javax.inject.Inject; import com.github.khandroid.ui_functionality.FragmentAttachedFunctionality; import com.github.khandroid.ui_functionality.HostFragment; import android.app.FragmentManager; import android.os.Bundle; import dagger.Lazy; public class RestFragmentFunctionality extends FragmentAttachedFunctionality { @Inject Lazy<RestPersistFragment> mPersistFragmentFactory; private RestPersistFragment mPersistFragment; private String mPersistTaskFragmentTag; @Inject public RestFragmentFunctionality() { super(); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mPersistTaskFragmentTag = getClass().getSimpleName(); FragmentManager fm = getFragment().getFragmentManager(); mPersistFragment = (RestPersistFragment) fm.findFragmentByTag(mPersistTaskFragmentTag); if (mPersistFragment == null) { mPersistFragment = mPersistFragmentFactory.get(); fm.beginTransaction().add(mPersistFragment, mPersistTaskFragmentTag).commit(); } mPersistFragment.setTargetFragment(getFragment(), 0); } public <T> void executeRestExchange(final RestExchange<T> x) { mPersistFragment.executeRestExchange(x); } @Override public void onDestroy() { super.onDestroy(); mPersistFragment.setTargetFragment(null, 0); } public boolean hasPendingOutcomes() { return mPersistFragment.hasPendingOutcomes(); } public RestExchangeOutcome<?> nextPendingOutcome() { return mPersistFragment.nextPendingOutcome(); } public void clearPendingOutcomes() { mPersistFragment.clearPendingOutcomes(); } public boolean isExecuting() { return mPersistFragment.isExecuting(); } public static abstract class RestFunctionlityHostFragment extends HostFragment implements RestPersistFragment.Listener { } }