Today I’m going to give you some updates on things I’ve talked about in previous posts:
First, the Nexus 10 issue with USB Debugging: It turns out, the issue is in CyanogenMod. I installed AOKP, which is based on CM, and had the same issue. I went back to stock and it worked perfectly. So I guess I need to file a bug report with the guys at CM.
Next, the new look for 4.x: I said I was changing the check boxes to on/off switches. This is great… except in one area. (I also said in that post that I had not fully tested this yet.)
For some reason, the “SwitchPreference” doesn’t quite work as I would expect. I was working on something unrelated yesterday (I found a way to use an option to actually change the icon of the whole app, not just the icon of the notification) and realized while I was working on it, that these Switch Preferences did not quite work properly.
(WARNING: technical information included below. You may not understand all of this if you’re not familiar with programming.)
The problem is this: when I click on the on/off button it reacts differently than if I click on the text NEXT to the button.
If I use OnPreferenceClick, nothing happens at all when I click the button, but the function is called when I click the text.
If I use OnPreferenceChange, the function is called with the OLD value if I click on the button, and if I click on the text it’s actually called twice: once with the old value, and again with the new value.
This leaves me with an issue: how the heck do I deal with 1 item reacting in 2 completely different ways depending on how it’s interacted with? The answer: I still have no idea. If you have ANY insight as to how this works, I would LOVE to hear from you with ideas. In the meantime, I’m going to post on Stack Overflow and see if anyone there has any insight.
(END OF TECHNICAL INFO)
Well, that’s the news as of right now. Still no work on individual responses… I keep getting distracted by other things.
As always, let me know if you find any bugs or have any requests. And if you have any insight into the above problem, please let me know.
UPDATE: I figured out what I was doing wrong:
(Another WARNING: technical information below)
in OnPreferenecChange there are two parameters: Preference preference and Object o
Apparently preference holds the preference that is being changed, and o holds the boolean value of its state after the change. I was using preference.isChecked() as my reference, and had to change it to use o. (cast o as a Boolean, then use that value.)
(End of technical information)
I’m still working on figuring out all of the details of how to change the icon. I’ve figure out most of it, but there is a small side effect that some users may not like, so I’m trying to handle that before I finalize anything.
I’ll keep you up to date on progress 🙂