Commit 6896df77 authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Merge branch 'fix/issue_merge_requests_notes' into 'develop'

Implement pagination for Issue, MergeRequest notes.

See merge request terrakok/gitlab-client!87
parents bbfd8295 6fc510fe
......@@ -191,15 +191,23 @@ interface GitlabApi {
@POST("$API_PATH/todos/mark_as_done")
fun markAllPendingTodosAsDone(): Completable
@GET("$API_PATH/projects/{project_id}/issues/{issue_id}/discussions")
fun getIssueDiscussions(
@GET("$API_PATH/projects/{project_id}/issues/{issue_id}/notes")
fun getIssueNotes(
@Path("project_id") projectId: Long,
@Path("issue_id") issueId: Long
): Single<List<Discussion>>
@Path("issue_id") issueId: Long,
@Query("sort") sort: Sort?,
@Query("order_by") orderBy: OrderBy?,
@Query("page") page: Int,
@Query("per_page") pageSize: Int
): Single<List<Note>>
@GET("$API_PATH/projects/{project_id}/merge_requests/{merge_request_id}/discussions")
fun getMergeRequestDiscussions(
@GET("$API_PATH/projects/{project_id}/merge_requests/{merge_request_id}/notes")
fun getMergeRequestNotes(
@Path("project_id") projectId: Long,
@Path("merge_request_id") mergeRequestId: Long
): Single<List<Discussion>>
@Path("merge_request_id") mergeRequestId: Long,
@Query("sort") sort: Sort?,
@Query("order_by") orderBy: OrderBy?,
@Query("page") page: Int,
@Query("per_page") pageSize: Int
): Single<List<Note>>
}
\ No newline at end of file
package ru.terrakok.gitlabclient.model.interactor.issue
import ru.terrakok.gitlabclient.entity.OrderBy
import ru.terrakok.gitlabclient.entity.Sort
import ru.terrakok.gitlabclient.entity.issue.IssueScope
import ru.terrakok.gitlabclient.entity.issue.IssueState
import ru.terrakok.gitlabclient.model.repository.issue.IssueRepository
......@@ -44,6 +45,7 @@ class IssueInteractor @Inject constructor(
fun getIssueNotes(
projectId: Long,
issueId: Long
) = issueRepository.getIssueNotes(projectId, issueId)
issueId: Long,
page: Int
) = issueRepository.getIssueNotes(projectId, issueId, Sort.ASC, OrderBy.UPDATED_AT, page)
}
\ No newline at end of file
package ru.terrakok.gitlabclient.model.interactor.mergerequest
import ru.terrakok.gitlabclient.entity.OrderBy
import ru.terrakok.gitlabclient.entity.Sort
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestScope
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestState
import ru.terrakok.gitlabclient.model.repository.mergerequest.MergeRequestRepository
......@@ -40,6 +41,7 @@ class MergeRequestInteractor @Inject constructor(
fun getMergeRequestNotes(
projectId: Long,
mergeRequestId: Long
) = mergeRequestRepository.getMergeRequestNotes(projectId, mergeRequestId)
mergeRequestId: Long,
page: Int
) = mergeRequestRepository.getMergeRequestNotes(projectId, mergeRequestId, Sort.ASC, OrderBy.UPDATED_AT, page)
}
\ No newline at end of file
......@@ -133,11 +133,15 @@ class IssueRepository @Inject constructor(
fun getIssueNotes(
projectId: Long,
issueId: Long
issueId: Long,
sort: Sort?,
orderBy: OrderBy?,
page: Int,
pageSize: Int = defaultPageSize
) = Single
.zip(
api.getProject(projectId),
getDiscussionNotes(projectId, issueId),
api.getIssueNotes(projectId, issueId, sort, orderBy, page, pageSize),
BiFunction<Project, List<Note>, List<Note>> { project, notes ->
ArrayList(notes).apply {
val iterator = listIterator()
......@@ -154,11 +158,4 @@ class IssueRepository @Inject constructor(
)
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
private fun getDiscussionNotes(projectId: Long, issueId: Long) =
api
.getIssueDiscussions(projectId, issueId)
.flattenAsObservable { it }
.concatMap { discussion -> Observable.fromIterable(discussion.notes) }
.toList()
}
\ No newline at end of file
......@@ -147,11 +147,15 @@ class MergeRequestRepository @Inject constructor(
fun getMergeRequestNotes(
projectId: Long,
mergeRequestId: Long
mergeRequestId: Long,
sort: Sort?,
orderBy: OrderBy?,
page: Int,
pageSize: Int = defaultPageSize
) = Single
.zip(
api.getProject(projectId),
getDiscussionNotes(projectId, mergeRequestId),
api.getMergeRequestNotes(projectId, mergeRequestId, sort, orderBy, page, pageSize),
BiFunction<Project, List<Note>, List<Note>> { project, notes ->
ArrayList(notes).apply {
val iterator = listIterator()
......@@ -168,11 +172,4 @@ class MergeRequestRepository @Inject constructor(
)
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
private fun getDiscussionNotes(projectId: Long, mergeRequestId: Long) =
api
.getMergeRequestDiscussions(projectId, mergeRequestId)
.flattenAsObservable { it }
.concatMap { discussion -> Observable.fromIterable(discussion.notes) }
.toList()
}
\ No newline at end of file
......@@ -2,10 +2,7 @@ package ru.terrakok.gitlabclient.presentation.issue.notes
import com.arellomobile.mvp.InjectViewState
import ru.terrakok.gitlabclient.model.interactor.issue.IssueInteractor
import ru.terrakok.gitlabclient.presentation.global.BasePresenter
import ru.terrakok.gitlabclient.presentation.global.ErrorHandler
import ru.terrakok.gitlabclient.presentation.global.MarkDownConverter
import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
import ru.terrakok.gitlabclient.presentation.global.*
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.IssueId
import ru.terrakok.gitlabclient.toothpick.qualifier.ProjectId
......@@ -29,26 +26,60 @@ class IssueNotesPresenter @Inject constructor(
override fun onFirstViewAttach() {
super.onFirstViewAttach()
requestNotes()
refreshNotes()
}
private fun requestNotes() {
issueInteractor.getIssueNotes(projectId, issueId)
.flattenAsObservable { it }
.concatMap { note ->
mdConverter.markdownToSpannable(note.body)
.map { NoteWithFormattedBody(note, it) }
.toObservable()
private val paginator = Paginator(
{ page ->
issueInteractor.getIssueNotes(projectId, issueId, page)
.flattenAsObservable { it }
.concatMap { note ->
mdConverter.markdownToSpannable(note.body)
.map { NoteWithFormattedBody(note, it) }
.toObservable()
}
.toList()
},
object : Paginator.ViewController<NoteWithFormattedBody> {
override fun showEmptyProgress(show: Boolean) {
viewState.showEmptyProgress(show)
}
override fun showEmptyError(show: Boolean, error: Throwable?) {
if (error != null) {
errorHandler.proceed(error, { viewState.showEmptyError(show, it) })
} else {
viewState.showEmptyError(show, null)
}
}
override fun showErrorMessage(error: Throwable) {
errorHandler.proceed(error, { viewState.showMessage(it) })
}
override fun showEmptyView(show: Boolean) {
viewState.showEmptyView(show)
}
.toList()
.doOnSubscribe { viewState.showProgress(true) }
.doAfterTerminate { viewState.showProgress(false) }
.subscribe(
{ viewState.showNotes(it) },
{ errorHandler.proceed(it, { viewState.showMessage(it) }) }
)
.connect()
}
fun refresh() = requestNotes()
override fun showData(show: Boolean, data: List<NoteWithFormattedBody>) {
viewState.showNotes(show, data)
}
override fun showRefreshProgress(show: Boolean) {
viewState.showRefreshProgress(show)
}
override fun showPageProgress(show: Boolean) {
viewState.showPageProgress(show)
}
}
)
fun refreshNotes() = paginator.refresh()
fun loadNextIssuesPage() = paginator.loadNewPage()
override fun onDestroy() {
super.onDestroy()
paginator.release()
}
}
\ No newline at end of file
......@@ -12,8 +12,12 @@ import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
@StateStrategyType(AddToEndSingleStrategy::class)
interface IssueNotesView : MvpView {
fun showNotes(notes: List<NoteWithFormattedBody>)
fun showProgress(show: Boolean)
fun showRefreshProgress(show: Boolean)
fun showEmptyProgress(show: Boolean)
fun showPageProgress(show: Boolean)
fun showEmptyView(show: Boolean)
fun showEmptyError(show: Boolean, message: String?)
fun showNotes(show: Boolean, notes: List<NoteWithFormattedBody>)
@StateStrategyType(OneExecutionStateStrategy::class)
fun showMessage(message: String)
......
......@@ -2,10 +2,7 @@ package ru.terrakok.gitlabclient.presentation.mergerequest.notes
import com.arellomobile.mvp.InjectViewState
import ru.terrakok.gitlabclient.model.interactor.mergerequest.MergeRequestInteractor
import ru.terrakok.gitlabclient.presentation.global.BasePresenter
import ru.terrakok.gitlabclient.presentation.global.ErrorHandler
import ru.terrakok.gitlabclient.presentation.global.MarkDownConverter
import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
import ru.terrakok.gitlabclient.presentation.global.*
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.MergeRequestId
import ru.terrakok.gitlabclient.toothpick.qualifier.ProjectId
......@@ -29,26 +26,60 @@ class MergeRequestNotesPresenter @Inject constructor(
override fun onFirstViewAttach() {
super.onFirstViewAttach()
requestNotes()
refreshNotes()
}
private fun requestNotes() {
mrInteractor.getMergeRequestNotes(projectId, mrId)
.flattenAsObservable { it }
.concatMap { note ->
mdConverter.markdownToSpannable(note.body)
.map { NoteWithFormattedBody(note, it) }
.toObservable()
private val paginator = Paginator(
{ page ->
mrInteractor.getMergeRequestNotes(projectId, mrId, page)
.flattenAsObservable { it }
.concatMap { note ->
mdConverter.markdownToSpannable(note.body)
.map { NoteWithFormattedBody(note, it) }
.toObservable()
}
.toList()
},
object : Paginator.ViewController<NoteWithFormattedBody> {
override fun showEmptyProgress(show: Boolean) {
viewState.showEmptyProgress(show)
}
override fun showEmptyError(show: Boolean, error: Throwable?) {
if (error != null) {
errorHandler.proceed(error, { viewState.showEmptyError(show, it) })
} else {
viewState.showEmptyError(show, null)
}
}
override fun showErrorMessage(error: Throwable) {
errorHandler.proceed(error, { viewState.showMessage(it) })
}
override fun showEmptyView(show: Boolean) {
viewState.showEmptyView(show)
}
.toList()
.doOnSubscribe { viewState.showProgress(true) }
.doAfterTerminate { viewState.showProgress(false) }
.subscribe(
{ viewState.showNotes(it) },
{ errorHandler.proceed(it, { viewState.showMessage(it) }) }
)
.connect()
}
fun refresh() = requestNotes()
override fun showData(show: Boolean, data: List<NoteWithFormattedBody>) {
viewState.showNotes(show, data)
}
override fun showRefreshProgress(show: Boolean) {
viewState.showRefreshProgress(show)
}
override fun showPageProgress(show: Boolean) {
viewState.showPageProgress(show)
}
}
)
fun refreshNotes() = paginator.refresh()
fun loadNextMergeRequestsPage() = paginator.loadNewPage()
override fun onDestroy() {
super.onDestroy()
paginator.release()
}
}
\ No newline at end of file
......@@ -12,8 +12,12 @@ import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
@StateStrategyType(AddToEndSingleStrategy::class)
interface MergeRequestNotesView : MvpView {
fun showNotes(notes: List<NoteWithFormattedBody>)
fun showProgress(show: Boolean)
fun showRefreshProgress(show: Boolean)
fun showEmptyProgress(show: Boolean)
fun showPageProgress(show: Boolean)
fun showEmptyView(show: Boolean)
fun showEmptyError(show: Boolean, message: String?)
fun showNotes(show: Boolean, notes: List<NoteWithFormattedBody>)
@StateStrategyType(OneExecutionStateStrategy::class)
fun showMessage(message: String)
......
......@@ -16,20 +16,20 @@ import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
*/
class SystemNoteAdapterDelegate(
private val clickListener: (Note) -> Unit
) : AdapterDelegate<MutableList<NoteWithFormattedBody>>() {
) : AdapterDelegate<MutableList<Any>>() {
override fun isForViewType(items: MutableList<NoteWithFormattedBody>, position: Int) =
items[position].note.isSystem
override fun isForViewType(items: MutableList<Any>, position: Int) =
with(items[position]) { this is NoteWithFormattedBody && this.note.isSystem }
override fun onCreateViewHolder(parent: ViewGroup): RecyclerView.ViewHolder =
ViewHolder(parent.inflate(R.layout.item_system_note))
override fun onBindViewHolder(
items: MutableList<NoteWithFormattedBody>,
items: MutableList<Any>,
position: Int,
viewHolder: RecyclerView.ViewHolder,
payloads: MutableList<Any>
) = (viewHolder as ViewHolder).bind(items[position])
) = (viewHolder as ViewHolder).bind(items[position] as NoteWithFormattedBody)
private inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
private lateinit var note: Note
......
package ru.terrakok.gitlabclient.ui.global.list
import android.support.v7.util.DiffUtil
import android.support.v7.widget.RecyclerView
import com.hannesdorfmann.adapterdelegates3.ListDelegationAdapter
import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
class TargetNotesAdapter : ListDelegationAdapter<MutableList<NoteWithFormattedBody>>() {
class TargetNotesAdapter(
private val nextPageListener: () -> Unit
) : ListDelegationAdapter<MutableList<Any>>() {
init {
items = mutableListOf()
delegatesManager.addDelegate(UserNoteAdapterDelegate({}))
delegatesManager.addDelegate(SystemNoteAdapterDelegate({}))
delegatesManager.addDelegate(ProgressAdapterDelegate())
}
fun setData(data: List<NoteWithFormattedBody>) {
......@@ -19,22 +23,63 @@ class TargetNotesAdapter : ListDelegationAdapter<MutableList<NoteWithFormattedBo
items.addAll(data)
DiffUtil
.calculateDiff(DiffCallback(items, oldItems), false)
.dispatchUpdatesTo(this)
.calculateDiff(DiffCallback(items, oldItems), false)
.dispatchUpdatesTo(this)
}
fun showProgress(isVisible: Boolean) {
val oldData = items.toList()
val currentProgress = isProgress()
if (isVisible && !currentProgress) {
items.add(ProgressItem())
notifyItemInserted(items.lastIndex)
} else if (!isVisible && currentProgress) {
items.remove(items.last())
notifyItemRemoved(oldData.lastIndex)
}
}
private fun isProgress() = items.isNotEmpty() && items.last() is ProgressItem
override fun onBindViewHolder(
holder: RecyclerView.ViewHolder,
position: Int,
payloads: MutableList<Any?>
) {
super.onBindViewHolder(holder, position, payloads)
if (position == items.size - 10) nextPageListener()
}
private inner class DiffCallback(
private val newItems: List<NoteWithFormattedBody>,
private val oldItems: List<NoteWithFormattedBody>
private val newItems: List<Any>,
private val oldItems: List<Any>
) : DiffUtil.Callback() {
override fun getOldListSize() = oldItems.size
override fun getNewListSize() = newItems.size
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) =
newItems[newItemPosition].note.id == oldItems[oldItemPosition].note.id
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
val oldItem = oldItems[oldItemPosition]
val newItem = newItems[newItemPosition]
return if (newItem is NoteWithFormattedBody && oldItem is NoteWithFormattedBody) {
newItem.note.id == oldItem.note.id
} else {
newItem is ProgressItem && oldItem is ProgressItem
}
}
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
val oldItem = oldItems[oldItemPosition]
val newItem = newItems[newItemPosition]
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int) =
newItems[newItemPosition] == oldItems[oldItemPosition]
return if (newItem is NoteWithFormattedBody && oldItem is NoteWithFormattedBody) {
newItem == oldItem
} else {
true
}
}
}
}
\ No newline at end of file
......@@ -18,20 +18,20 @@ import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
*/
class UserNoteAdapterDelegate(
private val clickListener: (Note) -> Unit
) : AdapterDelegate<MutableList<NoteWithFormattedBody>>() {
) : AdapterDelegate<MutableList<Any>>() {
override fun isForViewType(items: MutableList<NoteWithFormattedBody>, position: Int) =
!items[position].note.isSystem
override fun isForViewType(items: MutableList<Any>, position: Int) =
with(items[position]) { this is NoteWithFormattedBody && !this.note.isSystem }
override fun onCreateViewHolder(parent: ViewGroup): RecyclerView.ViewHolder =
ViewHolder(parent.inflate(R.layout.item_user_note))
override fun onBindViewHolder(
items: MutableList<NoteWithFormattedBody>,
items: MutableList<Any>,
position: Int,
viewHolder: RecyclerView.ViewHolder,
payloads: MutableList<Any>
) = (viewHolder as ViewHolder).bind(items[position])
) = (viewHolder as ViewHolder).bind(items[position] as NoteWithFormattedBody)
private inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
private lateinit var note: Note
......
......@@ -5,13 +5,16 @@ import android.support.v7.widget.LinearLayoutManager
import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import kotlinx.android.synthetic.main.layout_base_list.*
import kotlinx.android.synthetic.main.layout_zero.*
import ru.terrakok.gitlabclient.R
import ru.terrakok.gitlabclient.extension.showSnackMessage
import ru.terrakok.gitlabclient.extension.visible
import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
import ru.terrakok.gitlabclient.presentation.issue.notes.IssueNotesPresenter
import ru.terrakok.gitlabclient.presentation.issue.notes.IssueNotesView
import ru.terrakok.gitlabclient.toothpick.DI
import ru.terrakok.gitlabclient.ui.global.BaseFragment
import ru.terrakok.gitlabclient.ui.global.ZeroViewHolder
import ru.terrakok.gitlabclient.ui.global.list.SimpleDividerDecorator
import ru.terrakok.gitlabclient.ui.global.list.TargetNotesAdapter
import toothpick.Toothpick
......@@ -23,7 +26,8 @@ class IssueNotesFragment : BaseFragment(), IssueNotesView {
override val layoutRes = R.layout.fragment_issue_notes
private val adapter by lazy { TargetNotesAdapter() }
private val adapter by lazy { TargetNotesAdapter({ presenter.loadNextIssuesPage() }) }
private var zeroViewHolder: ZeroViewHolder? = null
@InjectPresenter
lateinit var presenter: IssueNotesPresenter
......@@ -43,15 +47,39 @@ class IssueNotesFragment : BaseFragment(), IssueNotesView {
adapter = this@IssueNotesFragment.adapter
}
swipeToRefresh.setOnRefreshListener { presenter.refresh() }
swipeToRefresh.setOnRefreshListener { presenter.refreshNotes() }
zeroViewHolder = ZeroViewHolder(zeroLayout, { presenter.refreshNotes() })
}
override fun showNotes(notes: List<NoteWithFormattedBody>) {
adapter.setData(notes)
override fun showRefreshProgress(show: Boolean) {
postViewAction { swipeToRefresh.isRefreshing = show }
}
override fun showProgress(show: Boolean) {
swipeToRefresh.isRefreshing = show
override fun showEmptyProgress(show: Boolean) {
fullscreenProgressView.visible(show)
//trick for disable and hide swipeToRefresh on fullscreen progress
swipeToRefresh.visible(!show)
postViewAction { swipeToRefresh.isRefreshing = false }
}
override fun showPageProgress(show: Boolean) {
postViewAction { adapter.showProgress(show) }
}
override fun showEmptyView(show: Boolean) {
if (show) zeroViewHolder?.showEmptyData()
else zeroViewHolder?.hide()
}
override fun showEmptyError(show: Boolean, message: String?) {
if (show) zeroViewHolder?.showEmptyError(message)
else zeroViewHolder?.hide()
}
override fun showNotes(show: Boolean, notes: List<NoteWithFormattedBody>) {
recyclerView.visible(show)
postViewAction { adapter.setData(notes) }
}
override fun showMessage(message: String) {
......
......@@ -5,13 +5,16 @@ import android.support.v7.widget.LinearLayoutManager
import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import kotlinx.android.synthetic.main.layout_base_list.*
import kotlinx.android.synthetic.main.layout_zero.*
import ru.terrakok.gitlabclient.R
import ru.terrakok.gitlabclient.extension.showSnackMessage
import ru.terrakok.gitlabclient.extension.visible
import ru.terrakok.gitlabclient.presentation.global.NoteWithFormattedBody
import ru.terrakok.gitlabclient.presentation.mergerequest.notes.MergeRequestNotesPresenter
import ru.terrakok.gitlabclient.presentation.mergerequest.notes.MergeRequestNotesView
import ru.terrakok.gitlabclient.toothpick.DI
import ru.terrakok.gitlabclient.ui.global.BaseFragment
import ru.terrakok.gitlabclient.ui.global.ZeroViewHolder
import ru.terrakok.gitlabclient.ui.global.list.SimpleDividerDecorator
import ru.terrakok.gitlabclient.ui.global.list.TargetNotesAdapter
import toothpick.Toothpick
......@@ -23,7 +26,8 @@ class MergeRequestNotesFragment : BaseFragment(), MergeRequestNotesView {
override val layoutRes = R.layout.fragment_mr_notes
private val adapter by lazy { TargetNotesAdapter() }
private val adapter by lazy { TargetNotesAdapter({ presenter.loadNextMergeRequestsPage() }) }
private var zeroViewHolder: ZeroViewHolder? = null
@InjectPresenter
lateinit var presenter: MergeRequestNotesPresenter
......@@ -43,15 +47,39 @@ class MergeRequestNotesFragment : BaseFragment(), MergeRequestNotesView {
adapter = this@MergeRequestNotesFragment.adapter
}
swipeToRefresh.setOnRefreshListener { presenter.refresh() }
swipeToRefresh.setOnRefreshListener { presenter.refreshNotes() }
zeroViewHolder = ZeroViewHolder(zeroLayout, { presenter.refreshNotes() })
}
override fun showNotes(notes: List<NoteWithFormattedBody>) {
adapter.setData(notes)
override fun showRefreshProgress(show: Boolean) {
postViewAction { swipeToRefresh.isRefreshing = show }
}
override fun showProgress(show: Boolean) {
swipeToRefresh.isRefreshing = show
override fun showEmptyProgress(show: Boolean) {
fullscreenProgressView.visible(show)
//trick for disable and hide swipeToRefresh on fullscreen progress
swipeToRefresh.visible(!show)
postViewAction { swipeToRefresh.isRefreshing = false }
}
override fun showPageProgress(show: Boolean) {
postViewAction { adapter.showProgress(show) }
}
override fun showEmptyView(show: Boolean) {
if (show) zeroViewHolder?.showEmptyData()
else zeroViewHolder?.hide()
}
override fun showEmptyError(show: Boolean, message: String?) {
if (show) zeroViewHolder?.showEmptyError(message)
else zeroViewHolder?.hide()
}
override fun showNotes(show: Boolean, notes: List<NoteWithFormattedBody>) {
recyclerView.visible(show)
postViewAction { adapter.setData(notes) }
}
override fun showMessage(message: String) {
......
......@@ -11,7 +11,7 @@ import ru.terrakok.gitlabclient.ui.global.list.TargetHeaderAdapterDelegate
class TargetsAdapter(
userClickListener: (Long) -> Unit,
clickListener: (TargetHeader) -> Unit,
private val nextListener: () -> Unit
private val nextPageListener: () -> Unit
) : ListDelegationAdapter<MutableList<Any>>() {
init {
......@@ -56,7 +56,7 @@ class TargetsAdapter(
) {
super.onBindViewHolder(holder, position, payloads)
if (position == items.size - 10) nextListener()
if (position == items.size - 10) nextPageListener()
}
private inner class DiffCallback(
......
Markdown is supported
0%