本文整理汇总了Java中org.telegram.tgnet.TLRPC.StickerSetCovered方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.StickerSetCovered方法的具体用法?Java TLRPC.StickerSetCovered怎么用?Java TLRPC.StickerSetCovered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.StickerSetCovered方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcFeaturedStickersHash
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private static int calcFeaturedStickersHash(ArrayList<TLRPC.StickerSetCovered> sets) {
long acc = 0;
for (int a = 0; a < sets.size(); a++) {
TLRPC.StickerSet set = sets.get(a).set;
if (set.archived) {
continue;
}
int high_id = (int) (set.id >> 32);
int lower_id = (int) set.id;
acc = ((acc * 20261) + 0x80000000L + high_id) % 0x80000000L;
acc = ((acc * 20261) + 0x80000000L + lower_id) % 0x80000000L;
if (unreadStickerSets.contains(set.id)) {
acc = ((acc * 20261) + 0x80000000L + 1) % 0x80000000L;
}
}
return (int) acc;
}
示例2: updateRows
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateRows() {
rowCount = 0;
ArrayList<TLRPC.StickerSetCovered> stickerSets = StickersQuery.getFeaturedStickerSets();
if (!stickerSets.isEmpty()) {
stickersStartRow = rowCount;
stickersEndRow = rowCount + stickerSets.size();
rowCount += stickerSets.size();
stickersShadowRow = rowCount++;
} else {
stickersStartRow = -1;
stickersEndRow = -1;
stickersShadowRow = -1;
}
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
StickersQuery.markFaturedStickersAsRead(true);
}
示例3: onBindViewHolder
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (getItemViewType(position) == 0) {
ArrayList<TLRPC.StickerSetCovered> arrayList = StickersQuery.getFeaturedStickerSets();
FeaturedStickerSetCell cell = (FeaturedStickerSetCell) holder.itemView;
cell.setTag(position);
TLRPC.StickerSetCovered stickerSet = arrayList.get(position);
cell.setStickersSet(stickerSet, position != arrayList.size() - 1, unreadStickers != null && unreadStickers.contains(stickerSet.set.id));
boolean installing = installingStickerSets.containsKey(stickerSet.set.id);
if (installing && cell.isInstalled()) {
installingStickerSets.remove(stickerSet.set.id);
installing = false;
cell.setDrawProgress(false);
}
cell.setDrawProgress(installing);
}
}
示例4: setStickerSet
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setStickerSet(TLRPC.StickerSetCovered stickerSet, boolean unread) {
lastUpdateTime = System.currentTimeMillis();
nameTextView.setText(stickerSet.set.title);
infoTextView.setText(LocaleController.formatPluralString("Stickers", stickerSet.set.count));
if (unread) {
nameTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
} else {
nameTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
if (hasOnClick) {
addButton.setVisibility(VISIBLE);
if (isInstalled = StickersQuery.isStickerPackInstalled(stickerSet.set.id)) {
addButton.setBackgroundResource(R.drawable.del_states);
addButton.setText(LocaleController.getString("StickersRemove", R.string.StickersRemove).toUpperCase());
} else {
addButton.setBackgroundResource(R.drawable.add_states);
addButton.setText(LocaleController.getString("Add", R.string.Add).toUpperCase());
}
} else {
addButton.setVisibility(GONE);
}
set = stickerSet;
}
示例5: onBindViewHolder
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (getItemViewType(position) == 0) {
ArchivedStickerSetCell cell = (ArchivedStickerSetCell) holder.itemView;
cell.setTag(position);
TLRPC.StickerSetCovered stickerSet = sets.get(position);
cell.setStickersSet(stickerSet, position != sets.size() - 1, false);
cell.setChecked(StickersQuery.isStickerPackInstalled(stickerSet.set.id));
}
}
示例6: onBindViewHolder
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (holder.getItemViewType()) {
case 0:
TLRPC.Document sticker = (TLRPC.Document) cache.get(position);
((StickerEmojiCell) holder.itemView).setSticker(sticker, false);
break;
case 1:
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(82));
break;
case 2:
ArrayList<Long> unreadStickers = StickersQuery.getUnreadStickerSets();
TLRPC.StickerSetCovered stickerSetCovered = sets.get((Integer) cache.get(position));
boolean unread = unreadStickers != null && unreadStickers.contains(stickerSetCovered.set.id);
FeaturedStickerSetInfoCell cell = (FeaturedStickerSetInfoCell) holder.itemView;
cell.setStickerSet(stickerSetCovered, unread);
if (unread) {
StickersQuery.markFaturedStickersByIdAsRead(stickerSetCovered.set.id);
}
boolean installing = installingStickerSets.containsKey(stickerSetCovered.set.id);
boolean removing = removingStickerSets.containsKey(stickerSetCovered.set.id);
if (installing || removing) {
if (installing && cell.isInstalled()) {
installingStickerSets.remove(stickerSetCovered.set.id);
installing = false;
} else if (removing && !cell.isInstalled()) {
removingStickerSets.remove(stickerSetCovered.set.id);
removing = false;
}
}
cell.setDrawProgress(installing || removing);
break;
}
}
示例7: onBindViewHolder
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (stickerSetCovereds != null) {
switch (holder.getItemViewType()) {
case 0:
TLRPC.Document sticker = (TLRPC.Document) cache.get(position);
((StickerEmojiCell) holder.itemView).setSticker(sticker, false);
break;
case 1:
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(82));
break;
case 2:
TLRPC.StickerSetCovered stickerSetCovered = stickerSetCovereds.get((Integer) cache.get(position));
FeaturedStickerSetInfoCell cell = (FeaturedStickerSetInfoCell) holder.itemView;
cell.setStickerSet(stickerSetCovered, false);
/*boolean installing = installingStickerSets.containsKey(stickerSetCovered.set.id);
boolean removing = removingStickerSets.containsKey(stickerSetCovered.set.id);
if (installing || removing) {
if (installing && cell.isInstalled()) {
installingStickerSets.remove(stickerSetCovered.set.id);
installing = false;
} else if (removing && !cell.isInstalled()) {
removingStickerSets.remove(stickerSetCovered.set.id);
removing = false;
}
}
cell.setDrawProgress(installing || removing);*/
break;
}
} else {
((StickerEmojiCell) holder.itemView).setSticker(stickerSet.documents.get(position), showEmoji);
}
}
示例8: getFeaturedStickerSets
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static ArrayList<TLRPC.StickerSetCovered> getFeaturedStickerSets() {
return featuredStickerSets;
}
示例9: processLoadedFeaturedStickers
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private static void processLoadedFeaturedStickers(final ArrayList<TLRPC.StickerSetCovered> res, final ArrayList<Long> unreadStickers, final boolean cache, final int date, final int hash) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
loadingFeaturedStickers = false;
featuredStickersLoaded = true;
}
});
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
if (cache && (res == null || Math.abs(System.currentTimeMillis() / 1000 - date) >= 60 * 60) || !cache && res == null && hash == 0) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (res != null && hash != 0) {
loadFeaturedHash = hash;
}
loadFeaturesStickers(false, false);
}
}, res == null && !cache ? 1000 : 0);
if (res == null) {
return;
}
}
if (res != null) {
try {
final ArrayList<TLRPC.StickerSetCovered> stickerSetsNew = new ArrayList<>();
final HashMap<Long, TLRPC.StickerSetCovered> stickerSetsByIdNew = new HashMap<>();
for (int a = 0; a < res.size(); a++) {
TLRPC.StickerSetCovered stickerSet = res.get(a);
stickerSetsNew.add(stickerSet);
stickerSetsByIdNew.put(stickerSet.set.id, stickerSet);
}
if (!cache) {
putFeaturedStickersToCache(stickerSetsNew, unreadStickers, date, hash);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
unreadStickerSets = unreadStickers;
featuredStickerSetsById = stickerSetsByIdNew;
featuredStickerSets = stickerSetsNew;
loadFeaturedHash = hash;
loadFeaturedDate = date;
NotificationCenter.getInstance().postNotificationName(NotificationCenter.featuredStickersDidLoaded);
}
});
} catch (Throwable e) {
FileLog.e("tmessages", e);
}
} else if (!cache) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
loadFeaturedDate = date;
}
});
putFeaturedStickersToCache(null, null, date, 0);
}
}
});
}
示例10: getStickerSet
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.StickerSetCovered getStickerSet() {
return stickersSet;
}
示例11: setStickersSet
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setStickersSet(TLRPC.StickerSetCovered set, boolean divider, boolean unread) {
needDivider = divider;
stickersSet = set;
setWillNotDraw(!needDivider);
textView.setText(stickersSet.set.title);
if (unread) {
Drawable drawable = new Drawable() {
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
@Override
public void draw(Canvas canvas) {
paint.setColor(0xff44a8ea);
canvas.drawCircle(AndroidUtilities.dp(4), AndroidUtilities.dp(5), AndroidUtilities.dp(3), paint);
}
@Override
public void setAlpha(int alpha) {
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
}
@Override
public int getOpacity() {
return 0;
}
@Override
public int getIntrinsicWidth() {
return AndroidUtilities.dp(12);
}
@Override
public int getIntrinsicHeight() {
return AndroidUtilities.dp(8);
}
};
textView.setCompoundDrawablesWithIntrinsicBounds(LocaleController.isRTL ? null : drawable, null, LocaleController.isRTL ? drawable : null, null);
} else {
textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
}
valueTextView.setText(LocaleController.formatPluralString("Stickers", set.set.count));
if (set.cover != null && set.cover.thumb != null && set.cover.thumb.location != null) {
imageView.setImage(set.cover.thumb.location, null, "webp", null);
} else if (!set.covers.isEmpty()) {
imageView.setImage(set.covers.get(0).thumb.location, null, "webp", null);
}
}
示例12: getStickersSet
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.StickerSetCovered getStickersSet() {
return stickersSet;
}
示例13: getStickerSet
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.StickerSetCovered getStickerSet() {
return set;
}
示例14: notifyDataSetChanged
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void notifyDataSetChanged() {
if (trendingLoaded) {
return;
}
int width = getMeasuredWidth();
if (width == 0) {
width = AndroidUtilities.displaySize.x;
}
stickersPerRow = width / AndroidUtilities.dp(72);
trendingLayoutManager.setSpanCount(stickersPerRow);
cache.clear();
positionsToSets.clear();
sets.clear();
totalItems = 0;
int num = 0;
ArrayList<TLRPC.StickerSetCovered> packs = StickersQuery.getFeaturedStickerSets();
for (int a = 0; a < packs.size(); a++) {
TLRPC.StickerSetCovered pack = packs.get(a);
if (StickersQuery.isStickerPackInstalled(pack.set.id) || pack.covers.isEmpty() && pack.cover == null) {
continue;
}
sets.add(pack);
positionsToSets.put(totalItems, pack);
cache.put(totalItems++, num++);
int startRow = totalItems / stickersPerRow;
int count;
if (!pack.covers.isEmpty()) {
count = (int) Math.ceil(pack.covers.size() / (float) stickersPerRow);
for (int b = 0; b < pack.covers.size(); b++) {
cache.put(b + totalItems, pack.covers.get(b));
}
} else {
count = 1;
cache.put(totalItems, pack.cover);
}
for (int b = 0; b < count * stickersPerRow; b++) {
positionsToSets.put(totalItems + b, pack);
}
totalItems += count * stickersPerRow;
}
if (totalItems != 0) {
trendingLoaded = true;
}
super.notifyDataSetChanged();
}
示例15: notifyDataSetChanged
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void notifyDataSetChanged() {
if (stickerSetCovereds != null) {
int width = gridView.getMeasuredWidth();
if (width == 0) {
width = AndroidUtilities.displaySize.x;
}
stickersPerRow = width / AndroidUtilities.dp(72);
layoutManager.setSpanCount(stickersPerRow);
cache.clear();
positionsToSets.clear();
totalItems = 0;
stickersRowCount = 0;
for (int a = 0; a < stickerSetCovereds.size(); a++) {
TLRPC.StickerSetCovered pack = stickerSetCovereds.get(a);
if (pack.covers.isEmpty() && pack.cover == null) {
continue;
}
stickersRowCount += Math.ceil(stickerSetCovereds.size() / (float) stickersPerRow);
positionsToSets.put(totalItems, pack);
cache.put(totalItems++, a);
int startRow = totalItems / stickersPerRow;
int count;
if (!pack.covers.isEmpty()) {
count = (int) Math.ceil(pack.covers.size() / (float) stickersPerRow);
for (int b = 0; b < pack.covers.size(); b++) {
cache.put(b + totalItems, pack.covers.get(b));
}
} else {
count = 1;
cache.put(totalItems, pack.cover);
}
for (int b = 0; b < count * stickersPerRow; b++) {
positionsToSets.put(totalItems + b, pack);
}
totalItems += count * stickersPerRow;
}
} else {
totalItems = stickerSet != null ? stickerSet.documents.size() : 0;
}
super.notifyDataSetChanged();
}