Search in sources :

Example 1 with LocationDirectionCell

use of org.telegram.ui.Cells.LocationDirectionCell 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)

Aggregations

Context (android.content.Context)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Drawable (android.graphics.drawable.Drawable)1 Location (android.location.Location)1 Build (android.os.Build)1 TextUtils (android.text.TextUtils)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ViewPropertyAnimator (android.view.ViewPropertyAnimator)1 FrameLayout (android.widget.FrameLayout)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 ArrayList (java.util.ArrayList)1 Locale (java.util.Locale)1 AndroidUtilities (org.telegram.messenger.AndroidUtilities)1 LocaleController (org.telegram.messenger.LocaleController)1 LocationController (org.telegram.messenger.LocationController)1 MessageObject (org.telegram.messenger.MessageObject)1 R (org.telegram.messenger.R)1 UserConfig (org.telegram.messenger.UserConfig)1 TLRPC (org.telegram.tgnet.TLRPC)1