eltos / SimpleDialogFragments

An Android library to create dialogs with ease and handle user interaction reliably, using fragments and material design.
Apache License 2.0
119 stars 17 forks source link

Feature request: Read dialog theme from context #63

Closed mtotschnig closed 3 years ago

mtotschnig commented 3 years ago

I need to apply a theme to all dialogs throughout the app (cf: https://github.com/eltos/SimpleDialogFragments/issues/54#issuecomment-708408326). It would be nice if instead fo having to provide this theme each time I build a dialogue, I could set it as a global theme attribute, something like simpleDialogTheme.

eltos commented 3 years ago

From the Wiki page:

[...] You can also specify a global theme with the alertDialogTheme-Attribute in your main App-Theme (see styles.xml in the example application).

Does this fulfil your requirements?

mtotschnig commented 3 years ago

In that case, unfortunately not, because I want the style only to be applied to the dialogues created by this library, in order to apply the mentioned workaround for #54 . But you are right that in general, the alertDialogTheme should be sufficient.

eltos commented 3 years ago

Ah, okay. So you would need a simpleDialogTheme instead of alertDialogTheme that only applies to SimpleDialogs (and all subclasses). Similar to the imageDialogTheme for SimpleImageDialog?

BTW, as #54 is framework related, why can't you apply it globally?

mtotschnig commented 3 years ago

Ah, okay. So you would need a simpleDialogTheme instead of alertDialogTheme that only applies to SimpleDialogs (and all subclasses). Similar to the imageDialogTheme for SimpleImageDialog?

That is what I had in mind. I did not know that it existed already for SimpleImageDialog.

BTW, as #54 is framework related, why can't you apply it globally?

Because the workaround applies to TextInputLayout with TextInputAutoCompleteTextView. But the attribute would change all TextInputLayouts, which is not what I want.

But the best thing to do would be to fix #54. I hope to find time for a PR.