如何将两个Recycler适配器组合到一个自定义适配器中?

时间:2017-03-28 03:54:18

标签: android firebase parallax recycler-adapter firebaseui

我需要为我的适配器使用两个库,两个适配器用于不同的目的,我需要将它们用于我的布局,一个是ParallaxRecyclerAdapter而另一个是FirebaseRecyclerAdapter是否有办法将两者合并为一个自定义适配器?

目前,我使用的是自定义FirebaseRecyclerAdapter,但我也需要ParallaxRecyclerAdapter

public class VendorNewAdapter extends FirebaseRecyclerAdapter<NewsPaper, NewsPaperHolder>{



private  boolean isColorsInverted = false;
private Context context;
private AppCompatActivity activity;

private DatabaseReference mDatabaseRef;
private Query oneQuery;
private DatabaseReference childRef;

public VendorNewAdapter(Class<NewsPaper> modelClass, int modelLayout,
                        Class<NewsPaperHolder> viewHolderClass, Query ref, AppCompatActivity activity,
                        boolean isViewWithList, Context context) {
    super(modelClass, modelLayout, viewHolderClass, ref);
    this.context = context;
    this. activity = activity;
    this.isColorsInverted = isViewWithList;
}


@Override
protected void populateViewHolder(final NewsPaperHolder viewHolder, NewsPaper model, int position) {

    viewHolder.vendorName.setText(model.getPaper_name());

    mDatabaseRef.child("news").orderByChild("newspaper_id").equalTo(oneChildRef).addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });


}

}

0 个答案:

没有答案