You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Now AndroidAnnotations clears injected view fields in onDestroyView() by setting each to null. However background tasks can be completed later. To avoid NPE-s, currently the client has to check wether the views are null or not. We could create a new annotation just like @IgnoreWhenDetached to remove that boilerplate. This was already suggested by @nbelikov.
viewDestroyed is only needed if VIEW_DESTROYED is used. For DETACHED, we can use the old method (getActivity() == null), there is no need to create a variable.
In onCreateView(), you should set the variable to false ( i guess that is a copy paste error).
Also, this variable should be volatile (since the decorated method maybe does not run on the main thread).
New annotation is acceptable if there is at least one more annotation
What do you mean?
There is no default value.
This annotation can be only used in @EFragments.
New annotation is acceptable if there is at least one more annotation
What do you mean?
i think he means that the new @IgnoreWhen annotations requires at least one other annotation like @UiThread. but i'd say no. this annotation should also work. a method annotated with this could be called from any thread/method so it should be ensured that it always work
Activity
WonderCsabo commentedon Oct 20, 2015
@yDelouis @dodgex WDYT?
WonderCsabo commentedon Oct 20, 2015
Or maybe we could generalize the
@IgnoreWhenXXXannotations, like@IgnoreWhen(DETACHED)or@IgnoreWhen(VIEW_DESTROYED). I am not sure.dodgex commentedon Oct 20, 2015
i'd prefer the
@IgnoreWhen(XXX)approach.yDelouis commentedon Oct 21, 2015
What would be the generated code ?
WonderCsabo commentedon Oct 21, 2015
I thought about the following:
yDelouis commentedon Oct 21, 2015
Okay. Why not.
WonderCsabo commentedon Oct 21, 2015
So can we rename the
@IgnoreWhenDetachedannotation to@IgnoreWhenand add an option to it?yDelouis commentedon Oct 21, 2015
Yes.
shiraji commentedon Dec 17, 2015
I am taking care of this one. Here is TODO
@IgnoreWhenthat takes DETACHED or VIEW_DESTROYED (or DESTROY_VIEW?)onDetachoronDestroyView@UiThreadannotation.WonderCsabo commentedon Dec 17, 2015
I vote for
VIEW_DESTROYED.viewDestroyedis only needed ifVIEW_DESTROYEDis used. ForDETACHED, we can use the old method (getActivity() == null), there is no need to create a variable.@UiThreadis not mandatory for this.shiraji commentedon Dec 17, 2015
Could you check if I understand this issue correctly?
Generated Code
@IgnoreWhen(DETACHED)@IgnoreWhen(VIEW_DESTROYED)TODO
@IgnoreWhenthat takes DETACHED or VIEW_DESTROYEDQuetion
FragmentnotActivity?FragmentorActivity?WonderCsabo commentedon Dec 17, 2015
In
onCreateView(), you should set the variable tofalse( i guess that is a copy paste error).Also, this variable should be
volatile(since the decorated method maybe does not run on the main thread).What do you mean?
There is no default value.
This annotation can be only used in
@EFragments.dodgex commentedon Dec 17, 2015
i think he means that the new
@IgnoreWhenannotations requires at least one other annotation like@UiThread. but i'd say no. this annotation should also work. a method annotated with this could be called from any thread/method so it should be ensured that it always workshiraji commentedon Dec 17, 2015
Oh I got it. Thanks @dodgex
I'm not sure about this
WonderCsabo commentedon Dec 17, 2015
@shiraji this last snippet is correct.
shiraji commentedon Dec 17, 2015
Cool! Thanks for reviewing requirement, guys.
shiraji commentedon Dec 17, 2015
What about enum name?
@IgnoreWhen(After.DETACHED)@IgnoreWhen(Timing.DETACHED)@IgnoreWhen(IgnoreWhen.DETACHED)I didn't come up with good one...
dodgex commentedon Dec 17, 2015
what about
@IgnoreWhen(IgnoreWhen.State.DETACHED)or short@IgnoreWhen(State.DETACHED)dodgex commentedon Dec 17, 2015
having
shiraji commentedon Dec 17, 2015
I like short one!
dodgex commentedon Dec 17, 2015
you can do both, but if you for example have another
Stateclass you might want to use the "long" version.shiraji commentedon Dec 17, 2015
You are right. I will put enum inside the annotation.
WonderCsabo commentedon Dec 17, 2015
Indeed, we should do the same as with
EBean.Scope.shiraji commentedon Dec 17, 2015
Yea. I will avoid conflict.
WonderCsabo commentedon Dec 20, 2015
Implemented.