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.

Remove view annotation support from EBean #1477

Closed

Description

@WonderCsabo
No description provided.

Activity

  1. LouisCAD commented on Sep 9, 2015

    @LouisCAD

    Only if You add it for RecyclerView ViewHolders.

    How I use @ViewById for my RecyclerViews now

    @EBean
    public static class MyViewHolder extends RecyclerView.ViewHolder implements HasViews {
    
        @ViewById
        TextView titleTV, descTV;
    
        @ViewById
        ImageView icon;
    
        private static ViewGroup tmpParent;
    
        public static MyViewHolder newInstance(ViewGroup parent) {
            tmpParent = parent;
            MyViewHolder newHolder = MyViewHolder_.getInstance_(parent.getContext());
            tmpParent = null;
            return newHolder;
        }
    
        protected MyViewHolder(Context context) {
            super(LayoutInflater.from(context).inflate(R.layout.my_list_item, tmpParent, false));
            ((OnViewChangedListener) this).onViewChanged(this);
        }
    
        @Override
        public View findViewById(int id) {
            return itemView.findViewById(id);
        }
    }

    It's a little ugly, but it's less boilerplate than standard implementation, so please, don't remove EBan view annotations if you don't provide a @EViewHolder annotation, with the ability to tell AA when to findViewsById on itemView

  2. dodgex commented on Sep 9, 2015

    @dodgex
    Member

    @LouisCO you should either refactor your code to this approach or you can use my slightly improved version where in my case the TrackView is a @EViewGroup that can use @ViewById for its childs.

  3. LouisCAD commented on Sep 9, 2015

    @LouisCAD

    @dodgex your version isn't very straighforward for thos wanting to add @ViewById and implies boilerplate for each project anyway... Why don't you provide a modified RecyclerViewAdapterBase with abstract getItem(int position) in place of the ArrayList, and your ViewVrapper in AA? Also, I think a usage example of using @EViewGroup in the doc would help developers to use the good approach

  4. modified the milestone: 4.0 on Oct 28, 2015
  5. gauravsak commented on Dec 30, 2016

    @gauravsak

    @WonderCsabo If this issue is resolved, could you please mark it closed? Thanks!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions