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.

Implement more events, onFocusChange specifically #434

Description

@jameswyly

Currently there is no support for one of the most common events, onFocusChange, does not appear to exist at this moment. Is there anything structurally unusual about this call that was reasoned for this not to be included, or has there just not been a demand for this particular feature so far?

If there are not obvious roadblocks I may work on an implementation of this shortly, unless someone more familiar with the project feels up to the task.

Activity

  1. pyricau commented on Dec 20, 2012

    @pyricau
    Contributor

    Feel free to implement this! :) .

    Could you first elaborate on what the API would look like (annotations & how you'd use them) and what the generated code would look like ?

  2. jameswyly commented on Dec 20, 2012

    @jameswyly
    Author

    I imagine the annotation would follow the current paradigm, by putting an "@Focus" annotation on a method named after a view (or pass it param):

    @ViewById
    View myView;
    
    @Focus
    void myViewFocused(View v, boolean hasFocus){
    --- Listener logic! ---
    }

    OR

    @ViewById
    View myView;
    
    @Focus(R.id.myView)
    void clickedAViewFunctionNameThing(View v, boolean hasFocus){
    --- Listener logic! ---
    }

    Where the function parameters could probably be optional, but I'd imagine the most common usage using at least the boolean.

    Generated code for these would look something like this

    View view = findViewById(R.id.myView);
    view.setOnFocusChangeListener(new OnFocusChangeListener(){
    
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
    --- Listener logic! ---
    }
    });

    This listener basically follows the exact same structure as most of the other listeners in android.

  3. pyricau commented on Dec 22, 2012

    @pyricau
    Contributor

    Yep. The annotation should probably be named @FocusChange, to follow the other AA conventions.
    @mathieuboniface what do you think ?

  4. mathieuboniface commented on Dec 28, 2012

    @mathieuboniface
    Contributor

    Hey, i'm back :)

    Yes, I agree with @pyricau, I think that we should use @FocusChange

    The code spec looks good to me. We just need to see what could be the generated code.

  5. naixx commented on Jan 11, 2013

    @naixx
    Contributor

    I'm making some refactoring, which can allow usage of this feature.

  6. mathieuboniface commented on Jan 12, 2013

    @mathieuboniface
    Contributor

    Good news :) 👍

  7. yDelouis commented on Jun 19, 2013

    @yDelouis
    Contributor

    This should be documented and closed.
    Is there a way to contribute to the wiki ?

  8. DayS commented on Jun 20, 2013

    @DayS
    Contributor

    Wiki updated
    The only is to have admin role :)

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions