Skip to content

Commit

Permalink
Merge pull request #12041 from nextcloud/feature/use-m3-confirmation-…
Browse files Browse the repository at this point in the history
…dialog

Use Material Design 3 For Confirmation Dialog
  • Loading branch information
AndyScherzinger committed Oct 30, 2023
2 parents 9d5c55b + fc53132 commit d13f280
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 176 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions app/src/androidTest/java/com/owncloud/android/AbstractIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
Expand Down Expand Up @@ -58,6 +60,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Locale;
import java.util.Objects;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -403,6 +406,21 @@ public boolean isPowerSavingExclusionAvailable() {
assertTrue(result.getLogMessage(), result.isSuccess());
}

protected void enableRTL() {
Locale locale = new Locale("ar");
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
Configuration config = resources.getConfiguration();
config.setLocale(locale);
resources.updateConfiguration(config, null);
}

protected void resetLocale() {
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
Configuration defaultConfig = resources.getConfiguration();
defaultConfig.setLocale(Locale.getDefault());
resources.updateConfiguration(defaultConfig, null);
}

protected void screenshot(View view) {
screenshot(view, "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,38 @@ public void testLoadingDialog() {
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithOneAction() {
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, -1, -1);
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithTwoAction() {
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, -1);
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithThreeAction() {
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithThreeActionRTL() {
enableRTL();

ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[] { }, -1, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
showDialog(dialog);

resetLocale();
}

@Test
@ScreenshotTest
public void testRemoveFileDialog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ public void onCheckAvailableSpaceFinish(boolean hasEnoughSpaceAvailable, String.
// to the ownCloud folder instead of copying
String[] args = {getString(R.string.app_name)};
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(
R.string.upload_query_move_foreign_files, args, 0, R.string.common_yes, -1,
R.string.common_no
);
R.string.upload_query_move_foreign_files, args, 0, R.string.common_yes, R.string.common_no, -1);
dialog.setOnConfirmationListener(this);
dialog.show(getSupportFragmentManager(), QUERY_TO_MOVE_DIALOG_TAG);
}
Expand Down

This file was deleted.

Loading

0 comments on commit d13f280

Please sign in to comment.