AndroidDeveloperLB/MaterialPreferenceLibrary

preference.setEnabled(false) does only disable "android:summary"

Closed this issue · 11 comments

2015-08-11 12_31_46-screenshot_2015-08-11-12-02-23 png - windows-fotoanzeige

preference.setEnabled(false) should disable the whole preference, not only the summary

Sadly I have issues on my Android Studio currently, but I've looked at the code of Android, and I can't find what's responsible of changing the style of the textViews, except for this:

/**
 * Makes sure the view (and any children) get the enabled state changed.
 */
private void setEnabledStateOnViews(View v, boolean enabled) {
    v.setEnabled(enabled);

    if (v instanceof ViewGroup) {
        final ViewGroup vg = (ViewGroup) v;
        for (int i = vg.getChildCount() - 1; i >= 0; i--) {
            setEnabledStateOnViews(vg.getChildAt(i), enabled);
        }
    }
}

Yet the style of the original TextViews do not have anything special, so I wonder what's going on...

@Tomblarom Why is it closed? Have you found a way to solve it?

Anyway, I can't reproduce this.

I'm going to color the icon grey ;) Don't know how to solve it.

@Tomblarom This doesn't make sense. Can you please share a minimal project showing this issue?
I don't see this problem.
Also, for icons to have multiple states, you can use a selector, just like any other drawable.

@Tomblarom How did your change color?

@AndroidDeveloperLB This happens on "com.lb.material_preferences_library.custom_preferences.Preference"

Found the issue, you need to always return false; on onPreferenceClick.

@jemshit I don't understand what's the issue you are talking about. Please make a new post.

@AndroidDeveloperLB This issue.When .setEnabled(false) is called, preference title still looks like enabled with black color. Solved.

@jemshit I can't reproduce it. Please create a new post, and show how you did it and what was the fix.