Search in sources :

Example 46 with DialogFragment

use of androidx.fragment.app.DialogFragment in project collect by opendatakit.

the class DateTimeWidgetUtilsTest method displayDatePickerDialogWithYearMode_showsDatePickerWithDayAndMonthFixedToJanuaryFirst.

@Test
public void displayDatePickerDialogWithYearMode_showsDatePickerWithDayAndMonthFixedToJanuaryFirst() {
    when(datePickerDetails.getDatePickerType()).thenReturn(GREGORIAN);
    dateTimeWidgetUtils.showDatePickerDialog(activity, gregorianYear, date);
    DialogFragment dialog = (DialogFragment) activity.getSupportFragmentManager().findFragmentByTag(FixedDatePickerDialog.class.getName());
    assertThat(((DatePickerDialog) dialog.getDialog()).getDatePicker().getYear(), is(date.getYear()));
    assertThat(((DatePickerDialog) dialog.getDialog()).getDatePicker().getMonth(), is(0));
    assertThat(((DatePickerDialog) dialog.getDialog()).getDatePicker().getDayOfMonth(), is(1));
}
Also used : PersianDatePickerDialog(org.odk.collect.android.fragments.dialogs.PersianDatePickerDialog) DatePickerDialog(android.app.DatePickerDialog) IslamicDatePickerDialog(org.odk.collect.android.fragments.dialogs.IslamicDatePickerDialog) FixedDatePickerDialog(org.odk.collect.android.fragments.dialogs.FixedDatePickerDialog) EthiopianDatePickerDialog(org.odk.collect.android.fragments.dialogs.EthiopianDatePickerDialog) CopticDatePickerDialog(org.odk.collect.android.fragments.dialogs.CopticDatePickerDialog) BikramSambatDatePickerDialog(org.odk.collect.android.fragments.dialogs.BikramSambatDatePickerDialog) MyanmarDatePickerDialog(org.odk.collect.android.fragments.dialogs.MyanmarDatePickerDialog) DialogFragment(androidx.fragment.app.DialogFragment) Test(org.junit.Test)

Example 47 with DialogFragment

use of androidx.fragment.app.DialogFragment in project android by nextcloud.

the class ConflictsResolveActivityIT method keepNew.

@Test
@ScreenshotTest
public void keepNew() {
    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);
    existingFile.setRemoteId("123abc");
    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_LOCAL);
        returnCode = true;
    };
    getInstrumentation().waitForIdleSync();
    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)

Example 48 with DialogFragment

use of androidx.fragment.app.DialogFragment in project android by nextcloud.

the class ConflictsResolveActivityIT method keepExisting.

@Test
@ScreenshotTest
public void keepExisting() {
    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_SERVER);
        returnCode = true;
    };
    getInstrumentation().waitForIdleSync();
    onView(withId(R.id.existing_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)

Example 49 with DialogFragment

use of androidx.fragment.app.DialogFragment in project MovieGuide by esoxjem.

the class MoviesListingFragment method displaySortingOptions.

private void displaySortingOptions() {
    DialogFragment sortingDialogFragment = SortingDialogFragment.newInstance(moviesPresenter);
    sortingDialogFragment.show(getFragmentManager(), "Select Quantity");
}
Also used : SortingDialogFragment(com.esoxjem.movieguide.listing.sorting.SortingDialogFragment) DialogFragment(androidx.fragment.app.DialogFragment)

Example 50 with DialogFragment

use of androidx.fragment.app.DialogFragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class RunningServiceDetails method showConfirmStopDialog.

private void showConfirmStopDialog(ComponentName comp) {
    DialogFragment newFragment = MyAlertDialogFragment.newConfirmStop(DIALOG_CONFIRM_STOP, comp);
    newFragment.setTargetFragment(this, 0);
    newFragment.show(getFragmentManager(), "confirmstop");
}
Also used : InstrumentedDialogFragment(com.android.settings.core.instrumentation.InstrumentedDialogFragment) DialogFragment(androidx.fragment.app.DialogFragment)

Aggregations

DialogFragment (androidx.fragment.app.DialogFragment)62 Bundle (android.os.Bundle)22 InstrumentedDialogFragment (com.android.settings.core.instrumentation.InstrumentedDialogFragment)8 BottomSheetDialogFragment (com.google.android.material.bottomsheet.BottomSheetDialogFragment)8 Intent (android.content.Intent)7 Fragment (androidx.fragment.app.Fragment)5 FragmentTransaction (androidx.fragment.app.FragmentTransaction)4 Test (org.junit.Test)4 FullScreenDialogFragment (org.thoughtcrime.securesms.components.FullScreenDialogFragment)4 NonNull (androidx.annotation.NonNull)3 FragmentManager (androidx.fragment.app.FragmentManager)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 FragmentActivity (androidx.fragment.app.FragmentActivity)2 CustomDialogPreferenceCompat (com.android.settingslib.CustomDialogPreferenceCompat)2 CustomEditTextPreferenceCompat (com.android.settingslib.CustomEditTextPreferenceCompat)2 AttachmentDownloadDialogFragment (com.fsck.k9.fragment.AttachmentDownloadDialogFragment)2