Ejemplo n.º 1
0
  public void setRowData(GuideInfo guideInfo) {
    mGuideInfo = guideInfo;
    setTag(mGuideInfo.mGuideid);

    mTitleView.setText(Html.fromHtml(mGuideInfo.mTitle));

    if (mThumbnail != null) {
      Picasso picasso = PicassoUtils.with(mContext);

      Transformation transform = new RoundedTransformation(4, 0);

      if (mGuideInfo.hasImage()) {
        picasso
            .load(mGuideInfo.getImagePath(ImageSizes.guideList))
            .noFade()
            .fit()
            .transform(transform)
            .error(R.drawable.no_image)
            .into(mThumbnail);
      } else {
        picasso.load(R.drawable.no_image).noFade().fit().transform(transform).into(mThumbnail);
      }
    }

    setPublished(mGuideInfo.mPublic);
  }
Ejemplo n.º 2
0
  private void publishGuide() {
    App.sendEvent("ui_action", "button_press", "publish_guide", (long) mGuideInfo.mGuideid);

    // Ignore button press if we are already (un)publishing the guide.
    if (mGuideInfo.mIsPublishing) {
      return;
    }

    mGuideInfo.mIsPublishing = true;
    mPublishText.setText(mGuideInfo.mPublic ? R.string.unpublishing : R.string.publishing);
    mPublishText.setTextColor(getResources().getColor(R.color.text_light));

    if (!mGuideInfo.mPublic) {
      Api.call(mActivity, ApiCall.publishGuide(mGuideInfo.mGuideid, mGuideInfo.mRevisionid));
    } else {
      Api.call(mActivity, ApiCall.unpublishGuide(mGuideInfo.mGuideid, mGuideInfo.mRevisionid));
    }
  }