fix formatting
This commit is contained in:
parent
3d6f6206e6
commit
dc139d4dae
|
@ -79,7 +79,6 @@ class TimelineFragment : DaggerFragment(R.layout.fragment_timeline), TimeLineAct
|
|||
adapter.addDataRefreshListener {
|
||||
binding.timelineSwipeRefresh.isRefreshing = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFavorite(status: StatusEntity) {
|
||||
|
|
|
@ -33,7 +33,6 @@ class TimelineUseCases @Inject constructor(
|
|||
} else {
|
||||
api.reblogStatus(status.actionableId)
|
||||
}.updateStatusInDb()
|
||||
|
||||
}
|
||||
|
||||
suspend fun onMediaVisibilityChanged(status: StatusEntity) {
|
||||
|
@ -42,7 +41,6 @@ class TimelineUseCases @Inject constructor(
|
|||
status.id,
|
||||
accountManager.activeAccount()?.id!!
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private suspend fun NetworkResponse<Status>.updateStatusInDb() {
|
||||
|
@ -57,5 +55,4 @@ class TimelineUseCases @Inject constructor(
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -71,5 +71,4 @@ class TimelineViewModel @Inject constructor(
|
|||
useCases.onMediaVisibilityChanged(status)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,9 @@ class DetailActivity: BaseActivity(), TimeLineActionListener {
|
|||
|
||||
binding.detailRecyclerView.adapter = ConcatAdapter(statusAdapter, repliesAdapter)
|
||||
|
||||
viewModel.currentStatus.observe(this, Observer {
|
||||
viewModel.currentStatus.observe(
|
||||
this,
|
||||
Observer {
|
||||
when (it) {
|
||||
is Success -> {
|
||||
binding.detailSwipeRefresh.show()
|
||||
|
@ -88,18 +90,20 @@ class DetailActivity: BaseActivity(), TimeLineActionListener {
|
|||
binding.detailSwipeRefresh.hide()
|
||||
binding.detailStatus.show()
|
||||
binding.detailProgress.hide()
|
||||
binding.detailStatus.setOnRetryListener { }
|
||||
binding.detailStatus.showGeneralError()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
viewModel.replies.observe(this, Observer {
|
||||
viewModel.replies.observe(
|
||||
this,
|
||||
Observer {
|
||||
if (it is Success) {
|
||||
repliesAdapter.submitList(it.data)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun onFavorite(status: StatusEntity) {
|
||||
|
@ -131,5 +135,4 @@ class DetailActivity: BaseActivity(), TimeLineActionListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -51,8 +51,6 @@ class DetailReplyAdapter(
|
|||
holder.binding.postReplyButton.setOnClickListener {
|
||||
listener.onReply(status)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import at.connyduck.pixelcat.databinding.ItemStatusBinding
|
|||
import at.connyduck.pixelcat.db.entitity.StatusEntity
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
|
||||
class DetailStatusAdapter(
|
||||
private val displayWidth: Int,
|
||||
private val listener: TimeLineActionListener
|
||||
|
@ -36,5 +35,4 @@ class DetailStatusAdapter(
|
|||
holder.bind(status, displayWidth, listener, dateTimeFormatter)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,23 +78,31 @@ class DetailViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun loadStatus() {
|
||||
api.status(statusId).fold({
|
||||
api.status(statusId).fold(
|
||||
{
|
||||
val statusEntity = it.toEntity(accountManager.activeAccount()?.id!!)
|
||||
db.statusDao().insertOrReplace(statusEntity)
|
||||
currentStatus.value = Success(statusEntity)
|
||||
}, {
|
||||
},
|
||||
{
|
||||
currentStatus.value = Error(cause = it)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun loadReplies() {
|
||||
api.statusContext(statusId).fold({
|
||||
replies.value = Success(it.descendants.map{
|
||||
descendant -> descendant.toEntity(accountManager.activeAccount()?.id!!)
|
||||
})
|
||||
}, {
|
||||
api.statusContext(statusId).fold(
|
||||
{
|
||||
replies.value = Success(
|
||||
it.descendants.map { descendant ->
|
||||
descendant.toEntity(accountManager.activeAccount()?.id!!)
|
||||
}
|
||||
)
|
||||
},
|
||||
{
|
||||
replies.value = Error(cause = it)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun onFavorite(status: StatusEntity) {
|
||||
|
@ -114,5 +122,4 @@ class DetailViewModel @Inject constructor(
|
|||
useCases.onMediaVisibilityChanged(status)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,14 @@
|
|||
|
||||
package at.connyduck.pixelcat.network
|
||||
|
||||
import at.connyduck.pixelcat.model.*
|
||||
import at.connyduck.pixelcat.model.AccessToken
|
||||
import at.connyduck.pixelcat.model.Account
|
||||
import at.connyduck.pixelcat.model.AppCredentials
|
||||
import at.connyduck.pixelcat.model.Attachment
|
||||
import at.connyduck.pixelcat.model.NewStatus
|
||||
import at.connyduck.pixelcat.model.Relationship
|
||||
import at.connyduck.pixelcat.model.Status
|
||||
import at.connyduck.pixelcat.model.StatusContext
|
||||
import at.connyduck.pixelcat.network.calladapter.NetworkResponse
|
||||
import okhttp3.MultipartBody
|
||||
import retrofit2.http.Body
|
||||
|
|
Loading…
Reference in New Issue