示例#1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            switch (viewType)
            {
            case 0:
            {
                // The Collection details at the top of the list
                View activityView      = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Activity, parent, false);
                ActivityViewHolder avh = new ActivityViewHolder(activityView, null, OnEditCollectionClick);
                return(avh);
            }

            case 1:
            {
                // The collection description
                View           descView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard, parent, false);
                TaskViewHolder dvh      = new TaskViewHolder(descView, null);
                return(dvh);
            }

            case 2:
            {
                // The finish button at the bottom of the list
                View             finishView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Finish, parent, false);
                ButtonViewHolder bvh        = new ButtonViewHolder(finishView, OnFinishClick);
                return(bvh);
            }
            }

            View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ActivityCollectionCard, parent, false);

            if (editingMode)
            {
                return(new ActivityCollectionAdapterViewHolder(itemView, null, OnDeleteItemClick, OnOpenLocationClick));
            }

            return(new ActivityCollectionAdapterViewHolder(itemView, null, OnOpenItemClick, OnOpenLocationClick));
        }
示例#2
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // Inflate the CardView for the task:
            View itemView;

            switch (viewType)
            {
            case TaskScan:
            case TaskListen:
            case TaskLocationHunt:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Btn, parent, false);
                TaskViewHolderBtn bvh = new TaskViewHolderBtn(itemView, OnSpeakClick, OnClick);
                return(bvh);

            case TaskInfo:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Info, parent, false);
                TaskViewHolderInfo ivh = new TaskViewHolderInfo(itemView, OnSpeakClick, OnClick);
                ivh.Button.Text = context.GetString(Resource.String.ExternalBtn);
                return(ivh);

            case TaskDrawing:
            case TaskPhoto:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_ResultList, parent, false);
                TaskViewHolderResultList pvh = new TaskViewHolderResultList(itemView, OnSpeakClick, OnClick, OnMediaClick);
                return(pvh);

            case TaskMultipleChoice:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_MultipleChoice, parent, false);
                TaskViewHolderMultipleChoice vmh = new TaskViewHolderMultipleChoice(itemView, OnSpeakClick);
                return(vmh);

            case TaskLocationMarker:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Map, parent, false);
                TaskViewHolderMap mvh = new TaskViewHolderMap(itemView, OnSpeakClick, OnClick);
                return(mvh);

            case TaskTextEntry:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_TextEntry, parent, false);
                TaskViewHolderTextEntry tvh = new TaskViewHolderTextEntry(itemView, OnSpeakClick, OnText);
                return(tvh);

            case TaskVideo:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_ResultList, parent, false);
                TaskViewHolderRecordVideo vvh = new TaskViewHolderRecordVideo(itemView, OnSpeakClick, OnClick, OnMediaClick);
                return(vvh);

            case TaskAudio:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_ResultList, parent, false);
                TaskViewHolderRecordAudio avh = new TaskViewHolderRecordAudio(itemView, OnSpeakClick, OnClick, OnMediaClick);
                return(avh);

            case Finish:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Finish, parent, false);
                ButtonViewHolder finishViewHolder = new ButtonViewHolder(itemView, OnClick);
                return(finishViewHolder);

            case Curate:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.CuratorCard, parent, false);
                CuratorViewHolder curateCard = new CuratorViewHolder(itemView, OnCurate);
                return(curateCard);

            case Names:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard_Name, parent, false);
                TaskViewHolderName nameCard = new TaskViewHolderName(itemView, OnSpeakClick, OnChangeNameClick);
                return(nameCard);

            default:
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TaskCard, parent, false);
                TaskViewHolder vh = new TaskViewHolder(itemView, null);
                return(vh);
            }
        }