This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open class BaseRecyclerAdapter<T>( | |
| private var modelList: List<T>, | |
| private val itemLayoutId: Int, | |
| private val viewModel: ViewModel? | |
| ) : RecyclerView.Adapter<BaseViewHolder>() { | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder { | |
| val layoutInflater: LayoutInflater = LayoutInflater.from(parent.context) | |
| val binding: ViewDataBinding = | |
| DataBindingUtil.inflate(layoutInflater, itemLayoutId, parent, false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| abstract class BaseViewHolder(val itemBinding: ViewDataBinding) : | |
| RecyclerView.ViewHolder(itemBinding.root) { | |
| abstract fun bindData(position: Int) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.gson.JsonParseException | |
| import com.sample.app.internal.util.Failure | |
| import com.squareup.moshi.JsonDataException | |
| import io.reactivex.Single | |
| import io.reactivex.android.schedulers.AndroidSchedulers | |
| /** | |
| * Singleton class for handling API requests and responses |
OlderNewer