card.io-Android-SDK icon indicating copy to clipboard operation
card.io-Android-SDK copied to clipboard

Cannot Change theme for DataEntryActivity using Manifest

Open krazykira opened this issue 9 years ago • 12 comments

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.

img_20160112_130426

I am using Card IO version 5.0.1

krazykira avatar Jan 12 '16 12:01 krazykira

Are you using the latest version of card.io? I believe this has been addressed in 5.1.0+.

braebot avatar Jan 12 '16 15:01 braebot

Yes it seems to be fixed in new version Thanks

krazykira avatar Jan 12 '16 16:01 krazykira

@braebot so does it mean i can theme the Ui according to my own needs by changing the theme from the manifest ?

krazykira avatar Jan 12 '16 16:01 krazykira

That's the idea.

braebot avatar Jan 12 '16 16:01 braebot

@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.

krazykira avatar Jan 12 '16 16:01 krazykira

Did you use EXTRA_KEEP_APPLICATION_THEME, as specified in the javadocs?

braebot avatar Jan 12 '16 17:01 braebot

No i don't want to use Application theme i would like to use a special theme for only this activity

krazykira avatar Jan 13 '16 09:01 krazykira

Sorry, that level of granularity is not exposed. You'll have to fork the repo and just make the changes yourself.

braebot avatar Jan 14 '16 20:01 braebot

Then do you think this could be one of the new features in a newer version. ?

krazykira avatar Jan 15 '16 09:01 krazykira

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.

braebot avatar Jan 15 '16 17:01 braebot

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.

krazykira avatar Jan 20 '16 11:01 krazykira

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!

braebot avatar Feb 01 '16 04:02 braebot