Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:34
    dharashahkenya opened #2282
  • Oct 19 11:05
    dodgex commented #2281
  • Oct 19 11:05
    dodgex commented #2281
  • Oct 19 07:38
    peterplamenovpenchev reopened #2281
  • Oct 19 07:35
    peterplamenovpenchev closed #2281
  • Oct 18 14:49
    peterplamenovpenchev edited #2281
  • Oct 18 14:49
    peterplamenovpenchev opened #2281
  • Oct 01 16:56
    dodgex closed #2280
  • Oct 01 10:49
    gaurav99040 synchronize #2280
  • Oct 01 10:46
    gaurav99040 opened #2280
  • Sep 18 11:31
    ulfandersson commented #2267
  • Sep 06 13:43
    JordiGamez closed #2279
  • Sep 06 13:43
    JordiGamez commented #2279
  • Sep 06 13:42
    JordiGamez reopened #2279
  • Sep 06 13:42
    JordiGamez closed #2279
  • Sep 06 13:42
    JordiGamez edited #2279
  • Sep 06 13:41
    JordiGamez edited #2279
  • Sep 06 13:33
    JordiGamez edited #2279
  • Sep 06 13:32
    JordiGamez edited #2279
  • Sep 06 13:32
    JordiGamez opened #2279
Adrián Rivero
@smaugho
probably on @EActivity and @EFragment...
this one should return the onCreate after super.onCreate()
so you could do your view model injection at that point
Adrián Rivero
@smaugho
What I'm trying to do, is to "abstract' the ViewModel logic.. so that everything continues working the same. If I manage to do it, basically nothing changes in AA, you simply includes the Plugin, and you ensure that all the ViewModels injected with @Bean works as expected. I'm not really fan of creating more and more annotations
Kay-Uwe Janssen
@dodgex
but this is how AA plugin system is designed to work ;)
to add new annotations or support thirdparty annotations (like the otto plugin)
Adrián Rivero
@smaugho

If not, I'll have to do this:

Create @EViewModel to place over the Beans implementing ViewModel
Create @ViewModel to inject those beans
Create the method you suggested: @AfterViewModel

:sweat_drops:

but this is how AA plugin system is designed to work ;)

Just a question, as dev :), would you prefer to have to learn and use those 3 new Annotations?, or simply insert the plugin on your Graddle, and everything keeps working (with the new enhancements).

So that your @EBean which implement ViewModel when they are injected normally with Bean they simply, "work", no extra change?

Just to know :), I think I will do the @AfterViewModel.. I have done the @EViewModel and @ViewModel BTW, but I'm not pleased with it, hehehe. cause right now @EViewModel is placed over @EBean, and basically, you could try to inject it with @Bean, and then nothing works.
Kay-Uwe Janssen
@dodgex
I'm not sure if i would allow to have @EViewModel together with @EBean
but I'm not sure what is required to have stuff injected in your enhanced class then
Adrián Rivero
@smaugho
@EBean
@EViewModel
public class MainViewModel extends ViewModel implements LifecycleObserver {

    private static final long PERIODIC_UPDATES_TIME = 5 * 60 * 1000L;

    @RootView
    MainViewPresenter presenter;

    @Bean
    ArchivesManager archivesManager;

   .....
This is how it is done right now.. then you should inject with
@ViewModel
MainViewModel viewModel;
Kay-Uwe Janssen
@dodgex
and i'm ok with "learning" new annotations.
Adrián Rivero
@smaugho
Ok ok.. I'll guess I'll do it as required by AA.. if I'm not happy with it, maybe I finish with a version for us here in the company :sweat_smile: .. but want also to add this plugin to AA, sounds like a good use..

I'm not sure if i would allow to have @EViewModel together with @EBean

Right, in fact, I tried initially to have @EViewModel implemented as a Generating class.. but it doesn't work right now!

Maybe I should have tell you this before.. (and maybe this could be fixed)
Kay-Uwe Janssen
@dodgex
I'm sorry for the inconvinience but well AA is not designed for stuff like that (one of the reasons why i'd like to rewrite most of it :D)
maybe it is worth researching what is required to add new generating classes
Adrián Rivero
@smaugho
public abstract class ModelConstants {

    public static final Option OPTION_CLASS_SUFFIX = new Option("classSuffix", "_");

    private static String generationSuffix = "_";
    private static String classSuffix;

