Example #1
0
  @Click(R.id.iconCompartilhar)
  public void compartilharLive() {
    final String shareEventoMessage = "TESTANDO COMPARTILHAMENTO - ";

    imageLoader.get(
        Constants.PATH_IMAGE + evento.getImagemUrl(),
        new ImageLoader.ImageListener() {

          @Override
          public void onErrorResponse(VolleyError error) {
            Log.e("ShareError", error.getMessage());
          }

          @Override
          public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {

            Bitmap mBitmap = response.getBitmap();
            ContentValues image = new ContentValues();
            image.put(MediaStore.Images.Media.MIME_TYPE, "image/jpg");
            Uri uri =
                getContext()
                    .getApplicationContext()
                    .getContentResolver()
                    .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, image);

            try {
              OutputStream out =
                  getContext().getApplicationContext().getContentResolver().openOutputStream(uri);
              boolean success = mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
              out.close();
              if (success) {

                Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("text/plain");

                intent.putExtra(Intent.EXTRA_SUBJECT, evento.getNomeEvento() + " - App LiveParty");
                intent.putExtra(Intent.EXTRA_TEXT, shareEventoMessage + evento.getDescricao());
                intent.putExtra(Intent.EXTRA_STREAM, uri);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                getContext()
                    .startActivity(
                        Intent.createChooser(
                            intent, getContext().getString(R.string.text_share_with)));

              } else {
                Log.e("ErrorLoadImage", "Is not possible load at the image");
              }

            } catch (Exception e) {
              Log.e("ErrorLoadImage", e.toString());
            }
          }
        });
  }
Example #2
0
 public void bind(EventoDto evento) {
   this.evento = evento;
   thumbnail.setImageUrl(Constants.PATH_IMAGE + evento.getImagemUrl(), imageLoader);
   nomeEvento.setText(evento.getNomeEvento());
   localEvento.setText(evento.getNomeInstituicao());
   dataEvento.setText(
       TreatDate.formatTime(TreatDate.parseDateTime(evento.getDataInicio()))
           + " - "
           + TreatDate.formatTime(TreatDate.parseDateTime(evento.getDataInicio())));
   likeView.setLikeViewStyle(LikeView.Style.BOX_COUNT);
   likeView.setObjectIdAndType(evento.getUrlFacebookEvento(), LikeView.ObjectType.DEFAULT);
 }