Closed massimobio closed 9 years ago
Of course, either use global dark theme or method useDarkTheme()
Sorry, I should have phrased my question better: How do I set the custom builder to use the dark theme?
To show a simple dialog fragment from an activity I set the dark theme like this: SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setTitle("Title").setPositiveButtonText(R.string.ok).useDarkTheme().show();
To show a custom dialog fragment from an activity I do this: JayneHatDialogFragment.show(this); Here I cannot set the dark theme.
In my custom class I wasn't able to set the dark theme in the overridden builder: @Override public BaseDialogFragment.Builder build(BaseDialogFragment.Builder builder) {... because the builder here is not a BaseDialogBuilder.
I solved it by adding the dark theme argument to the bundle in my custom view. Not the cleanest solution but it works.
public static void show(FragmentActivity activity) {
JayneHatDialogFragment dialog = new JayneHatDialogFragment ();
Bundle args = new Bundle();
args.putBoolean(BaseDialogBuilder.ARG_USE_DARK_THEME, true);
dialog.setArguments(args);
dialog.show(activity.getSupportFragmentManager(), TAG);
}
Is it possible to set the dark theme when making a custom dialog like in the JayneHatDialogFragment example?