Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icpick like Storing/Restoring #36

Closed
ghost opened this issue Jun 12, 2014 · 21 comments
Closed

Icpick like Storing/Restoring #36

ghost opened this issue Jun 12, 2014 · 21 comments

Comments

@ghost
Copy link

ghost commented Jun 12, 2014

How about support for IcePick style storing/restoring of parcelable classes?
https://github.com/frankiesardo/icepick

Because of the extra wrapping step, IcePick is currently incompatible with parceler (if I'm not mistaken)

@tom91136
Copy link

+1

@johncarl81
Copy link
Owner

Fantastic idea guys. I actually started working on this a few weeks ago after IcePick integration was closed. How does "Bundler" sound for a library name? https://github.com/johncarl81/bundler. I decided to make this a new library to keep Parceler small and focused on a single problem.

By the way, the functionality that IcePick offers exists in Transfuse right now under the @NonConfigurationInstance annotation http://johncarl81.github.io/transfuse/documentation.html#nonconfigurationinstance. So, if you're a user of Transfuse you already should have this available.

Also you will find Parceler integrated with Transfuse via the @Extra injections http://johncarl81.github.io/transfuse/documentation.html#extra.

Along the same lines, @f2prateek was gratious enough to accept my PR to integrate Parceler with android-dart: https://github.com/f2prateek/android-dart.

Lots of activity in this direction. Lets do it!

@ghost
Copy link
Author

ghost commented Jun 13, 2014

Bundler sounds good to me.
I kind of had a feeling I read about a similar feature in transfuse.
Seems it doesn't work for fragments yet, though - johncarl81/transfuse#115.
Once it does, I'll switch from Icepick to @NonConfigurationInstance.
I'll take a look if t his is something I can implement myself an create a pull request. Not sure if I can do it today, though.

@tom91136
Copy link

There's like 3 implementations the same idea: Dart, Icepick, Bundler. Which one is compatible with Parceler?

@johncarl81
Copy link
Owner

Dart is compatible with Parceler, Bundler will be (that's my implementation). Icepick is not directly compatible unless you rely on Parceler's generated code.

@tom91136
Copy link

Is bundler functional? I've checked the readme but it only has license and nothing else....

@johncarl81
Copy link
Owner

Bundler is a work in progress, and is missing some key components currently. Stay tuned!

@mdumrauf
Copy link

@johncarl81 maybe Bundler is confusing, having Ruby's Bundler going around. What will this library do?

@johncarl81
Copy link
Owner

@mdumrauf, This library will do butter-knife style injection of Bundle-able properties, automatically handling @Parcel wrapping/unwrapping, like so:

class ExampleActivity{
    @InjectExtra("one") int one;
    @InjectExtra("two") ParcelExample two;
}

@Parcel class ParcelExample{/*...*/}

Yes, this collides with the ruby library... do you have a name suggestion?

@mdumrauf
Copy link

Hmm..maybe extractifier? I'm no good at naming. Btw, have you checked this very same feature done in android annotations? https://github.com/excilys/androidannotations/wiki/Extras

@johncarl81
Copy link
Owner

@mdumrauf, yes, the idea is to inject/pull extras from annotated fields just like AndroidAnnotations does with two differences: 1. Support Parceler transparently, 2. Not require the bean to be "enhanced".

By the way, Transfuse implements extra injection that transparently supports Parceler:
http://androidtransfuse.org/documentation.html#extra

@johncarl81
Copy link
Owner

Hmm, how about Android Arguments?

@johncarl81
Copy link
Owner

Is there any interest in a fork of Icepick with Parceler support? Im considering releasing it on Maven central: https://github.com/johncarl81/icepick/tree/parceler_support

@almozavr
Copy link

Is there any interest in a fork of Icepick with Parceler support?

Would be great

@ppamorim
Copy link

+1

@jacobtabak
Copy link

Yes

On Thu, Feb 26, 2015, 8:48 AM Pedro Paulo de Amorim <
notifications@github.com> wrote:

+1


Reply to this email directly or view it on GitHub
#36 (comment).

@MichaelEvans
Copy link

+1

2 similar comments
@jonathan-caryl
Copy link

+1

@rockerhieu
Copy link

+1

@tom91136
Copy link

I decided to roll my own Ickpick. It is written from scratch and works perfectly with Parceler, please take a look here.

One of the more unique feature of my library is that it supports a pluggable compile-time code generation system. The parceler support is done with ONLY the following lines:

@TransformationTemplate(
        save = @StatementTemplate("{{bundle}}.putParcelable({{keyName}}, org.parceler.Parcels.wrap({{fieldName}}))"),
        restore = @StatementTemplate(type = Type.ASSIGNMENT,
                                     value = "org.parceler.Parcels.unwrap({{bundle}}.getParcelable({{keyName}}))",
                                     variable = "{{fieldName}}"),
        filters = {@TypeFilter(type = @TypeConstraint(type = Parcel.class))}
        )

@johncarl81
Copy link
Owner

Awesome work @tom91136!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants