Esempio n. 1
0
    @Override
    public void onClick(View view) {
      switch (view.getId()) {
        case R.id.profile_image:
          {
            break;
          }

        case R.id.iv_content:
          {
            try {
              /* Intent intent = new Intent(context, CardActivity.class);
              RVCardData selectedCard = cardData.get(getAdapterPosition());
              intent.putExtra(USER_ID, selectedCard.getUserID());
              intent.putExtra(Date, selectedCard.getDate());
              intent.putExtra(PROFILE_IMAGE_URL, selectedCard.getImageProfileUrl());
              intent.putExtra(TITLE, selectedCard.getTextTitle());
              intent.putExtra(CONTENT_IMAGE_URL, selectedCard.getImageMainUrl());
              intent.putExtra(TEXT_CONTENT, selectedCard.getTextContent());
              intent.putExtra(LIKE, selectedCard.getLike());
              intent.putExtra("video_url", selectedCard.getVideoUrl());
              //intent.putExtra("location_url", selectedCard.getLocationUrl());
              context.startActivity(intent);*/
              Intent intent = new Intent(Intent.ACTION_VIEW);
              RVCardData selectedCard = cardData.get(getAdapterPosition());
              Uri data = Uri.parse(selectedCard.getVideoUrl());
              intent.setDataAndType(data, "video/mp4");
              context.startActivity(intent);
            } catch (Exception e) {
              Log.d(TAG, e.getMessage());
            }
            break;
          }
        case R.id.share:
          {
            Intent intent = new Intent(context, MapboxActivity.class);
            RVCardData selectedCard = cardData.get(getAdapterPosition());
            intent.putExtra(LOCATION, selectedCard.getLocationUrl());
            intent.putExtra(EMOTiON, selectedCard.getEmotion());
            context.startActivity(intent);
            break;
          }

        case R.id.iv_re:
          {
            Toast.makeText(context, "준비중", Toast.LENGTH_LONG).show();
            break;
          }

        case R.id.iv_like:
          {
            Toast.makeText(context, "준비중", Toast.LENGTH_LONG).show();
            break;
          }
      }
    }
Esempio n. 2
0
  @Override
  public void onBindViewHolder(final RVAdapter.RVViewHolder holder, int position) {

    RVCardData curData = new RVCardData();
    curData = cardData.get(position);
    // getJSONFromUrl(curData.getLocationUrl());
    holder.userID.setText(curData.getUserID());
    holder.date.setText(curData.getDate());
    holder.textContent.setText(curData.getTextContent());
    holder.location.setText(curData.getAddress());
    /*        try {
        points = parseJsonLocation(resultJson);
        holder.location.setText(getAddress(points.get(0).getLatitude(), points.get(0).getLongitude()));
    }catch (Exception e){
        Log.i(TAG, e.toString());
    }*/
    String imageProfileUrl = curData.getImageProfileUrl();
    Log.i(TAG, "profile url : " + imageProfileUrl);
    if (imageProfileUrl != null) {
      imageLoader.get(
          imageProfileUrl,
          new ImageLoader.ImageListener() {
            @Override
            public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
              holder.ivProfile.setImageBitmap(response.getBitmap());
            }

            @Override
            public void onErrorResponse(VolleyError error) {
              Log.i(TAG, "profile error");
              holder.ivProfile.setImageResource(R.drawable.profile);
            }
          });
    }

    String imageContentUrl = curData.getImageMainUrl();
    if (imageContentUrl != null) {
      imageLoader.get(
          imageContentUrl,
          new ImageLoader.ImageListener() {
            @Override
            public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
              holder.ivContent.setImageBitmap(response.getBitmap());
            }

            @Override
            public void onErrorResponse(VolleyError error) {
              holder.ivContent.setImageResource(R.drawable.image3);
            }
          });
    }

    Log.i("uks", "onBindViewHolder()");
    // 여기서 리스너 달아도 됨
  }