#264 - using Apache ObjectSerializer. #543

Merged
merged 8 commits into from Jun 9, 2014

5 participants

@ened

This is for #264 - support for Set objects in SharedPreferences.

Some questions:

  • This implementation is not very efficient for ApiLevel > 11; mainly because I'm not sure how AA could support this? androidannotations-api links against 1.6.
    • Access to SdkVersionHelper.getSdkInt() should be ok I guess
  • It's using the ObjectSerializer class from the apache pig project as discussed on SO: http://stackoverflow.com/questions/7057845/save-arraylist-to-sharedpreferences
    • A alternative implementation could be to put each entry of the Set into it's own property, like "$IDX_$NAME" along with a "MAX_$NAME" property. This would require a little more work in the AbstractPrefEditorField functions
ened added some commits Mar 29, 2013
@ened ened #264 - using Apache ObjectSerializer. 8051cc2
@ened ened Merge remote-tracking branch 'upstream/develop' into 264_sharedpref_s…
…tring_set

Conflicts:
	AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/SharedPrefProcessor.java
37cb77e
@ened ened Merge & move things in the right place again. 516874b
@ened ened Ensure the stringset files will generated as well. 1bc53aa
@ened ened Ensure to use canonical name constants 5a87e8a
@ened ened Merge branch 'develop' of https://github.com/excilys/androidannotations
… into 264_sharedpref_string_set

Conflicts:
	AndroidAnnotations/functional-test-1-5/src/main/java/org/androidannotations/test15/prefs/SomePrefs.java
173bf64
@ened

Merged latest upstream/develop changes. Would be good to know whether it will be merged or not?

@DayS
excilys member

Sorry for the late reply. I don't have time to check this PR until next week. Maybe @JoanZapata @pyricau @mathieuboniface could take a look ? :)

Just to answer quickly, I'm not a big fan of binary encoding... I'd prefer encoding like json which keep some readability.
But I don't really know which is the best for this case. Any thought ?

@ened

Yes, serializing with JSON is another option. Android supports this using the org.json (http://developer.android.com/reference/org/json/package-summary.html) package. Will re-implement using that if we have a decision about it.

@JoanZapata
excilys member

I believe android encodes StringSet as XML in recent releases, so my opinion is that AA should do the same.

@DayS
excilys member

This PR needs to be updated

@DayS
excilys member

This feature could really be interesting. @JoanZapata was right : SharedPreferences are stored using XML, so we should de it the same way.

@ened Sorry Do you have any more time to work on this ?

@ened

@DayS should have, but not too soon. Could someone point me to the part in the AOSP which handles (de-)serialization? Would certainly save some time.

@DayS
excilys member

I'll check that

ened added some commits Oct 4, 2013
@ened ened Merge https://github.com/excilys/androidannotations into 264_sharedpr…
…ef_string_set

Conflicts:
	AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/SharedPrefProcessor.java
4ee1bfd
@ened ened Update to latest AA code changes. c18702f
@ened

@DayS one a side note: I found it would be useful to have support for additional types as well, like Set<Integer>. Do you think this is something AA could/should include? It's not part of the standard Android API though. Same as adding support for short preferences.

@DayS
excilys member

Thanks for the update :) I'll take a look at this today.

Yeah, it could be a good idea. But I think we should add a note in javadoc to warn user that this is not natively supported by Android.

@DayS
excilys member

I can't find your new serialization implementation. Am I crazy or is it just a mistake ? :)

@ened

@DayS new implementation is the next task (for this week). Just updated the PR to be valid again.

@hborders

@ened Is this still something you're working on?

@WonderCsabo

@ened are you still working on this?

@WonderCsabo

@ened i can take over if you do not have the time to finish this.

@DayS
excilys member

@WonderCsabo > It'll be great :)

@ened

@WonderCsabo yes please & thanks for helping out.

@DayS DayS merged commit c18702f into excilys:develop Jun 9, 2014
@DayS
excilys member

This one has been merged through #962

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment