示例#1
0
  /** {@inheritDoc} */
  @Override
  public void bindView(final View view, final Context context, final Cursor cursor) {
    final ViewsFinder finder = new ViewsFinder(view);
    final TextView text = finder.find(id.text1);

    text.setText(convertToString(cursor));
  }
  /** {@inheritDoc} */
  @Override
  protected void populateData(final Context context, final View view, final Cursor cursor) {
    final ViewsFinder finder = new ViewsFinder(view);
    final TextView vehicleName = finder.find(id.text1);
    final TextView makeModel = finder.find(id.text2);
    final StringBuilder text = new StringBuilder();
    final VehicleDTO vehicle = VehicleDTO.newInstance(cursor);

    if (vehicle.getYear() > 0) {
      text.append(vehicle.getYear()).append(" ");
    }

    text.append(vehicle.getMakeName()).append(" ").append(vehicle.getModelName());

    vehicleName.setText(vehicle.getName());
    makeModel.setText(text);
  }
  protected void afterSetContentView() {
    final RecyclerView.ItemAnimator animator;

    finder = new ViewsFinder(this);
    fragmentFinder = new FragmentFinder(this);

    recyclerView = finder.find(R.id.util__recycler_view);
    if (recyclerView == null) {
      throw new IllegalStateException(
          "Unable to find a RecyclerView with id of @id/util__recycler_view");
    }

    recyclerView.setLayoutManager(getLayoutManager());
    recyclerView.setAdapter(getAdapter());

    animator = getItemAnimator();
    if (animator != null) {
      recyclerView.setItemAnimator(animator);
    }

    afterViews(activityState);
  }
 protected void setToolbar() {
   toolbar = finder.find(R.id.util__toolbar);
   if (toolbar != null) {
     setSupportActionBar(toolbar);
   }
 }