本文整理汇总了Java中com.contentful.vault.Asset类的典型用法代码示例。如果您正苦于以下问题:Java Asset类的具体用法?Java Asset怎么用?Java Asset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Asset类属于com.contentful.vault包,在下文中一共展示了Asset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEventListWithImages
import com.contentful.vault.Asset; //导入依赖的package包/类
private List<EventModel> createEventListWithImages(List<Event> eventList) {
List<EventModel> eventModels = new ArrayList<>();
for (final Event event : eventList) {
final GoogleDeveloperGroup gdg = event.gdg().get(0);
final EventModel.Builder builder = new EventModel.Builder()
.setId(event.remoteId())
.setName(event.name())
.setDescription(event.description())
.setDate(event.date())
.setPlace(event.place())
.setGdgName(gdg.name());
for (Asset sphere : event.spheres()) {
builder.addPhotoSphereUrl(sphere.url());
}
if (gdg.logo() != null) {
builder.setGroupLogoUrl(gdg.logo().url());
}
eventModels.add(builder.build());
}
return eventModels;
}
示例2: bindView
import com.contentful.vault.Asset; //导入依赖的package包/类
@Override protected void bindView(ViewHolder holder, Product product, View rootView) {
List<Asset> images = product.images();
if (images.size() == 0) {
holder.photo.setImageDrawable(null);
} else {
Picasso.with(rootView.getContext())
.load(images.get(0).url())
.fit()
.centerInside()
.transform(new CircleTransform())
.into(holder.photo);
}
holder.title.setText(product.name());
holder.price.setText(getPriceText(product.price()));
}
示例3: checkParcelable
import com.contentful.vault.Asset; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void checkParcelable(Asset source) {
Parcel parcel = Parcel.obtain();
source.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
Asset reconstructed = Asset.CREATOR.createFromParcel(parcel);
assertThat(reconstructed).isNotNull();
assertThat(source.url()).isEqualTo(reconstructed.url());
assertThat(source.mimeType()).isEqualTo(reconstructed.mimeType());
assertThat(source.title()).isEqualTo(reconstructed.title());
assertThat(source.description()).isEqualTo(reconstructed.description());
assertThat((Iterable<String>) source.file().keySet())
.containsAllIn(reconstructed.file().keySet());
assertThat((Iterable) source.file().keySet()).hasSize(reconstructed.file().keySet().size());
assertThat((Iterable<Object>) source.file().values())
.containsAllIn(reconstructed.file().values());
assertThat((Iterable) source.file().values()).hasSize(reconstructed.file().values().size());
}
示例4: assertInitialAssets
import com.contentful.vault.Asset; //导入依赖的package包/类
protected void assertInitialAssets() {
List<Asset> assets = vault.fetch(Asset.class)
.order(CREATED_AT)
.all();
assertThat(assets).isNotNull();
assertThat(assets).hasSize(4);
assertThat(assets.get(0).remoteId()).isEqualTo("nyancat");
assertThat(assets.get(1).remoteId()).isEqualTo("jake");
assertThat(assets.get(2).remoteId()).isEqualTo("happycat");
assertThat(assets.get(2).url()).isEqualTo("http://happycat.jpg");
assertThat(assets.get(3).remoteId()).isEqualTo("1x0xpXu4pSGS4OukSyWGUK");
for (Asset asset : assets) {
assertThat(asset.url()).isNotNull();
assertThat(asset.mimeType()).isNotNull();
assertThat(asset.remoteId()).isNotNull();
assertThat(asset.updatedAt()).isNotNull();
}
}
示例5: assertUpdateAssets
import com.contentful.vault.Asset; //导入依赖的package包/类
protected void assertUpdateAssets() {
List<Asset> assets = vault.fetch(Asset.class)
.order(CREATED_AT)
.all();
assertThat(assets).isNotNull();
assertThat(assets).hasSize(3);
assertThat(assets.get(0).remoteId()).isEqualTo("nyancat");
assertThat(assets.get(1).remoteId()).isEqualTo("happycat");
assertThat(assets.get(1).url()).isEqualTo("http://happiercat.jpg");
assertThat(assets.get(2).remoteId()).isEqualTo("1x0xpXu4pSGS4OukSyWGUK");
for (Asset asset : assets) {
assertThat(asset.url()).isNotNull();
assertThat(asset.mimeType()).isNotNull();
assertThat(asset.remoteId()).isNotNull();
assertThat(asset.updatedAt()).isNotNull();
}
}
示例6: initAdapter
import com.contentful.vault.Asset; //导入依赖的package包/类
private void initAdapter() {
adapter = new ImagePagerAdapter();
List<String> urls = new ArrayList<>();
for (Asset asset : product.images()) {
urls.add(asset.url());
}
adapter.setUrls(urls);
}
示例7: testAssetMetadata
import com.contentful.vault.Asset; //导入依赖的package包/类
@Test public void testAssetMetadata() throws Exception {
enqueueInitial();
sync();
List<Asset> assets = vault.fetch(Asset.class)
.order(CREATED_AT)
.all();
assertThat(assets).isNotNull();
assertThat(assets).hasSize(4);
assertThat(assets.get(0).title()).isEqualTo("Nyan Cat");
assertThat(assets.get(0).description()).isNull();
assertThat(assets.get(0).file()).hasSize(4);
assertThat(assets.get(1).title()).isEqualTo("Jake");
assertThat(assets.get(1).description()).isNull();
assertThat(assets.get(1).file()).hasSize(4);
assertThat(assets.get(2).title()).isEqualTo("Happy Cat");
assertThat(assets.get(2).description()).isNull();
assertThat(assets.get(2).file()).hasSize(4);
assertThat(assets.get(3).title()).isEqualTo("Doge");
assertThat(assets.get(3).description()).isEqualTo("nice picture");
assertThat(assets.get(3).file()).hasSize(4);
}
示例8: setField
import com.contentful.vault.Asset; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean setField(Test.AwesomeModel resource, String name, Object value) {
if ("textField".equals(name)) {
resource.textField = (String) value;
}
else if ("booleanField".equals(name)) {
resource.booleanField = (Boolean) value;
}
else if ("integerField".equals(name)) {
resource.integerField = (Integer) value;
}
else if ("doubleField".equals(name)) {
resource.doubleField = (Double) value;
}
else if ("mapField".equals(name)) {
resource.mapField = (Map) value;
}
else if ("assetLink".equals(name)) {
resource.assetLink = (Asset) value;
}
else if ("entryLink".equals(name)) {
resource.entryLink = (Test.AwesomeModel) value;
}
else if ("arrayOfAssets".equals(name)) {
resource.arrayOfAssets = (List<Asset>) value;
}
else if ("arrayOfModels".equals(name)) {
resource.arrayOfModels = (List<Test.AwesomeModel>) value;
}
else if ("arrayOfSymbols".equals(name)) {
resource.arrayOfSymbols = (List<String>) value;
}
else {
return false;
}
return true;
}
示例9: populate
import com.contentful.vault.Asset; //导入依赖的package包/类
public void populate(Author author) {
Asset asset = author.profilePhoto();
if (asset != null) {
Picasso.with(getContext()).load(asset.url()).fit().centerInside().into(photo);
}
name.setText(author.name());
bio.setText(author.biography());
}
示例10: PostLoader
import com.contentful.vault.Asset; //导入依赖的package包/类
public PostLoader(Post post) {
postTitle = defaultString(post.title(), "");
postBody = defaultString(post.body(), "");
postDate = post.date();
Asset image = post.featuredImage();
postImage = image == null ? null : image.url();
List<Author> authors = post.authors();
if (authors.size() == 0) {
author = null;
} else {
author = authors.get(0);
}
}
示例11: meshFile
import com.contentful.vault.Asset; //导入依赖的package包/类
public Asset meshFile() {
return meshFile;
}
示例12: previewMeshFile
import com.contentful.vault.Asset; //导入依赖的package包/类
public Asset previewMeshFile() {
return previewMeshFile;
}
示例13: textures
import com.contentful.vault.Asset; //导入依赖的package包/类
public List<Asset> textures() {
return textures;
}
示例14: logo
import com.contentful.vault.Asset; //导入依赖的package包/类
public Asset logo() {
return logo;
}
示例15: spheres
import com.contentful.vault.Asset; //导入依赖的package包/类
public List<Asset> spheres() {
return spheres;
}