本文整理汇总了Java中io.plaidapp.data.api.dribbble.model.Shot类的典型用法代码示例。如果您正苦于以下问题:Java Shot类的具体用法?Java Shot怎么用?Java Shot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Shot类属于io.plaidapp.data.api.dribbble.model包,在下文中一共展示了Shot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (getItemViewType(position)) {
case TYPE_DESIGNER_NEWS_STORY:
bindDesignerNewsStory((Story) getItem(position), (DesignerNewsStoryHolder) holder);
break;
case TYPE_DRIBBBLE_SHOT:
bindDribbbleShotHolder((Shot) getItem(position), (DribbbleShotHolder) holder);
break;
case TYPE_PRODUCT_HUNT_POST:
bindProductHuntPostView((Post) getItem(position), (ProductHuntStoryHolder) holder);
break;
case TYPE_LOADING_MORE:
bindLoadingViewHolder((LoadingMoreHolder) holder);
break;
}
}
示例2: onBindViewHolder
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (getItemViewType(position)) {
case TYPE_DESIGNER_NEWS_STORY:
bindDesignerNewsStory((Story) getItem(position), (DesignerNewsStoryHolder) holder);
break;
case TYPE_DRIBBBLE_SHOT:
bindDribbbleShotHolder(
(Shot) getItem(position), (DribbbleShotHolder) holder, position);
break;
case TYPE_PRODUCT_HUNT_POST:
bindProductHuntPostView((Post) getItem(position), (ProductHuntStoryHolder) holder);
break;
case TYPE_LOADING_MORE:
bindLoadingViewHolder((LoadingMoreHolder) holder, position);
break;
}
}
示例3: convert
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@Override
public List<Shot> convert(ResponseBody value) throws IOException {
final Elements shotElements =
Jsoup.parse(value.string(), HOST).select("li[id^=screenshot]");
final List<Shot> shots = new ArrayList<>(shotElements.size());
for (Element element : shotElements) {
final Shot shot = parseShot(element, DATE_FORMAT);
if (shot != null) {
shots.add(shot);
}
}
return shots;
}
示例4: parseShot
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
private static Shot parseShot(Element element, SimpleDateFormat dateFormat) {
final Element descriptionBlock = element.select("a.dribbble-over").first();
// API responses wrap description in a <p> tag. Do the same for consistent display.
String description = descriptionBlock.select("span.comment").text().trim();
if (!TextUtils.isEmpty(description)) {
description = "<p>" + description + "</p>";
}
String imgUrl = element.select("img").first().attr("src");
if (imgUrl.contains("_teaser.")) {
imgUrl = imgUrl.replace("_teaser.", ".");
}
Date createdAt = null;
try {
createdAt = dateFormat.parse(descriptionBlock.select("em.timestamp").first().text());
} catch (ParseException e) { }
return new Shot.Builder()
.setId(Long.parseLong(element.id().replace("screenshot-", "")))
.setHtmlUrl(HOST + element.select("a.dribbble-link").first().attr("href"))
.setTitle(descriptionBlock.select("strong").first().text())
.setDescription(description)
.setImages(new Images(null, imgUrl, null))
.setAnimated(element.select("div.gif-indicator").first() != null)
.setCreatedAt(createdAt)
.setLikesCount(Long.parseLong(element.select("li.fav").first().child(0).text()
.replaceAll(",", "")))
.setCommentsCount(Long.parseLong(element.select("li.cmnt").first().child(0).text
().replaceAll(",", "")))
.setViewsCount(Long.parseLong(element.select("li.views").first().child(0)
.text().replaceAll(",", "")))
.setUser(parsePlayer(element.select("h2").first()))
.build();
}
示例5: getItemViewType
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@Override
public int getItemViewType(int position) {
if (position < getDataItemCount()
&& getDataItemCount() > 0) {
PlaidItem item = getItem(position);
if (item instanceof Story) {
return TYPE_DESIGNER_NEWS_STORY;
} else if (item instanceof Shot) {
return TYPE_DRIBBBLE_SHOT;
} else if (item instanceof Post) {
return TYPE_PRODUCT_HUNT_POST;
}
}
return TYPE_LOADING_MORE;
}
示例6: expandPopularItems
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
private void expandPopularItems() {
// for now just expand the first dribbble image per page which should be
// the most popular according to our weighing & sorting
List<Integer> expandedPositions = new ArrayList<>();
int page = -1;
final int count = items.size();
for (int i = 0; i < count; i++) {
PlaidItem item = getItem(i);
if (item instanceof Shot && item.page > page) {
item.colspan = columns;
page = item.page;
expandedPositions.add(i);
} else {
item.colspan = 1;
}
}
// make sure that any expanded items are at the start of a row
// so that we don't leave any gaps in the grid
for (int expandedPos = 0; expandedPos < expandedPositions.size(); expandedPos++) {
int pos = expandedPositions.get(expandedPos);
int extraSpannedSpaces = expandedPos * (columns - 1);
int rowPosition = (pos + extraSpannedSpaces) % columns;
if (rowPosition != 0) {
int swapWith = pos + (columns - rowPosition);
if (swapWith < items.size()) {
Collections.swap(items, pos, swapWith);
}
}
}
}
示例7: start
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
public static void start(Activity launching, Shot shot) {
Intent starter = new Intent(launching, PlayerSheet.class);
starter.putExtra(EXTRA_MODE, MODE_SHOT_LIKES);
starter.putExtra(EXTRA_SHOT, shot);
launching.startActivity(starter,
ActivityOptions.makeSceneTransitionAnimation(launching).toBundle());
}
示例8: FeedAdapter
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
FeedAdapter(Activity hostActivity,
@Nullable DataLoadingSubject dataLoading,
int columns,
boolean pocketInstalled, ViewPreloadSizeProvider<Shot> shotPreloadSizeProvider) {
this.host = hostActivity;
this.dataLoading = dataLoading;
if (dataLoading != null) {
dataLoading.registerCallback(this);
}
this.columns = columns;
this.pocketIsInstalled = pocketInstalled;
this.shotPreloadSizeProvider = shotPreloadSizeProvider;
layoutInflater = LayoutInflater.from(host);
comparator = new PlaidItemSorting.PlaidItemComparator();
items = new ArrayList<>();
setHasStableIds(true);
// get the dribbble shot placeholder colors & badge color from the theme
final TypedArray a = host.obtainStyledAttributes(R.styleable.DribbbleFeed);
final int loadingColorArrayId =
a.getResourceId(R.styleable.DribbbleFeed_shotLoadingPlaceholderColors, 0);
if (loadingColorArrayId != 0) {
int[] placeholderColors = host.getResources().getIntArray(loadingColorArrayId);
shotLoadingPlaceholders = new ColorDrawable[placeholderColors.length];
for (int i = 0; i < placeholderColors.length; i++) {
shotLoadingPlaceholders[i] = new ColorDrawable(placeholderColors[i]);
}
} else {
shotLoadingPlaceholders = new ColorDrawable[] { new ColorDrawable(Color.DKGRAY) };
}
final int initialGifBadgeColorId =
a.getResourceId(R.styleable.DribbbleFeed_initialBadgeColor, 0);
initialGifBadgeColor = initialGifBadgeColorId != 0 ?
ContextCompat.getColor(host, initialGifBadgeColorId) : 0x40ffffff;
a.recycle();
}
示例9: getPreloadItems
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@NonNull
@Override
public List<Shot> getPreloadItems(int position) {
PlaidItem item = getItem(position);
if (item instanceof Shot) {
return Collections.singletonList((Shot) item);
}
return Collections.emptyList();
}
示例10: getPopular
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@GET("v1/shots")
Call<List<Shot>> getPopular(@Query("page") Integer page,
@Query("per_page") Integer pageSize);
示例11: getRecent
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@GET("v1/shots?sort=recent")
Call<List<Shot>> getRecent(@Query("page") Integer page,
@Query("per_page") Integer pageSize);
示例12: getDebuts
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@GET("v1/shots?list=debuts")
Call<List<Shot>> getDebuts(@Query("page") Integer page,
@Query("per_page") Integer pageSize);
示例13: getAnimated
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@GET("v1/shots?list=animated")
Call<List<Shot>> getAnimated(@Query("page") Integer page,
@Query("per_page") Integer pageSize);
示例14: getShots
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@GET("v1/shots")
Call<List<Shot>> getShots(@Query("list") @ShotType String shotType,
@Query("timeframe") @ShotTimeframe String timeframe,
@Query("sort") @ShotSort String shotSort);
示例15: getShot
import io.plaidapp.data.api.dribbble.model.Shot; //导入依赖的package包/类
@GET("v1/shots/{id}")
Call<Shot> getShot(@Path("id") long shotId);