Пример #1
0
  @Override
  public View getItemView(Issue issue, View v, ViewGroup parent) {
    if (v == null) {
      v = View.inflate(getContext(), R.layout.layout_issue_row, null);
    }

    super.getItemView(issue, v, parent);

    ParseImageView issueImage = (ParseImageView) v.findViewById(R.id.list_issue_image);
    ParseFile photoFile = issue.getParseFile("photo");
    if (photoFile != null) {
      issueImage.setParseFile(photoFile);
      issueImage.loadInBackground(
          new GetDataCallback() {
            @Override
            public void done(byte[] data, ParseException e) {
              // nothing to do
            }
          });
    }

    TextView titleTextView = (TextView) v.findViewById(R.id.list_issue_title);
    titleTextView.setText(issue.getTitle());
    TextView issueDescriptionTextView = (TextView) v.findViewById(R.id.list_issue_description);
    issueDescriptionTextView.setText(issue.getDescription());
    TextView issueBidTextView = (TextView) v.findViewById(R.id.list_issue_bid);
    issueBidTextView.setText(String.valueOf(issue.getBid()));

    return v;
  }
 private void setLogoImage(ParseFile logoImage) {
   if (logoImage != null) {
     mLogoImageButton.setParseFile(logoImage);
     mLogoImageButton.loadInBackground();
   } else {
     String title = mTitleText.getText().toString();
     String firstChar = title.isEmpty() ? "N" : title.substring(0, 1).toUpperCase();
     ColorGenerator generator = ColorGenerator.MATERIAL;
     int alphabetColor = generator.getColor(firstChar);
     final TextDrawable drawable = TextDrawable.builder().buildRound(firstChar, alphabetColor);
     mLogoImageButton.setImageDrawable(drawable);
   }
 }
  @Override
  public View getView(int position, View view, ViewGroup parent) {
    // TODO Auto-generated method stub
    View row = view;
    position1 = position;

    String productname;
    if (row == null) {
      row = inflater.inflate(R.layout.imagecell, null);

      final TextView txtproductid = (TextView) row.findViewById(R.id._productid);
      TextView txtView = (TextView) row.findViewById(R.id._productName);
      TextView txtproductcost = (TextView) row.findViewById(R.id._productcost);
      ParseImageView imgView = (ParseImageView) row.findViewById(R.id._image);

      p = data.get(position);

      ParseFile image = (ParseFile) p.getImage();
      imgView.setParseFile(image);
      imgView.loadInBackground(
          new GetDataCallback() {

            @Override
            public void done(byte[] data, ParseException e) {
              // TODO Auto-generated method stub

            }
          });

      txtproductid.setText(p.getObjectId());
      txtView.setText(p.getName());
      txtproductcost.setText("$ " + Double.toString(p.getPrice()));
      imgView.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
              Bundle args = new Bundle();
              FragmentManager fragmanager = ((Activity) context).getFragmentManager();
              Fragment productdetail = new ProductDetailFragment();
              FragmentTransaction fragtrans = fragmanager.beginTransaction();
              args.putString("productid", txtproductid.getText().toString());
              productdetail.setArguments(args);
              fragtrans.replace(R.id.content_frame, productdetail).addToBackStack(null).commit();
            }
          });
    }

    return row;
  }
  @Override
  public View getItemView(final Stamp stamp, View v, ViewGroup parent) {

    if (v == null) {
      v = View.inflate(getContext(), R.layout.image, null);
    }

    super.getItemView(stamp, v, parent);

    ParseImageView stampImage = (ParseImageView) v.findViewById(R.id.image_view);
    ParseFile photoFile = stamp.getPhotoFile();
    if (photoFile != null) {
      stampImage.setParseFile(photoFile);
      stampImage.loadInBackground(
          new GetDataCallback() {
            @Override
            public void done(byte[] data, ParseException e) {
              // nothing to do
            }
          });
    }

    CardView card = (CardView) v.findViewById(R.id.image_card);
    card.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(cont, PgStampInfoActivity.class);
            /*
            event.getObjectId();
            stamp.getObjectId();
            String stampId = item.getID();
            ArrayList<String> stampIdList = getStampObjectIdArrayList();
            int pos = stampIdList.indexOf(stampId);
            intent.putExtra("clicked_stamp_pos", pos);
            intent.putExtra("stamp_id_list", stampIdList);*/
            cont.startActivity(intent);
          }
        });
    return v;
  }