Is it possible for the processor to the create an instance of class that implements IcicleClass and use reflection to call it's save() and restore()methods, passing a bundle. I apologize for writing up a use case instead of some proof of concept code. I have no idea where to start with annotation processing.
class ViewState implements IcicleClass {
@Icicle boolean isRefreshing;
@Icicle boolean emtyLayoutShowing;
@Override
public void save(Bundle savedInstanceState) {
Icepick.saveInstanceState(this, savedInstanceState);
}
@Override
public void restore(Bundle savedInstanceState) {
Icepick.restoreInstanceState(this, savedInstanceState);
}
}
class MyFragment extends Fragment {
@IcicleClass
ViewState mViewState;
@Icicle
ArrayList<Parcelable> mData;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Icepick.restoreInstanceState(this, savedInstanceState);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Icepick.saveInstanceState(this, outState);
}
}
Or would it just be easier to make ViewState implement Parcelable. Just an idea.
Is it possible for the processor to the create an instance of class that implements IcicleClass and use reflection to call it's
save()
andrestore()
methods, passing a bundle. I apologize for writing up a use case instead of some proof of concept code. I have no idea where to start with annotation processing.Or would it just be easier to make ViewState implement Parcelable. Just an idea.