gregkorossy/Android-Support-Preference-V7-Fix

No EditText in Dialog, Inconsistent style on Preference Screen

Closed this issue · 2 comments

Good afternoon,

Having issues with the library for some reason. Getting weird inconsistent results with the theme like so:

image

The EditText items show with very large headers, and when clicked on I don't actual get an EditText or any dialog buttons, like so:

image

I've implemented the following into my gradle file:

implementation 'com.takisoft.fix:preference-v7:28.0.0.0-alpha3'
implementation 'com.takisoft.fix:preference-v7-material:28.0.0.0-alpha3'
implementation 'com.takisoft.fix:preference-v7-extras:28.0.0.0-alpha3'

I've called the Material Components preference theme in my app's main theme, like so in my styles.xml:

<item name="preferenceTheme">@style/PreferenceFixTheme.MaterialComponents.Light.NoActionBar</item>

This is the Fragment that I'm loading into my view pager:

import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat

class Fragment_NewDebt_Prefs : PreferenceFragmentCompat() {
override fun onCreatePreferencesFix(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.fragment_new_debt_prefs)
}

Is there anything obvious that I'm missing here? I should add that I'm getting similar results from the support library alone. I'm also getting similar results with the themes available prior to the Material Components.

You need to use the theme as the parent for your app / Activity theme, not as preferenceTheme. So you should have your theme as

<style name="AppTheme" parent="@style/PreferenceFixTheme.MaterialComponents.Light.NoActionBar">
...
</style>

Doh! That did the trick! Thank you much, awesome library!