use of androidx.fragment.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();
}
use of androidx.fragment.app.FragmentManager in project android by owncloud.
the class FileActivity method showUntrustedCertDialog.
/**
* Show untrusted cert dialog
*/
public void showUntrustedCertDialog(RemoteOperationResult result) {
// Show a dialog with the certificate info
FragmentManager fm = getSupportFragmentManager();
SslUntrustedCertDialog dialog = (SslUntrustedCertDialog) fm.findFragmentByTag(DIALOG_UNTRUSTED_CERT);
if (dialog == null) {
dialog = SslUntrustedCertDialog.newInstanceForFullSslError((CertificateCombinedException) result.getException());
FragmentTransaction ft = fm.beginTransaction();
dialog.show(ft, DIALOG_UNTRUSTED_CERT);
}
}
use of androidx.fragment.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 androidx.fragment.app.FragmentManager in project android by owncloud.
the class ReceiveExternalFilesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// streams need to be prepared before super.onCreate() is called
prepareStreamsToUpload();
ActivityExtKt.checkPasscodeEnforced(this, this);
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(savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
}
// init ui
setContentView(R.layout.uploader_layout);
mSortOptionsView = findViewById(R.id.options_layout);
if (mSortOptionsView != null) {
mSortOptionsView.setOnSortOptionsListener(this);
mSortOptionsView.setOnCreateFolderListener(this);
mSortOptionsView.selectAdditionalView(SortOptionsView.AdditionalView.CREATE_FOLDER);
}
mEmptyListMessage = findViewById(R.id.empty_list_view);
mListView = findViewById(android.R.id.list);
mListView.setOnItemClickListener(this);
// 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();
mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
mLocalBroadcastManager.registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
// Listen for upload messages
IntentFilter uploadIntentFilter = new IntentFilter(FileUploader.getUploadFinishMessage());
uploadIntentFilter.addAction(FileUploader.getUploadStartMessage());
mUploadBroadcastReceiver = new UploadBroadcastReceiver();
mLocalBroadcastManager.registerReceiver(mUploadBroadcastReceiver, uploadIntentFilter);
// 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 androidx.fragment.app.FragmentManager in project Douya by DreaminginCodeZH.
the class ScalpelHelperFragment method attachTo.
/**
* @deprecated Use {@link #attachToActivity(Fragment)} instead.
*/
public static ScalpelHelperFragment attachTo(FragmentActivity activity) {
FragmentManager fragmentManager = activity.getSupportFragmentManager();
ScalpelHelperFragment fragment = (ScalpelHelperFragment) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
if (fragment == null) {
fragment = new ScalpelHelperFragment();
fragmentManager.beginTransaction().add(fragment, FRAGMENT_TAG).commit();
}
return fragment;
}
Aggregations