Dialog not using app custom theme
@hotchemi I'm not entirely sure why this issue was created, but I think it might be related to an issue I'm seeing.
I'm passing in a wrapped context
ContextThemeWrapper(context, R.style.my_style)
which has a theme specifically for dialogs. However since you call getApplicationContext on the passed in Context, the theme doesn't work.
Just ran into this:
I have a dark theme in my app, the dialog shows up as light, i.e it does not inherit the app's theme.
I tried the ContextThemeWrapper way as well but @bclymer says it's basically ignored:
AppRate.with(new ContextThemeWrapper(this, R.style.AppRateDialogTheme))
private AppRate(Context context) {
this.context = context.getApplicationContext();
}
Why is getApplicationContext() being called anyways? We don't need the context of the global application object for a simple dialog, plus the user should be responsible for sending the appropriate context.
Edit: Using a custom view doesn't help either, this should be marked as a bug.
Any update on it ? Is there any new version after 1.0.1?
Hi @paddykily , @bclymer , @AdityaAnand1 , @sundeepkmallick
You can use https://github.com/Vorlonsoft/AndroidRate and call
AppRate.with(this).setThemeResId(R.style.YourAppRateDialogTheme);
@AdityaAnand1 getApplicationContext() being called because we need the context of the global application object for the library purposes, not the creation of a dialog only; plus the user should be responsible for as few things as possible.
Hi @AlexanderLS,
Thanks for your response. But I managed to resolve the problem from styles.xml.
The new library which you have referred, does it also support Kotlin? I will let you know if I use the new library in the apps I am working on. Thanks..
Hi @sundeepkmallick ,
Yes, https://github.com/Vorlonsoft/AndroidRate supports Kotlin also. It 245 commits ahead (21,924 lines ++, 6,285 lines --)