AndroidDeveloperLB/MaterialPreferenceLibrary

setEnabled binding

Closed this issue · 10 comments

Is there any way to bind one preference to other, like if switchPreference is on, enable below preference, else disable below preference Or should i do it on code?

Do note that it's simple, so if you wish to have a very special logic, you will need to handle it yourself via code.

Hi, disabled preference used to look in grey color, but now with latest version of library on Android 6 it looks black, not grey. Is sth changed on Android or library? Updating my old app )

@jemshit Can't confirm this issue on Android 6 emulator and sample of repo.
If you are sure this is a real issue, please create a new report, and provide a sample project. Current one works fine on my case.

@AndroidDeveloperLB it works, but color is not changed. If Preference B is dependent on SwitchPreference A, does color of Preference B change to grey, when Preference A is disabled, in your test?

@jemshit Again, can't confirm this issue. The color changes in both themes I have in the sample.
In the sample app, I just added :

android:dependency="checkboxPref"

to the EditTextPreference I have there, and it works fine, including color change.

See:

maxthonsnap20170325141708

Ok, problem was this in theme:

<item name="android:textColorPrimary">@color/...</item>
<item name="android:textColorSecondary">@color/...</item>

They had to be drawable instead of just color, to include disabled state color:

<item name="android:textColorPrimary">@drawable/...</item>
<item name="android:textColorSecondary">@drawable/...</item>

Who is "they" ? For me it worked fine...

@color/ has to be @drawable/ if you play with android:textColorPrimary.

Please create a new report, with full explanation of what you are talking about, and a sample code. The sample project works fine as I wrote.