Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@AfterViews execution order #553

Description

@EurigJones

I have a fragment class (A) and a parent fragment class (B). Both with @Afterviews methods.

The code generated always executes the method in A, before B. I would have thought that you'd generally want to execute the parent class code before it's child (but of course, not always)

Is there a way to define execution order?

Activity

  1. naixx commented on Apr 9, 2013

    @naixx
    Contributor

    Seems to be similar to #296

    What version of AA do you use?

  2. EurigJones commented on Apr 9, 2013

    @EurigJones
    Author

    2.7.1. Generated code..

    private void afterSetContentView_() {
    
        ...loads of findViewByIds here...
    
            initViews();
            setupActionBar();
    }
    

    initViews() is definetely in the child class, and setupActionBar is in the parent. If it makes a difference there is 3 levels of hierarchy. initViews() is in A (child) and setupActionBar is actually in C (not B).

  3. DayS commented on Apr 12, 2013

    @DayS
    Contributor

    I'm facing the same issue right now. Seems that we have a regression here...

  4. mathieuboniface commented on Apr 12, 2013

    @mathieuboniface
    Contributor

    Ok, i'll look at this one this WE.

  5. DayS commented on Apr 12, 2013

    @DayS
    Contributor

    By the way if the parent and child classes have @AfterViews methods with the same with we also have a problem. Example :

    class A {
        @AfterViews
        void afterViews() {...}
    }
    
    class B extends A {
        @AfterViews
        void afterViews() {...}
    }

    This will generate :

    class B_ extends B {
        private void afterSetContentView_() {
            ...
            afterViews();
            afterViews();
        }
    }

    But I don't know if there is an easy way to fix this. Maybe we should add an Eclipse error on the child's version of afterViews()

  6. DayS commented on May 4, 2013

    @DayS
    Contributor
  7. mathieuboniface commented on May 18, 2013

    @mathieuboniface
    Contributor

    Sorry for the late answer...

    This fix is planned for the 3.0 version of AA (See #424)

    You should be able to resolve you issue by using 3.0-SNAPSHOT available here : https://oss.sonatype.org/content/repositories/snapshots/org/androidannotations/androidannotations/3.0-SNAPSHOT/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions