card.io-Android-SDK
card.io-Android-SDK copied to clipboard
Cannot Change theme for DataEntryActivity using Manifest
I am trying to change theme for DataEntryActivity
but it seems like there is no way to change it. I don't want to use the application theme
but i tried changing the activity theme
in manifest and it has no effect.
<activity
android:name="io.card.payment.DataEntryActivity"
android:screenOrientation="portrait"
android:theme="@style/DataEntryTheme"/>
What i want to do is that i want to change the hint color
of EditText
which is white
right now to grey
. The white hint color is very hard to see so i need to change it.
I am using Card IO version 5.0.1
Are you using the latest version of card.io? I believe this has been addressed in 5.1.0+
.
Yes it seems to be fixed in new version Thanks
@braebot so does it mean i can theme the Ui according to my own needs by changing the theme from the manifest ?
That's the idea.
@braebot i have tried theming
the activity using manifest
but that doesn't work. The only thing updated in this new version is that hint color is changed from White
to Grey
.
Did you use EXTRA_KEEP_APPLICATION_THEME, as specified in the javadocs?
No i don't want to use Application theme i would like to use a special theme for only this activity
Sorry, that level of granularity is not exposed. You'll have to fork the repo and just make the changes yourself.
Then do you think this could be one of the new features in a newer version. ?
This is the first time anyone has suggested such a feature. Are you basically requesting that a filter be applied to EXTRA_KEEP_APPLICATION_THEME
, so that only specific activities get theme changes, while the others do not? I am still not convinced that you wouldn't want to stylize the other activities the same.
I am just saying what if the user has some weird theme configured for the whole application but uses Activity specific themes throughout the whole app. There is no way to Theme
the DataEntryActivity
unless the user sets it as Application Theme.
For simplicity consider this scenario
In my case i perform some heavy tasks in Application
Class when app is initialized for the very first time so it takes like 4 seconds so i set an application specific theme with a particular background color
which is displayed during the whole application class initialization process, This color is displayed until the LaunchActivity
shows. Now all my activities have a particular theme while my application class uses a separate theme. So a feature like theming the DataEntryActivity
based on what theme
is set in Manifest file can be really helpful.
How android does it
Also i believe that application theme should be a fallback theme and if Activity is missing its theme then we should use application theme. That's how android themes activities.
This makes sense. Thanks for the detailed explanation. As mentioned, card.io doesn't currently support this functionality, but PRs in the source are welcome!