use of org.telegram.ui.Cells.EmptyCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class LocationActivityAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch(viewType) {
case 0:
// view = emptyCell = new EmptyCell(mContext) {
// @Override
// public ViewPropertyAnimator animate() {
// ViewPropertyAnimator animator = super.animate();
// if (Build.VERSION.SDK_INT >= 19) {
// animator.setUpdateListener(animation -> {
// if (updateRunnable != null) {
// updateRunnable.run();
// }
// });
// }
// return animator;
// }
// };
view = emptyCell = new FrameLayout(mContext);
emptyCell.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, overScrollHeight));
break;
case 1:
view = new SendLocationCell(mContext, false, resourcesProvider);
break;
case 2:
view = new HeaderCell(mContext, resourcesProvider);
break;
case 3:
LocationCell locationCell = new LocationCell(mContext, false, resourcesProvider);
view = locationCell;
break;
case 4:
view = new LocationLoadingCell(mContext, resourcesProvider);
break;
case 5:
view = new LocationPoweredCell(mContext, resourcesProvider);
break;
case 6:
{
SendLocationCell cell = new SendLocationCell(mContext, true, resourcesProvider);
cell.setDialogId(dialogId);
view = cell;
break;
}
case 7:
view = new SharingLiveLocationCell(mContext, true, locationType == LocationActivity.LOCATION_TYPE_GROUP || locationType == LocationActivity.LOCATION_TYPE_GROUP_VIEW ? 16 : 54, resourcesProvider);
break;
case 8:
{
LocationDirectionCell cell = new LocationDirectionCell(mContext, resourcesProvider);
cell.setOnButtonClick(v -> onDirectionClick());
view = cell;
break;
}
case 9:
{
view = new ShadowSectionCell(mContext);
Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow);
CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable);
combinedDrawable.setFullsize(true);
view.setBackgroundDrawable(combinedDrawable);
break;
}
case 10:
default:
{
view = new View(mContext);
break;
}
}
return new RecyclerListView.Holder(view);
}
use of org.telegram.ui.Cells.EmptyCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class DrawerLayoutAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch(viewType) {
case 0:
view = profileCell = new DrawerProfileCell(mContext);
break;
case 2:
view = new DividerCell(mContext);
break;
case 3:
view = new DrawerActionCell(mContext);
break;
case 4:
view = new DrawerUserCell(mContext);
break;
case 5:
view = new DrawerAddCell(mContext);
break;
case 1:
default:
view = new EmptyCell(mContext, AndroidUtilities.dp(8));
break;
}
view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
return new RecyclerListView.Holder(view);
}
use of org.telegram.ui.Cells.EmptyCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class StickersSearchAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = null;
switch(viewType) {
case 0:
StickerEmojiCell stickerEmojiCell = new StickerEmojiCell(context, false) {
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(82), MeasureSpec.EXACTLY));
}
};
view = stickerEmojiCell;
stickerEmojiCell.getImageView().setLayerNum(3);
break;
case 1:
view = new EmptyCell(context);
break;
case 2:
view = new StickerSetNameCell(context, false, true, resourcesProvider);
break;
case 3:
view = new FeaturedStickerSetInfoCell(context, 17, true, true, resourcesProvider);
((FeaturedStickerSetInfoCell) view).setAddOnClickListener(v -> {
final FeaturedStickerSetInfoCell cell = (FeaturedStickerSetInfoCell) v.getParent();
TLRPC.StickerSetCovered pack = cell.getStickerSet();
if (pack == null || installingStickerSets.indexOfKey(pack.set.id) >= 0 || removingStickerSets.indexOfKey(pack.set.id) >= 0) {
return;
}
if (cell.isInstalled()) {
removingStickerSets.put(pack.set.id, pack);
delegate.onStickerSetRemove(cell.getStickerSet());
} else {
installStickerSet(pack, cell);
}
});
break;
case 4:
view = new View(context);
break;
case 5:
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setGravity(Gravity.CENTER);
emptyImageView = new ImageView(context);
emptyImageView.setScaleType(ImageView.ScaleType.CENTER);
emptyImageView.setImageResource(R.drawable.stickers_empty);
emptyImageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_emojiPanelEmptyText), PorterDuff.Mode.MULTIPLY));
layout.addView(emptyImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
layout.addView(new Space(context), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 15));
emptyTextView = new TextView(context);
emptyTextView.setText(LocaleController.getString("NoStickersFound", R.string.NoStickersFound));
emptyTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
emptyTextView.setTextColor(getThemedColor(Theme.key_chat_emojiPanelEmptyText));
layout.addView(emptyTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
view = layout;
view.setMinimumHeight(AndroidUtilities.dp(112));
view.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
break;
}
return new RecyclerListView.Holder(view);
}
use of org.telegram.ui.Cells.EmptyCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class MessageStatisticActivity method recolorRecyclerItem.
private void recolorRecyclerItem(View child) {
if (child instanceof ManageChatUserCell) {
((ManageChatUserCell) child).update(0);
} else if (child instanceof StatisticActivity.BaseChartCell) {
((StatisticActivity.BaseChartCell) child).recolor();
child.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
} else if (child instanceof ShadowSectionCell) {
Drawable shadowDrawable = Theme.getThemedDrawable(ApplicationLoader.applicationContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow);
Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray));
CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0);
combinedDrawable.setFullsize(true);
child.setBackground(combinedDrawable);
} else if (child instanceof ChartHeaderView) {
((ChartHeaderView) child).recolor();
} else if (child instanceof OverviewCell) {
((OverviewCell) child).updateColors();
child.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
}
if (child instanceof EmptyCell) {
child.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
}
}
Aggregations