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 |
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
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
class AdapterBuilder<ModelType>( | |
private val itemList: List<ModelType>, | |
private val layoutId: Int, | |
private val viewModel: ViewModel? | |
) { | |
fun build(): BaseRecyclerAdapter<ModelType> { | |
val baseAdapter = BaseRecyclerAdapter(itemList, layoutId, viewModel) | |
baseAdapter.updateData(itemList) | |
return baseAdapter |
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
@BindingAdapter( | |
value = [ | |
"itemList", | |
"itemLayoutId", | |
"viewModel" | |
], | |
requireAll = false | |
) | |
fun RecyclerView.bindRecyclerView( | |
itemList: List<Nothing>?, |
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
{ | |
"error": { | |
"code": 0, | |
"message": "string" | |
}, | |
"result": { | |
"totalPagesCount": 0, | |
"page": 0, | |
"countPerPage": 0, | |
"feeds": [ |
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
{ | |
"error": null, | |
"result": { | |
"data": { | |
"pipeTypes": [ | |
{ | |
"description": "TS EN 10255 Orta Seri Su Boruları", | |
"values": [ | |
{ | |
"Product": "30-01063", |
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
{ | |
"error": null, | |
"result": { | |
"data": { | |
"pipeTypes": [ | |
{ | |
"description": "TS EN 10255 Orta Seri Su Boruları", | |
"values": [ | |
{ | |
"Product": "30-01063", |
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
{ | |
"error": null, | |
"result": { | |
"data": { | |
"pipeTypes": [ | |
{ | |
"description": "TS EN 10255 Orta Seri Su Boruları", | |
"values": [ | |
{ | |
"Product": "30-01063", |
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
{ | |
"error": null, | |
"result": { | |
"name": "string", | |
"surname": "string", | |
"email": "[email protected]", | |
"companyName": null, | |
"phone": "11223344551" | |
}, | |
"success": true |
NewerOlder