Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 14 17:55
    WeaponMan commented #2306
  • Oct 14 17:54
    WeaponMan commented #2306
  • Sep 26 15:41
    krischik commented #2306
  • Sep 23 10:48
    peterplamenovpenchev commented #2306
  • Sep 15 09:17
    WonderCsabo commented #2306
  • Sep 15 08:31
    dodgex commented #2306
  • Sep 14 18:18
    krischik commented #2306
  • Sep 09 06:32
    vikalppatelce edited #2306
  • Sep 09 06:18
    vikalppatelce opened #2306
  • Aug 30 06:38
    YunLemon reopened #2304
  • Aug 16 02:37
    YunLemon opened #2304
  • Jul 14 09:13
    vxhviet commented #2303
  • Jul 14 08:25
    vxhviet commented #2303
  • Jun 07 12:28
    zizibuba commented #2303
  • May 21 07:48
    DenisFedak84 edited #2303
  • May 21 07:47
    DenisFedak84 edited #2303
  • May 21 07:46
    DenisFedak84 edited #2303
  • May 21 07:43
    DenisFedak84 opened #2303
  • Apr 10 17:46
    WonderCsabo commented #2297
  • Apr 10 17:45
    WonderCsabo commented #2299
Adrián Rivero
@smaugho

I'm having issues with injecting a ViewModel in that point with:

ViewModelProviders.of(this).get(MainViewModel_.class);

For some reason, is not working as expected when calling it before the super.onCreate, so the injection doesn't work as expected

Kay-Uwe Janssen
@dodgex
for most cases the only reason to have a custom processor run on a core annotation after the core processor is to modify or enhance the generated code. so such processors would require hacks like yours in thier code. while removeBody is a very simple method (in term of what the result is) we can hide it in our own api (codemodelhelper) but for more complex modifications i think it might be hard to build a nice api
i think view model provider needs to have a fully created activity?

is there really a reason to call init_ before the super.onCreate in an Activity?

i don't know atm sorry.

totally forgot what init_ is doing :D
wait wait
yes it is necessary
Adrián Rivero
@smaugho
Heheh, is the one which runs all the injections ;)
Kay-Uwe Janssen
@dodgex
as all the injection is done in init_ and we have the promise that those injections are done when onCreate is called
(the developers on create)
and so we need to do it before we call super.onCreate() and unfortunately we can not call the super.super.oncreate
:D
i think there is a way to get the onCreate body after the super.onCreate call
Adrián Rivero
@smaugho

Yeap, that's a hard reality.. on the Declex what I've done basically is to create a @RunWith annotation, you can add:

@RunWith("onCreate")
public void initialize() {

}

It is quite handy BTW

Kay-Uwe Janssen
@dodgex
for your processor
Adrián Rivero
@smaugho
Yeap, though it is hard for devs.. cause basically the AfterInject is called before the block after the "super.onCreate", and then the viewModels are not injected
that causes "confusion" :)
Maybe AA should in fact call AfterInject method, for the activities only, after the "super.onCreate".. I don't think that this method should be called as well before the onCreate
Kay-Uwe Janssen
@dodgex
you could do an @AfterViewModel ;)
the problem is
we can hardly change this
not without a 5.0 release an breaking changes
Adrián Rivero
@smaugho
yes, I understand.. cause' apps out there could start crashing :)
Kay-Uwe Janssen
@dodgex
yes
Adrián Rivero
@smaugho
ok.. I think I will try to figure out why Android really requires that this ViewModelProviders creates the ViewModel after the onCreate, I'm not sure if there is some reason for it.. Ok ok, I'll see if I could find some solution to that in a different way.. Maybe providing a custom factory could be solved
Kay-Uwe Janssen
@dodgex
I'd love to do a full rewrite of AA and how it does some of it's stuff. but to be honest it is way to much work. especially considering that i'm currently not doing any android dev and even my company where we (our 1-man mobile team) used to use AA is no longer using it as we are shifting to react native to support ios
Adrián Rivero
@smaugho
I understand.. BTW, I saw you interested in Lombok, or well, at least saw you letting some comments there :)
Kay-Uwe Janssen
@dodgex
yeah
used in some projects in the past (including my old android app^^)
but only private projects
Adrián Rivero
@smaugho
Using similar "techniques", AA could change a lot in fact.... But not sure of how much work it really will take
Kay-Uwe Janssen
@dodgex
i'd not use such technologies
i'd check the transform apis google provides for android builds
Adrián Rivero
@smaugho
mmm.. have to check that
Kay-Uwe Janssen
@dodgex
but i think it also is pretty complex
i recently tried to read up on kotlin compiler plugins. but that shit is pretty complex with working partly on byte code level for added/generated code
Adrián Rivero
@smaugho
:)
Kay-Uwe Janssen
@dodgex
and its damn hard to find (recent) docs or samples
Adrián Rivero
@smaugho
BTW, I mentioned something above that I could try to do on my company.. I have several devs under my management.. I've seriously been thinking in start instructing one to let him contributing to AA, plugins or whatever is need it.. we need it in our company anyway.
I already started once, but he was too stressed with this "type of programming" :sweat_smile: ... Well, I think I'll give it another shot in near future..
Kay-Uwe Janssen
@dodgex
yeah
that annotation processing and code generation stuff is not that easy :D
i think just compiler stuff (like GWT) is more complex :D
okay, there might be much more in between. ;)
Adrián Rivero
@smaugho
Yeap.. well, I've get till "Java Tree" level, not deeper
but you can do pretty cool thing with the Java Trees API
Kay-Uwe Janssen
@dodgex
Tree api?
you mean stuff like TreeSet?
Adrián Rivero
@smaugho
No no, Trees API, you applies a Scanner over an Element, and you can get all the code under a method for instance