-
Notifications
You must be signed in to change notification settings - Fork 2.3k
#1203: Modified AbstractPrefField interface to include generic get and put methods. #1272
#1203: Modified AbstractPrefField interface to include generic get and put methods. #1272
Conversation
|
Why did you close the previous PR? You could overwrite the branch with |
|
i think because he had a wrong branch name there. the other was |
|
@chvndb you should add |
|
Indeed, the branch name was incorrect. I added |
|
OK, branch renaming is not supported I think. I'll review this later. |
|
What happens if one passes null? I think that will yield NPE while unboxing. |
|
Ah indeed, we had this discussion before and I forgot about it. We agreed on setting the preference to its default value. I will add this. |
|
something like this? |
|
I do not think so. I think we agreed on to add zero if one passes |
|
re-reading the original issue, it is ambiguous what the action should be when passing null. What do you actually mean by adding zero? |
if (value == null) {
putLong(0);
}etc |
|
I see, so you would set the preference to what you consider to be the default value for the given type. I think it is more logical to set it to the default value the developer has defined, as he has thought about what the default value should be in the context of his application. |
|
Maybe you are right, but i am not really sure what would be better. @yDelouis WDYT? |
|
E.g. storing a json object in a string preference and the default value is |
|
I think chvndb is right, we should reset the value to the default one. |
|
Added the null behaviour to reset the preference to the user defined default. Added the reset method as it is a cleaner API. It allows a user to explicitly reset a given preference without using the side effect of putting a null value. I can still remove it if you want. (p.s. squashed the commits) |
|
I think the |
|
Thanks! Can you reword the commit as to follow the standard git format (as laid out in the contribution guide)? |
|
Like this? |
|
Yeah, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this c 8000 omment
The reason will be displayed to describe this comment to others. Learn more.
final?
|
@chvndb can you you please react to the review comments? |
Write null to preference resets the preference to the user defined default value.
|
Sorry, with the new year I guess I missed your comments. Updated.
|
#1203: Modified AbstractPrefField interface to include generic get and put methods.
|
Thanks! |
Relates to #1203