com.cloudinary.Url.publicId()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中com.cloudinary.Url.publicId()方法的一些代码示例,展示了Url.publicId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.publicId()方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:publicId

Url.publicId介绍

暂无

代码示例

代码示例来源:origin: cloudinary/cloudinary_android

/**
 * Generate the modified url.
 *
 * @param publicId The public id of the cloudinary resource
 * @param view     The view to adapt the resource dimensions to.
 * @param callback Callback to called when the modified Url is ready.
 */
public void generate(String publicId, final View view, final Callback callback) {
  generate(cloudinary.url().publicId(publicId), view, callback);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

publicId(publicId);

代码示例来源:origin: cloudinary/cloudinary_java

publicId(publicId);

代码示例来源:origin: cloudinary/cloudinary_android

@Override
public void onBindViewHolder(final EffectsGalleryAdapter.ImageViewHolder holder, int position) {
  EffectData data = images.get(position);
  holder.itemView.setTag(images.get(position));
  holder.nameTextView.setText(data.getName());
  // force image format (webp in this case) so that both video and images are downloaded as images.
  Url baseUrl = MediaManager.get().url().format("webp").resourceType(resourceType).publicId(data.getPublicId()).transformation(data.getTransformation());
  MediaManager.get().responsiveUrl(AUTO_FILL)
      .stepSize(50)
      .generate(baseUrl, holder.imageView, new ResponsiveUrl.Callback() {
        @Override
        public void onUrlReady(Url url) {
          Picasso.get().load(url.generate()).placeholder(R.drawable.placeholder).into(holder.imageView);
        }
      });
  if (selected != null && selected.equals(data)) {
    holder.selection.setVisibility(View.VISIBLE);
  } else {
    holder.selection.setVisibility(View.INVISIBLE);
  }
}

代码示例来源:origin: cloudinary/cloudinary_android

} else {
  String publicId = resource.getCloudinaryPublicId();
  Url url = MediaManager.get().url().publicId(publicId).resourceType(resource.getResourceType()).format("webp");
  MediaManager.get().responsiveUrl(ResponsiveUrl.Preset.AUTO_FILL)
      .generate(url, holder.imageView, new ResponsiveUrl.Callback() {

代码示例来源:origin: cloudinary/cloudinary_android

private void loadVideo(final EffectData data) {
  progressBar.setVisibility(View.VISIBLE);
  imageView.setVisibility(View.GONE);
  final DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "Cloudinary Sample App"), null);
  final ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
  Url baseUrl = MediaManager.get().url().resourceType("video").publicId(data.getPublicId()).transformation(data.getTransformation());
  MediaManager.get().responsiveUrl(exoPlayerView, baseUrl, FIT, new ResponsiveUrl.Callback() {
    @Override
    public void onUrlReady(Url url) {
      String urlString = url.generate();
      currentUrl = urlString;
      MediaSource videoSource = new ExtractorMediaSource(Uri.parse(urlString), dataSourceFactory, extractorsFactory, null, null);
      exoPlayer.addListener(listener);
      exoPlayer.prepare(videoSource);
    }
  });
}

代码示例来源:origin: cloudinary/cloudinary_android

private void loadImage(final EffectData data) {
  exoPlayer.removeListener(listener);
  exoPlayerView.setVisibility(View.GONE);
  progressBar.setVisibility(View.VISIBLE);
  final Picasso picasso = new Picasso.Builder(this).listener(new Picasso.Listener() {
    @Override
    public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
      showSnackBar("Error loading resource: " + exception.getMessage());
    }
  }).build();
  Url baseUrl = MediaManager.get().url().publicId(data.getPublicId()).transformation(data.getTransformation());
  MediaManager.get().responsiveUrl(imageView, baseUrl, FIT, new ResponsiveUrl.Callback() {
    @Override
    public void onUrlReady(Url url) {
      String uriString = url.generate();
      currentUrl = uriString;
      picasso.load(Uri.parse(uriString)).into(imageView, new Callback() {
        @Override
        public void onSuccess() {
          progressBar.setVisibility(View.GONE);
        }
        @Override
        public void onError(Exception e) {
          progressBar.setVisibility(View.GONE);
        }
      });
    }
  });
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testVideoTag() {
  String expectedUrl = VIDEO_UPLOAD_PATH + "movie";
  String expectedTag = "<video poster='%s.jpg'>" + "<source src='%s.webm' type='video/webm'>"
      + "<source src='%s.mp4' type='video/mp4'>"
      + "<source src='%s.ogv' type='video/ogg'>"
      + "</video>";
  expectedTag = String.format(expectedTag, expectedUrl, expectedUrl, expectedUrl, expectedUrl);
  assertEquals(expectedTag, cloudinary.url().videoTag("movie", emptyMap()));
  assertEquals(expectedTag, cloudinary.url().publicId("movie").videoTag());
  assertEquals(expectedTag, cloudinary.url().videoTag("movie"));
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
  public void testUrlCloneConfig(){
    // verify that secure (from url.config) is cloned as well:
    Url url = cloudinary.url().cloudName("cloud").format("frmt").publicId("123").secure(true);
    assertEquals("https://res.cloudinary.com/cloud/image/upload/123.frmt", url.clone().generate());
  }
}

代码示例来源:origin: cloudinary/cloudinary_java

actualTag = cloudinary.url().sourceTypes(new String[]{"mp4"})
    .poster(cloudinary.url()
        .publicId("my_poster")
        .format("jpg")
        .transformation(new Transformation().gravity("north")))

相关文章