Update theming on rename dialog

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-09-12 09:55:20 +02:00 committed by Álvaro Brey
parent 8a31f9b8f7
commit 90f060e944
No known key found for this signature in database
GPG key ID: 2585783189A62105

View file

@ -38,6 +38,7 @@ import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.collect.Sets;
import com.nextcloud.client.di.Injectable;
import com.owncloud.android.R;
@ -79,6 +80,7 @@ public class RenameFileDialogFragment
private OCFile mTargetFile;
private Button positiveButton;
/**
* Public factory method to create new RenameFileDialogFragment instances.
*
@ -92,21 +94,18 @@ public class RenameFileDialogFragment
args.putParcelable(ARG_PARENT_FOLDER, parentFolder);
frag.setArguments(args);
return frag;
}
@Override
public void onStart() {
super.onStart();
int color = themeColorUtils.primaryAccentColor(getContext());
AlertDialog alertDialog = (AlertDialog) getDialog();
if (alertDialog != null) {
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setTextColor(color);
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color);
viewThemeUtils.platform.colorTextButtons(positiveButton,
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
}
}
@ -176,13 +175,15 @@ public class RenameFileDialogFragment
});
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity());
builder.setView(view)
.setPositiveButton(R.string.file_rename, this)
.setNeutralButton(R.string.common_cancel, this)
.setTitle(R.string.rename_dialog_title);
Dialog d = builder.create();
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.getContext(), builder);
Window window = d.getWindow();
if (window != null) {
window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);