//package com.gh.gamecenter.qa.article
//
//import android.content.Context
//import android.view.View
//import android.view.ViewGroup
//import androidx.recyclerview.widget.RecyclerView
//import com.gh.gamecenter.common.constant.ItemViewType
//import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler
//import com.gh.gamecenter.R
//import com.gh.gamecenter.common.viewholder.FooterViewHolder
//import com.gh.gamecenter.common.baselist.ListAdapter
//import com.gh.gamecenter.databinding.CommunityAnswerItemBinding
//import com.gh.gamecenter.login.user.UserManager
//import com.gh.gamecenter.qa.answer.CommunityAnswerItemViewHolder
//import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
//import com.gh.gamecenter.qa.entity.ArticleEntity
//import com.gh.gamecenter.qa.entity.Questions
//
//class SimpleArticleListAdapter(context: Context) : ListAdapter<ArticleEntity>(context), ISyncAdapterHandler {
//
//    override fun areItemsTheSame(oldItem: ArticleEntity?, newItem: ArticleEntity?): Boolean {
//        return oldItem?.id == newItem?.id
//    }
//
//    override fun getItemViewType(position: Int): Int {
//        if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER
//        return ItemViewType.ITEM_BODY
//    }
//
//    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
//        val view: View
//        return when (viewType) {
//            ItemViewType.ITEM_FOOTER -> {
//                view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)
//                FooterViewHolder(view)
//            }
//            else -> {
//                view = mLayoutInflater.inflate(R.layout.community_answer_item, parent, false)
//                CommunityAnswerItemViewHolder(CommunityAnswerItemBinding.bind(view))
//            }
//        }
//    }
//
//    override fun getItemCount(): Int {
//        return if (mEntityList.isNotEmpty()) mEntityList.size + FOOTER_ITEM_COUNT else 0
//    }
//
//    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
//        when (getItemViewType(position)) {
//            ItemViewType.ITEM_BODY -> {
//                val viewHolder = holder as CommunityAnswerItemViewHolder
//                val articleEntity = mEntityList[position]
//                val questions = Questions()
//                questions.title = articleEntity.title
//                viewHolder.bindArticleItem(articleEntity, "", getPath())
//                viewHolder.itemView.setOnClickListener {
//                    mContext.startActivity(ArticleDetailActivity.getIntent(mContext, CommunityManager.getInstance().community, articleEntity.id, "", getPath()))
//                }
//            }
//            ItemViewType.ITEM_FOOTER -> {
//                val footerViewHolder = holder as FooterViewHolder
//                footerViewHolder.initItemPadding()
//                footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver)
//            }
//        }
//    }
//
//    fun getPath(): String {
//        return if (mContext is SimpleArticleListActivity) {
//            "推荐入口-列表"
//        } else {
//            "全部-文章"
//        }
//    }
//
//    override fun getSyncData(position: Int): Pair<String, Any>? {
//        if (position >= mEntityList.size) return null
//        val entity = mEntityList[position]
//        return Pair(entity.id, entity)
//    }
//
//}