use of android.support.v4.app.FragmentManager in project android by owncloud.
the class ReceiveExternalFilesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
prepareStreamsToUpload();
if (savedInstanceState == null) {
mParents = new Stack<>();
mAccountSelected = false;
mAccountSelectionShowing = false;
} else {
mParents = (Stack<String>) savedInstanceState.getSerializable(KEY_PARENTS);
mFile = savedInstanceState.getParcelable(KEY_FILE);
mAccountSelected = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTED);
mAccountSelectionShowing = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTION_SHOWING);
}
super.onCreate(savedInstanceState);
if (mAccountSelected) {
setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
}
// Listen for sync messages
IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
mSyncBroadcastReceiver = new SyncBroadcastReceiver();
registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
// Init Fragment without UI to retain AsyncTask across configuration changes
FragmentManager fm = getSupportFragmentManager();
TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
if (taskRetainerFragment == null) {
taskRetainerFragment = new TaskRetainerFragment();
fm.beginTransaction().add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
}
// else, Fragment already created and retained across configuration change
}
use of android.support.v4.app.FragmentManager in project android by owncloud.
the class UriUploader method copyThenUpload.
/**
*
* @param sourceUris Array of content:// URIs to the files to upload
* @param remotePaths Array of absolute paths to set to the uploaded files
*/
private void copyThenUpload(Uri[] sourceUris, String[] remotePaths) {
if (mShowWaitingDialog) {
mActivity.showLoadingDialog(R.string.wait_for_tmp_copy_from_private_storage);
}
CopyAndUploadContentUrisTask copyTask = new CopyAndUploadContentUrisTask(mCopyTmpTaskListener, mActivity);
FragmentManager fm = mActivity.getSupportFragmentManager();
// Init Fragment without UI to retain AsyncTask across configuration changes
TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
if (taskRetainerFragment != null) {
taskRetainerFragment.setTask(copyTask);
}
copyTask.execute(CopyAndUploadContentUrisTask.makeParamsToExecute(mAccount, sourceUris, remotePaths, mBehaviour, mActivity.getContentResolver()));
}
use of android.support.v4.app.FragmentManager in project scdl by passy.
the class ChangelogDialog method showDialogForActivity.
public static void showDialogForActivity(FragmentActivity activity) {
FragmentManager fm = activity.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG);
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);
new ChangelogDialog().show(ft, FRAGMENT_TAG);
}
use of android.support.v4.app.FragmentManager in project Pokemap by omkarmoghe.
the class MainActivity method onCreate.
//region Lifecycle Methods
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sharedPref = this.getSharedPreferences(getString(R.string.pref_file_key), Context.MODE_PRIVATE);
themeId = sharedPref.getInt(getString(R.string.pref_theme_no_action_bar), R.style.AppTheme_NoActionBar);
setTheme(themeId);
setContentView(R.layout.activity_main);
pref = new PokemapSharedPreferences(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FragmentManager fragmentManager = getSupportFragmentManager();
MapWrapperFragment mapWrapperFragment = (MapWrapperFragment) fragmentManager.findFragmentByTag(MAP_FRAGMENT_TAG);
if (mapWrapperFragment == null) {
mapWrapperFragment = MapWrapperFragment.newInstance();
}
fragmentManager.beginTransaction().replace(R.id.main_container, mapWrapperFragment, MAP_FRAGMENT_TAG).commit();
if (pref.isServiceEnabled()) {
startNotificationService();
}
}
use of android.support.v4.app.FragmentManager in project Timber by naman14.
the class NowPlayingActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nowplaying);
SharedPreferences prefs = getSharedPreferences(Constants.FRAGMENT_ID, Context.MODE_PRIVATE);
String fragmentID = prefs.getString(Constants.NOWPLAYING_FRAGMENT_ID, Constants.TIMBER3);
Fragment fragment = NavigationUtils.getFragmentForNowplayingID(fragmentID);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
}
Aggregations