示例#1
0
  @Override
  public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    ParseObject message = mMessages.get(position);
    String messageType = message.getString(ParseConstant.KEY_FILE_TYPE);
    ParseFile file = message.getParseFile(ParseConstant.KEY_FILE);
    Uri fileUri = Uri.parse(file.getUrl());

    if (messageType.equals(ParseConstant.TYPE_IMAGE)) {
      Intent intent = new Intent(getActivity(), ViewimageActivity.class);
      intent.setData(fileUri);
      startActivity(intent);
    } else {
      Intent intent = new Intent(Intent.ACTION_VIEW, fileUri);
      intent.setDataAndType(fileUri, "video/*");
      startActivity(intent);
    }

    // Delete it
    List<String> ids = message.getList(ParseConstant.KEY_RECIPIENT_IDS);
    if (ids.size() == 1) {
      // last recipients
      message.deleteInBackground();
    } else {
      ids.remove(ParseUser.getCurrentUser().getObjectId());
      ArrayList<String> idsToRemove = new ArrayList<String>();
      idsToRemove.add(ParseUser.getCurrentUser().getObjectId());

      message.removeAll(ParseConstant.KEY_RECIPIENT_IDS, idsToRemove);
      message.saveInBackground();
    }
  }
    @Override
    public View getItemView(ParseObject object, View v, ViewGroup parent) {

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

      l_nome_pianta = (TextView) v.findViewById(R.id.l_nick_pianta);
      l_tipo_pianta = (TextView) v.findViewById(R.id.l_tipo_pianta);
      l_descrizione = (TextView) v.findViewById(R.id.l_descrizione);

      // Take advantage of ParseQueryAdapter's getItemView logic for
      // populating the main TextView/ImageView.
      // The IDs in your custom layout must match what ParseQueryAdapter expects
      // if it will be populating a TextView or ImageView for you.
      super.getItemView(object, v, parent);

      img_immagine = (ParseImageView) v.findViewById(R.id.img_avatar);
      img_immagine.setParseFile(object.getParseFile("Immagine"));
      img_immagine.loadInBackground();

      l_nome_pianta.setText(object.getString("Nome"));
      l_tipo_pianta.setText(object.getString("Tipo"));
      l_descrizione.setText(object.getString("Descrizione"));

      return v;
    }
示例#3
0
 public MoveVenue(ParseObject po) {
   venuePicture = po.getParseFile(MOVEVENUE_PICTURE);
   venueName = po.getString(MOVEVENUE_NAME);
 }