use of androidx.fragment.app.DialogFragment in project k-9 by k9mail.
the class AccountSetupCheckSettings method showDialogFragment.
private void showDialogFragment(int dialogId, String customMessage) {
if (mDestroyed) {
return;
}
mProgressBar.setIndeterminate(false);
DialogFragment fragment;
if (dialogId == R.id.dialog_account_setup_error) {
fragment = ConfirmationDialogFragment.newInstance(dialogId, getString(R.string.account_setup_failed_dlg_title), customMessage, getString(R.string.account_setup_failed_dlg_edit_details_action), getString(R.string.account_setup_failed_dlg_continue_action));
} else {
throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
}
FragmentTransaction ta = getSupportFragmentManager().beginTransaction();
ta.add(fragment, getDialogTag(dialogId));
ta.commitAllowingStateLoss();
// TODO: commitAllowingStateLoss() is used to prevent https://code.google.com/p/android/issues/detail?id=23761
// but is a bad...
// fragment.show(ta, getDialogTag(dialogId));
}
use of androidx.fragment.app.DialogFragment in project android by owncloud.
the class FileOperationsHelper method sendDownloadedFile.
public void sendDownloadedFile(OCFile ocFile) {
if (ocFile != null) {
Intent sendIntent = makeActionSendIntent(ocFile);
// Show dialog, without the own app
String[] packagesToExclude = new String[] { mFileActivity.getPackageName() };
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Intent shareSheetIntent = new ShareSheetHelper().getShareSheetIntent(sendIntent, mFileActivity.getApplicationContext(), R.string.activity_chooser_send_file_title, packagesToExclude);
mFileActivity.startActivity(shareSheetIntent);
} else {
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude);
chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
}
} else {
Timber.e("Trying to send a NULL OCFile");
}
}
use of androidx.fragment.app.DialogFragment in project android by owncloud.
the class FileOperationsHelper method shareLink.
/**
* Share link with other apps
*
* @param link link to share
*/
private void shareLink(String link) {
Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
intentToShareLink.setType("text/plain");
String username = com.owncloud.android.lib.common.accounts.AccountUtils.getUsernameForAccount(mFileActivity.getAccount());
if (username != null) {
intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, mFileActivity.getString(R.string.subject_user_shared_with_you, username, mFileActivity.getFile().getFileName()));
} else {
intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, mFileActivity.getString(R.string.subject_shared_with_you, mFileActivity.getFile().getFileName()));
}
String[] packagesToExclude = new String[] { mFileActivity.getPackageName() };
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Intent shareSheetIntent = new ShareSheetHelper().getShareSheetIntent(intentToShareLink, mFileActivity.getApplicationContext(), R.string.activity_chooser_title, packagesToExclude);
mFileActivity.startActivity(shareSheetIntent);
} else {
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
}
}
use of androidx.fragment.app.DialogFragment in project kdeconnect-android by KDE.
the class DeviceFragment method refreshUI.
private void refreshUI() {
if (device == null || binding == null) {
return;
}
// Once in-app, there is no point in keep displaying the notification if any
device.hidePairingNotification();
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (device.isPairRequestedByPeer()) {
binding.pairMessage.setText(R.string.pair_requested);
binding.pairVerification.setVisibility(View.VISIBLE);
binding.pairVerification.setText(SslHelper.getVerificationKey(SslHelper.certificate, device.certificate));
binding.pairingButtons.setVisibility(View.VISIBLE);
binding.pairProgress.setVisibility(View.GONE);
binding.pairButton.setVisibility(View.GONE);
binding.pairRequestButtons.setVisibility(View.VISIBLE);
} else {
boolean paired = device.isPaired();
boolean reachable = device.isReachable();
binding.pairingButtons.setVisibility(paired ? View.GONE : View.VISIBLE);
errorBinding.errorMessageContainer.setVisibility((paired && !reachable) ? View.VISIBLE : View.GONE);
errorBinding.notReachableMessage.setVisibility((paired && !reachable) ? View.VISIBLE : View.GONE);
deviceBinding.viewStatusContainer.setVisibility((paired && reachable) ? View.VISIBLE : View.GONE);
try {
pluginListItems = new ArrayList<>();
if (paired && reachable) {
// Plugins button list
final Collection<Plugin> plugins = device.getLoadedPlugins().values();
for (final Plugin p : plugins) {
if (!p.hasMainActivity())
continue;
if (p.displayInContextMenu())
continue;
pluginListItems.add(new PluginItem(p, v -> p.startMainActivity(mActivity)));
}
DeviceFragment.this.createPluginsList(device.getPluginsWithoutPermissions(), R.string.plugins_need_permission, (plugin) -> {
DialogFragment dialog = plugin.getPermissionExplanationDialog();
if (dialog != null) {
dialog.show(getChildFragmentManager(), null);
}
});
DeviceFragment.this.createPluginsList(device.getPluginsWithoutOptionalPermissions(), R.string.plugins_need_optional_permission, (plugin) -> {
DialogFragment dialog = plugin.getOptionalPermissionExplanationDialog();
if (dialog != null) {
dialog.show(getChildFragmentManager(), null);
}
});
DeviceFragment.this.displayBatteryInfoIfPossible();
}
ListAdapter adapter = new ListAdapter(mActivity, pluginListItems);
deviceBinding.buttonsList.setAdapter(adapter);
mActivity.invalidateOptionsMenu();
} catch (IllegalStateException e) {
// Ignore: The activity was closed while we were trying to update it
} catch (ConcurrentModificationException e) {
Log.e(TAG, "ConcurrentModificationException");
// Try again
this.run();
}
}
}
});
}
use of androidx.fragment.app.DialogFragment in project materialistic by hidroh.
the class ItemFragment method showPreferences.
private void showPreferences() {
Bundle args = new Bundle();
args.putInt(PopupSettingsFragment.EXTRA_TITLE, R.string.font_options);
args.putInt(PopupSettingsFragment.EXTRA_SUMMARY, R.string.pull_up_hint);
args.putIntArray(PopupSettingsFragment.EXTRA_XML_PREFERENCES, new int[] { R.xml.preferences_font, R.xml.preferences_comments });
((DialogFragment) Fragment.instantiate(getActivity(), PopupSettingsFragment.class.getName(), args)).show(getFragmentManager(), PopupSettingsFragment.class.getName());
}
Aggregations