Search in sources :

Example 1 with EmptyCell

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);
}
Also used : Context(android.content.Context) LocationActivity(org.telegram.ui.LocationActivity) Theme(org.telegram.ui.ActionBar.Theme) FrameLayout(android.widget.FrameLayout) AndroidUtilities(org.telegram.messenger.AndroidUtilities) ColorDrawable(android.graphics.drawable.ColorDrawable) LocaleController(org.telegram.messenger.LocaleController) LocationController(org.telegram.messenger.LocationController) HeaderCell(org.telegram.ui.Cells.HeaderCell) Drawable(android.graphics.drawable.Drawable) ArrayList(java.util.ArrayList) LocationDirectionCell(org.telegram.ui.Cells.LocationDirectionCell) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) SendLocationCell(org.telegram.ui.Cells.SendLocationCell) TLRPC(org.telegram.tgnet.TLRPC) Locale(java.util.Locale) View(android.view.View) MessageObject(org.telegram.messenger.MessageObject) RecyclerView(androidx.recyclerview.widget.RecyclerView) Build(android.os.Build) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) LocationLoadingCell(org.telegram.ui.Cells.LocationLoadingCell) LocationPoweredCell(org.telegram.ui.Cells.LocationPoweredCell) R(org.telegram.messenger.R) TextUtils(android.text.TextUtils) SharingLiveLocationCell(org.telegram.ui.Cells.SharingLiveLocationCell) ViewGroup(android.view.ViewGroup) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) UserConfig(org.telegram.messenger.UserConfig) LocationCell(org.telegram.ui.Cells.LocationCell) ViewPropertyAnimator(android.view.ViewPropertyAnimator) Location(android.location.Location) EmptyCell(org.telegram.ui.Cells.EmptyCell) RecyclerListView(org.telegram.ui.Components.RecyclerListView) SharingLiveLocationCell(org.telegram.ui.Cells.SharingLiveLocationCell) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) HeaderCell(org.telegram.ui.Cells.HeaderCell) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) LocationLoadingCell(org.telegram.ui.Cells.LocationLoadingCell) LocationDirectionCell(org.telegram.ui.Cells.LocationDirectionCell) ColorDrawable(android.graphics.drawable.ColorDrawable) FrameLayout(android.widget.FrameLayout) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) RecyclerView(androidx.recyclerview.widget.RecyclerView) LocationPoweredCell(org.telegram.ui.Cells.LocationPoweredCell) SendLocationCell(org.telegram.ui.Cells.SendLocationCell) SharingLiveLocationCell(org.telegram.ui.Cells.SharingLiveLocationCell) LocationCell(org.telegram.ui.Cells.LocationCell) SendLocationCell(org.telegram.ui.Cells.SendLocationCell)

Example 2 with EmptyCell

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);
}
Also used : DrawerActionCell(org.telegram.ui.Cells.DrawerActionCell) DrawerAddCell(org.telegram.ui.Cells.DrawerAddCell) EmptyCell(org.telegram.ui.Cells.EmptyCell) DrawerUserCell(org.telegram.ui.Cells.DrawerUserCell) RecyclerView(androidx.recyclerview.widget.RecyclerView) DrawerProfileCell(org.telegram.ui.Cells.DrawerProfileCell) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) DividerCell(org.telegram.ui.Cells.DividerCell)

Example 3 with EmptyCell

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);
}
Also used : Space(android.widget.Space) EmptyCell(org.telegram.ui.Cells.EmptyCell) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) StickerSetNameCell(org.telegram.ui.Cells.StickerSetNameCell) TLRPC(org.telegram.tgnet.TLRPC) FeaturedStickerSetInfoCell(org.telegram.ui.Cells.FeaturedStickerSetInfoCell) StickerEmojiCell(org.telegram.ui.Cells.StickerEmojiCell) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 4 with EmptyCell

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));
    }
}
Also used : ManageChatUserCell(org.telegram.ui.Cells.ManageChatUserCell) ShadowSectionCell(org.telegram.ui.Cells.ShadowSectionCell) ColorDrawable(android.graphics.drawable.ColorDrawable) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) BackDrawable(org.telegram.ui.ActionBar.BackDrawable) EmptyCell(org.telegram.ui.Cells.EmptyCell) ChartHeaderView(org.telegram.ui.Charts.view_data.ChartHeaderView)

Aggregations

EmptyCell (org.telegram.ui.Cells.EmptyCell)4 View (android.view.View)3 RecyclerView (androidx.recyclerview.widget.RecyclerView)3 RecyclerListView (org.telegram.ui.Components.RecyclerListView)3 ColorDrawable (android.graphics.drawable.ColorDrawable)2 Drawable (android.graphics.drawable.Drawable)2 TLRPC (org.telegram.tgnet.TLRPC)2 ShadowSectionCell (org.telegram.ui.Cells.ShadowSectionCell)2 CombinedDrawable (org.telegram.ui.Components.CombinedDrawable)2 Context (android.content.Context)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 Location (android.location.Location)1 Build (android.os.Build)1 TextUtils (android.text.TextUtils)1 ViewGroup (android.view.ViewGroup)1 ViewPropertyAnimator (android.view.ViewPropertyAnimator)1 FrameLayout (android.widget.FrameLayout)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 Space (android.widget.Space)1