MFlisar / GDPRDialog

GDPR fragment dialog implementation
Apache License 2.0
211 stars 53 forks source link

Change title color of the toolbar #91

Closed fgnm closed 4 years ago

fgnm commented 4 years ago

I've just update the material library to stable 1.1.0, and the toolbar of the GDPRDialog changed. The color it's nice, but I'm not able to change the color of the title. Here is an image: Screen toolbar

I would like to have the title with white color.

1951FDG commented 4 years ago

Are you using withNoToolbarTheme(true) ? I recommend you set this to false.

fgnm commented 4 years ago

No, I'm not using withNoToolbarTheme(true)

1951FDG commented 4 years ago

Are you using latest version implementation 'com.github.MFlisar:GDPRDialog:1.4.2' ? Are you using BottomSheetDialogFragment ?

fgnm commented 4 years ago

Yes, I'm using the latest version implementation 'com.github.MFlisar:GDPRDialog:1.4.2'. This is my init code:

mGDPRSetupetup = new GDPRSetup(GDPRDefinitions.ADMOB, GDPRDefinitions.FIREBASE_ANALYTICS, GDPRDefinitions.FABRIC_CRASHLYTICS, GDPRDefinitions.FABRIC_ANSWERS)
                .withAllowNoConsent(false)
                .withExplicitAgeConfirmation(false)
                .withCheckRequestLocation(GDPRLocationCheck.DEFAULT)
                .withBottomSheet(true)
                .withForceSelection(true)
                .withShortQuestion(true)
                .withPrivacyPolicy("...url...")
                .withLoadAdMobNetworks("...id...");
        GDPR.getInstance().checkIfNeedsToBeShown(this, mGDPRSetupetup);

This behaviour has appear after upgrade to latest stable of the material library implementation 'com.google.android.material:material:1.1.0'

As I can see here this library still uses 1.0.0

1951FDG commented 4 years ago

Add:

.withCustomDialogTheme(R.style.ThemeOverlay_MaterialComponents_BottomSheetDialog_Custom)

Add custom style to styles.xml:

<style name="ThemeOverlay.MaterialComponents.BottomSheetDialog.Custom" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
        <item name="titleTextColor">@android:color/white</item>
</style>
fgnm commented 4 years ago

It does not work, I've tried to do so:

<style name="ThemeOverlay.MaterialComponents.BottomSheetDialog.Custom" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:textColor">@android:color/black</item>
</style>

And I've got the desired result. However is a bit tricky as method, maybe could be used a cleaner way.

1951FDG commented 4 years ago

Another way is overwriting the resource in your app: https://github.com/MFlisar/GDPRDialog/blob/master/library/src/main/res/layout/gdpr_dialog.xml

Can't decide on if this qualifies as a cleaner way, but it does allow you to apply a style or theme to the toolbar directly.

MFlisar commented 4 years ago

Sorry for the late reply.

I updated the versions in the demo app and used some custom colors in the demo app - can you reproduce your issue in the demo as well?

Generally make sure you use a Theme.MaterialComponents.* theme as your apps theme, the library only works with them.

MFlisar commented 4 years ago

closing because there is no communication anymore