use of androidx.fragment.app.DialogFragment in project bitcoin-wallet by bitcoin-wallet.
the class RestoreWalletDialogFragment method show.
public static void show(final FragmentManager fm, final Uri backupUri) {
final DialogFragment newFragment = new RestoreWalletDialogFragment();
final Bundle args = new Bundle();
args.putParcelable(KEY_BACKUP_URI, backupUri);
newFragment.setArguments(args);
newFragment.show(fm, FRAGMENT_TAG);
}
use of androidx.fragment.app.DialogFragment in project bitcoin-wallet by bitcoin-wallet.
the class RestoreWalletDialogFragment method showPick.
public static void showPick(final FragmentManager fm) {
final DialogFragment newFragment = new RestoreWalletDialogFragment();
newFragment.show(fm, FRAGMENT_TAG);
}
use of androidx.fragment.app.DialogFragment in project bitcoin-wallet by bitcoin-wallet.
the class ReportIssueDialogFragment method show.
public static void show(final FragmentManager fm, final int titleResId, final int messageResId, final String subject, final Sha256Hash contextualTransactionHash) {
final DialogFragment newFragment = new ReportIssueDialogFragment();
final Bundle args = new Bundle();
args.putInt(KEY_TITLE, titleResId);
args.putInt(KEY_MESSAGE, messageResId);
args.putString(KEY_SUBJECT, subject);
if (contextualTransactionHash != null)
args.putByteArray(KEY_CONTEXTUAL_TRANSACTION_HASH, contextualTransactionHash.getBytes());
newFragment.setArguments(args);
newFragment.show(fm, FRAGMENT_TAG);
}
use of androidx.fragment.app.DialogFragment in project android by nextcloud.
the class FileActivity method showShareLinkDialog.
public static void showShareLinkDialog(FileActivity activity, OCFile file, String link) {
// Create dialog to allow the user choose an app to send the link
Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
intentToShareLink.setType("text/plain");
String username;
try {
OwnCloudAccount oca = new OwnCloudAccount(activity.getAccount(), activity);
if (oca.getDisplayName() != null && !oca.getDisplayName().isEmpty()) {
username = oca.getDisplayName();
} else {
username = com.owncloud.android.lib.common.accounts.AccountUtils.getUsernameForAccount(activity.getAccount());
}
} catch (Exception e) {
username = com.owncloud.android.lib.common.accounts.AccountUtils.getUsernameForAccount(activity.getAccount());
}
if (username != null) {
intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, activity.getString(R.string.subject_user_shared_with_you, username, file.getFileName()));
} else {
intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, activity.getString(R.string.subject_shared_with_you, file.getFileName()));
}
String[] packagesToExclude = new String[] { activity.getPackageName() };
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
chooserDialog.show(activity.getSupportFragmentManager(), FileDisplayActivity.FTAG_CHOOSER_DIALOG);
}
use of androidx.fragment.app.DialogFragment in project android by nextcloud.
the class ConflictsResolveActivityIT method keepBoth.
@Test
@ScreenshotTest
public void keepBoth() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt", "/newFile.txt", user.getAccountName());
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(user, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD_ID, newUpload.getUploadId());
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.KEEP_BOTH);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
onView(withId(R.id.existing_checkbox)).perform(click());
onView(withId(R.id.new_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
onView(withText("OK")).perform(click());
assertTrue(returnCode);
}
Aggregations