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

Change of style #39

Open
EspoiRka opened this issue Dec 4, 2022 · 3 comments
Open

Change of style #39

EspoiRka opened this issue Dec 4, 2022 · 3 comments

Comments

@EspoiRka
Copy link

EspoiRka commented Dec 4, 2022

Good afternoon. I found your beautiful application and everything seems to be ok, but... You have not specified anywhere how to change the color of the buttons. I understand this is a standard function "calcDialog.setStyle"? But when I write calcDialog.setStyle(DialogFragment.STYLE_NORMAL, App Theme); Nothing changes. in Styles.xml I copied your code. And there are no differences. It's just that in the night theme, the bottom three buttons are not visible, because they are purple, and I would like to change them. How to do it? And I do not know if you are dealing with strings.xml , but in the Russian localization, the word "clear" is translated incorrectly. There is a "clean up", but there should be a "clean up". If there is such a possibility, it would be nice to fix it. But I do not know how(

@maltaisn
Copy link
Owner

maltaisn commented Dec 4, 2022

The style for dialog buttons is calcDialogButtonStyle, you should be able to change it like the other styles. If you copied the XML on the wiki page https://github.com/maltaisn/calcdialoglib/wiki/Styling-the-calculator, make sure to have calcDialogStyle set in your app theme (the one set in the manifest).

For the incorrect translation you can give me the correct one I'll change it.

@EspoiRka
Copy link
Author

EspoiRka commented Dec 5, 2022

And if I still didn't understand? I'm a Fool, apparently... If it's not difficult, can you describe even more strongly what I should do? From what I understood, I have to do something with android:theme in the manifest. But if I change my theme from android:theme="@style/Theme.TestApp6" on android:theme="@style/CalcDialogStyle" the program doesn't even start. I've never changed styles and don't understand what I should do. Also, you didn't say if I should write something in the code? Namely calcDialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.CustomCalcOperationBtnStyle);? And in what form do you need to provide information about the incorrect translation? When I read my message, I realized that I was a fool) In the Cancel button, instead of "Очищать", it should be "Очистить". Incorrect declension of the word.
Unless of course it is difficult for you to explain, because I could not find a solution on the Internet

@maltaisn
Copy link
Owner

maltaisn commented Dec 7, 2022

On Android styles are described in XML as you know. There's a special style we call the app theme, which is some kind of top level style for the whole app. You don't need to change it in the manifest. Styles set any number of attributes, like textColor. We can also create custom attributes like I did here with calcDialogStyle. Then, widgets and the library can read attributes values and apply them. calcDialogStyle is the main style for the library, and it can contain attributes defining styles for components of the library, like buttons (for example with attribute calcDialogStyle).

You don't need to write anything in the code. In fact, once the theme is set, the only way to change it is to restart the activity (some apps do it almost transparently so you don't realize it). Everything comes from the app theme, which as I explained above also sets the calcdialog style. If you did what's in the wiki then there might be something wrong about your app I don't know about.

For fixing translations, look at https://github.com/maltaisn/calcdialoglib/tree/master/lib/src/main/res, find the appropriate values-** directory, then edit the strings.xml to fix the translation that's wrong. There should be an edit button. Then there should be a button saying this will create a pull request and from there I can merge it. If it's just the Cancel button don't worry I'll just fix it with what you told me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants