You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ViewPaginationFragment.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.luticate.utils.ui.fragments;
  2. import android.view.View;
  3. import android.widget.LinearLayout;
  4. import com.luticate.utils.R;
  5. import com.luticate.utils.dbo.LuDbo;
  6. import java.util.List;
  7. import java.util.Vector;
  8. /**
  9. * Created by robin on 12/6/15.
  10. */
  11. public abstract class ViewPaginationFragment<Dbo extends LuDbo, DboView extends View> extends AbstractPaginationFragment<Dbo> {
  12. protected List<DboView> _views = new Vector<>();
  13. @Override
  14. protected int getLoaderViewId() {
  15. return R.id.loadStatus;
  16. }
  17. @Override
  18. protected int getScrollViewId() {
  19. return R.id.mainScrollView;
  20. }
  21. @Override
  22. protected int getLayoutId() {
  23. return R.layout.view_pagination_fragment_layout;
  24. }
  25. @Override
  26. protected int getPaginationViewId() {
  27. return R.id.paginationView;
  28. }
  29. @Override
  30. protected void onPageChanged() {
  31. View view = getView();
  32. LinearLayout layout = (LinearLayout) view.findViewById(R.id.itemsLayoutScrollView);
  33. layout.removeAllViews();
  34. _views.clear();
  35. for (Dbo item : _items.getData())
  36. {
  37. DboView v = getDboView(item);
  38. layout.addView(v);
  39. _views.add(v);
  40. }
  41. }
  42. protected abstract DboView getDboView(Dbo dbo);
  43. }