Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use M3 for CreateFolderDialog #12033

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.widget.Button;
import android.widget.TextView;

import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.collect.Sets;
import com.nextcloud.client.di.Injectable;
Expand Down Expand Up @@ -71,7 +72,7 @@ public class CreateFolderDialogFragment


private OCFile mParentFolder;
private Button positiveButton;
private MaterialButton positiveButton;


private EditBoxDialogBinding binding;
Expand Down Expand Up @@ -101,13 +102,11 @@ public void onStart() {
private void bindButton() {
Dialog dialog = getDialog();

if (dialog instanceof AlertDialog) {
AlertDialog alertDialog = (AlertDialog) dialog;

positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);

viewThemeUtils.platform.colorTextButtons(positiveButton,
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
if (dialog instanceof AlertDialog alertDialog) {
positiveButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
MaterialButton negativeButton = (MaterialButton) alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
viewThemeUtils.material.colorMaterialButtonPrimaryTonal(positiveButton);
viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(negativeButton);
}
}

Expand Down Expand Up @@ -186,17 +185,25 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
});

// Build the dialog
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setView(view)
.setPositiveButton(R.string.folder_confirm_create, this)
.setNeutralButton(R.string.common_cancel, this)
.setTitle(R.string.uploader_info_dirname);
MaterialAlertDialogBuilder builder = buildMaterialAlertDialog(view);

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.getContext(), builder);

return builder.create();
}

private MaterialAlertDialogBuilder buildMaterialAlertDialog(View view) {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());

builder
.setView(view)
.setPositiveButton(R.string.folder_confirm_create, this)
.setNegativeButton(R.string.common_cancel, this)
.setTitle(R.string.uploader_info_dirname);

return builder;
}

@Override
public void onClick(DialogInterface dialog, int which) {
if (which == AlertDialog.BUTTON_POSITIVE) {
Expand Down
Loading