Search in sources :

Example 21 with DialogFragment

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);
}
Also used : Bundle(android.os.Bundle) DialogFragment(androidx.fragment.app.DialogFragment)

Example 22 with DialogFragment

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);
}
Also used : DialogFragment(androidx.fragment.app.DialogFragment)

Example 23 with DialogFragment

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);
}
Also used : Bundle(android.os.Bundle) DialogFragment(androidx.fragment.app.DialogFragment)

Example 24 with DialogFragment

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);
}
Also used : ConfirmationDialogFragment(com.owncloud.android.ui.dialog.ConfirmationDialogFragment) DialogFragment(androidx.fragment.app.DialogFragment) Intent(android.content.Intent) OwnCloudAccount(com.owncloud.android.lib.common.OwnCloudAccount) CertificateCombinedException(com.owncloud.android.lib.common.network.CertificateCombinedException) AuthenticatorException(android.accounts.AuthenticatorException)

Example 25 with DialogFragment

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);
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) OCUpload(com.owncloud.android.db.OCUpload) FileDataStorageManager(com.owncloud.android.datamodel.FileDataStorageManager) DialogFragment(androidx.fragment.app.DialogFragment) Intent(android.content.Intent) Test(org.junit.Test) ScreenshotTest(com.owncloud.android.utils.ScreenshotTest) ScreenshotTest(com.owncloud.android.utils.ScreenshotTest)

Aggregations

DialogFragment (androidx.fragment.app.DialogFragment)55 Bundle (android.os.Bundle)22 BottomSheetDialogFragment (com.google.android.material.bottomsheet.BottomSheetDialogFragment)8 Intent (android.content.Intent)7 Fragment (androidx.fragment.app.Fragment)4 InstrumentedDialogFragment (com.android.settings.core.instrumentation.InstrumentedDialogFragment)4 Test (org.junit.Test)4 FullScreenDialogFragment (org.thoughtcrime.securesms.components.FullScreenDialogFragment)4 NonNull (androidx.annotation.NonNull)3 FragmentTransaction (androidx.fragment.app.FragmentTransaction)3 ConfirmationDialogFragment (com.fsck.k9.fragment.ConfirmationDialogFragment)3 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)3 OCFile (com.owncloud.android.datamodel.OCFile)3 OCUpload (com.owncloud.android.db.OCUpload)3 ScreenshotTest (com.owncloud.android.utils.ScreenshotTest)3 FragmentManager (androidx.fragment.app.FragmentManager)2 AttachmentDownloadDialogFragment (com.fsck.k9.fragment.AttachmentDownloadDialogFragment)2 ArrayList (java.util.ArrayList)2 CustomDefaultPreference (org.thoughtcrime.securesms.components.CustomDefaultPreference)2 ColorPickerPreference (org.thoughtcrime.securesms.preferences.widgets.ColorPickerPreference)2