private void fixRatingsViewColorScheme() {
   LayerDrawable stars = (LayerDrawable) mMovieRatingsView.getProgressDrawable();
   stars
       .getDrawable(2)
       .setColorFilter(
           getResources().getColor(R.color.starFullySelected), PorterDuff.Mode.SRC_ATOP);
   stars
       .getDrawable(1)
       .setColorFilter(
           getResources().getColor(R.color.starPartiallySelected), PorterDuff.Mode.SRC_ATOP);
   stars
       .getDrawable(0)
       .setColorFilter(getResources().getColor(R.color.starNotSelected), PorterDuff.Mode.SRC_ATOP);
 }
  public View getView(final int pos, View convertView, ViewGroup parent) {
    View row = convertView;
    if (convertView == null) {
      row = inflater.inflate(R.layout.row_rating, parent, false);
    }
    txt = (TextView) row.findViewById(R.id.list_elem);
    fav = (RatingBar) row.findViewById(R.id.fav);
    txt.setText(createText(lbagg.get(pos)));

    // Esta parte es para capturar el click sobre el boton de annadir productos
    ImageButton button = (ImageButton) row.findViewById(R.id.imgButton);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Toast.makeText(
                    context,
                    "AƱadido al carrito 1 bocadillo " + lbagg.get(pos).getNombre() + ".",
                    Toast.LENGTH_SHORT)
                .show();
            Constants.pedido.add(lbagg.get(pos));
          }
        });

    // Para poner el texto de otro color
    txt.setTextColor(context.getResources().getColor(R.color.textColor));
    txt.setTextSize(
        context
            .getResources()
            .getInteger(R.integer.text_size)); // Para cambiar el tamano de la letra
    // Con esto conseguimos printar los favoritos en funcion a la base de datos
    fav.setRating(lbagg.get(pos).getFav());
    LayerDrawable stars = (LayerDrawable) fav.getProgressDrawable();
    stars.getDrawable(2).setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP);

    startRating(pos);

    return row;
  }
  private void setupTrainerView() {
    // Set toolbar
    mToolbar.setTitle(m_trainer.getName());

    // Setup view
    ImageView ivProfileImage = (ImageView) findViewById(R.id.ivProfileImage);
    Picasso.with(this).load(m_trainer.getProfileImageUrl()).into(ivProfileImage);

    ImageView ivFavorite = (ImageView) findViewById(R.id.ivFavorite);
    if (m_trainer.isFavorite()) {
      ivFavorite.setImageResource(R.drawable.heart_selected);
    } else {
      ivFavorite.setImageResource(R.drawable.heart);
    }

    TextView tvPrice = (TextView) findViewById(R.id.tvPrice);
    tvPrice.setText(m_trainer.getPriceFormatted());

    TextView tvAboutTrainer = (TextView) findViewById(R.id.tvAboutTrainer);
    tvAboutTrainer.setText(m_trainer.getAboutMe());

    TextView tvTrainerEducation = (TextView) findViewById(R.id.tvTrainerEducation);
    String educationAndCertifications = "";
    ArrayList<String> educationAndCertificationsArrayList =
        m_trainer.getEducationAndCertifications();
    for (int i = 0; i < educationAndCertificationsArrayList.size(); i++) {
      educationAndCertifications += "&#8226; " + educationAndCertificationsArrayList.get(i);

      if (i != educationAndCertificationsArrayList.size() - 1) {
        educationAndCertifications += "<br/>";
      }
    }
    tvTrainerEducation.setText(Html.fromHtml(educationAndCertifications));

    TextView tvTrainerInterests = (TextView) findViewById(R.id.tvTrainerInterests);
    String interestsAndAchievements = "";
    ArrayList<String> interestsAndAchievementsArrayList = m_trainer.getInterestsAndAchievements();
    for (int i = 0; i < interestsAndAchievementsArrayList.size(); i++) {
      interestsAndAchievements += "&#8226; " + interestsAndAchievementsArrayList.get(i);

      if (i != interestsAndAchievementsArrayList.size() - 1) {
        interestsAndAchievements += "<br/>";
      }
    }
    tvTrainerInterests.setText(Html.fromHtml(interestsAndAchievements));

    RatingBar ratingBar = (RatingBar) findViewById(R.id.ratingBar);
    ratingBar.setRating((float) m_trainer.getRatings());
    Drawable progress = ratingBar.getProgressDrawable();
    DrawableCompat.setTint(progress, Color.parseColor("#FFD700"));

    ImageView ivProfileImage2 = (ImageView) findViewById(R.id.ivProfileImage2);
    Picasso.with(this).load(m_trainer.getProfileImageUrl()).into(ivProfileImage2);

    SupportMapFragment mapFragment =
        ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
    if (mapFragment != null) {
      mapFragment.getMapAsync(
          new OnMapReadyCallback() {
            @Override
            public void onMapReady(GoogleMap map) {
              m_map = map;
              ParseGeoPoint parseGeoPoint = m_trainer.getGym().point();
              LatLng point = new LatLng(parseGeoPoint.getLatitude(), parseGeoPoint.getLongitude());
              m_map.moveCamera(CameraUpdateFactory.newLatLngZoom(point, 16));

              BitmapDescriptor defaultMarker =
                  BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED);
              // Extract content from alert dialog
              String title = m_trainer.getGym().getName();
              String snippet = m_trainer.getGym().getAddress().toString();
              // Creates and adds marker to the map
              Marker marker =
                  m_map.addMarker(
                      new MarkerOptions()
                          .position(point)
                          .title(title)
                          .snippet(snippet)
                          .icon(defaultMarker));
              marker.showInfoWindow();
            }
          });
    } else {
      Toast.makeText(this, "Error - Map Fragment was null!!", Toast.LENGTH_SHORT).show();
    }

    TextView tvReviewsCount = (TextView) findViewById(R.id.tvReviewsCount);
    tvReviewsCount.setText(getReviewsCount());

    LinearLayout llReviews = (LinearLayout) findViewById(R.id.llReviews);
    addReviewsInView(llReviews);

    TextView tvContactTrainer = (TextView) findViewById(R.id.tvContactTrainer);
    tvContactTrainer.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String currentUserId = getLoggedInUserId();
            if (currentUserId.equals("")) {
              // Start login activity
              Intent intent = new Intent(getBaseContext(), LoginActivity.class);
              startActivityForResult(intent, LOGIN_FOR_CHAT_ACTIVITY_ID);
            } else {
              getCurrentUserAndStartChat(currentUserId);
            }
          }
        });

    // added by neeraja for booking slots starts
    bBookSlot = (Button) findViewById(R.id.bBookSlot);
    bBookSlot.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Trainer.currentTrainerObjectId = trainerId;
            Trainer.currentTrainerName = m_trainer.getName();
            Trainer.currentPrice = m_trainer.getPrice();
            Intent intent = new Intent(getBaseContext(), BlockSlotActivity.class);
            startActivity(intent);
          }
        });
    // added by neeraja for booking slots ends

    setupViewPager();
  }