    public static final List<Class<? extends Annotation>> VALID_ENHANCED_VIEW_SUPPORT_ANNOTATIONS = asList(EActivity.class, EViewGroup.class, EView.class, EBean.class, EFragment.class);

    public static final List<Class<? extends Annotation>> VALID_ENHANCED_COMPONENT_ANNOTATIONS = asList(EApplication.class, EActivity.class, EViewGroup.class, EView.class, EBean.class, EService.class,
            EIntentService.class, EReceiver.class, EProvider.class, EFragment.class);

    private ModelConstants() {
    }
This is the issue. As you see, on ModelConstants we have those lists with VALID_ENCHANCED_VIEW and so on.. I can definitely create a Generating class, but then you cannot inject any @Bean or almost any other thing on it!
Also, most of annotations stop working then there, you cannot use most of them, since they make check against this list... mm.. maybe I got it wrong in fact, and I should modify that List from within the plugin?
Kay-Uwe Janssen
@dodgex
maybe it is possible to enhance the plugin api to have a way to extend this list
but some annotations check for certain enhanced classes in validation. not sure if this might be a problem
Adrián Rivero
@smaugho
Most of the injecting annotations use the "InjectHelper", that one makes the check
Kay-Uwe Janssen
@dodgex
i think the inject helper does not check the target class
Adrián Rivero
@smaugho

Aah, not exactly like that:

@Override
    public void validateEnclosingElement(Element element, ElementValidation valid) {
        validatorHelper.enclosingElementHasEnhancedComponentAnnotation(element, valid);
    }

The inject helper calls this method, which then validates

This is for the BeanHandler. Here you check basically then against that list in ModelConstants
public void enclosingElementHasEnhancedComponentAnnotation(Element element, ElementValidation valid) {
        enclosingElementHasOneOfAnnotations(element, VALID_ENHANCED_COMPONENT_ANNOTATIONS, valid);
    }
Kay-Uwe Janssen
@dodgex
hm
so this should work if we allow plugins to add its enhancing annotations to the list?
Adrián Rivero
@smaugho
I think so.. though not sure if it would be the same with many other annotations.
Kay-Uwe Janssen
@dodgex
well one could check that
might be a powerfull enhancement to the plugin api
Adrián Rivero
@smaugho
Yeap, I think I will ;) .. and let you know..
Kay-Uwe Janssen
@dodgex
and would allow you to do the view model stuff in a nice AA complaint way ;)
compatible
Adrián Rivero
@smaugho
hehehe, yeap, agree!.. ok ok.. I'll try to "adhere" to AA way, without inventing too much ;-)
Kay-Uwe Janssen
@dodgex
hehe. sorry again for the inconvenience :)
Adrián Rivero
@smaugho
np :+1:
Zulqurnain Haider
@Zulqurnain
Hi, can someone help me out with this strange but i think noob issue: androidannotations/androidannotations#2216
Csaba Kozák
@WonderCsabo
@Zulqurnain i am already helping you there. :)
Zulqurnain Haider
@Zulqurnain
sorry i thought, i would let more people in this issue
Zulqurnain Haider
@Zulqurnain
so @WonderCsabo there is some bug or i am doing something wrong?
Zulqurnain Haider
@Zulqurnain
Anyone ?
Caleb Chiesa
@Orbyt
Knock Knock
I've been trying to get our build times down and as such tried using kapt.use.worker.api=true. When building, the following error occurs:
> Task :sync:kaptDebugKotlin FAILED
.../SyncService.java:25: error: cannot find symbol
    private final Map<RepoType, List<SyncableRepository>> mSyncableRepositories;
                                     ^
  symbol:   class SyncableRepository
  location: class .../SyncService.java:38: error: cannot find symbol
    public synchronized void registerSyncableRepository(RepoType type, SyncableRepository... repo) {
                                                                       ^
  symbol:   class SyncableRepository
  location: class SyncService
> Task :app-state:data:kaptDebugKotlin
warning: The following options were not recognized by any processor: '[androidManifestFile, kapt.kotlin.generated]'
FAILURE: Build failed with an exception.
This is strange; why would it fail to find these classes?
I spent some time searching around and I think something is conflicting with AndroidAnnotations. Has anyone seen something similar?
Csaba Kozák
@WonderCsabo
@Orbyt i do not really think this is due to AndroidAnnotations.