|
|
|
@ -5,7 +5,6 @@ import android.os.Bundle |
|
|
|
|
import android.view.View |
|
|
|
|
import androidx.core.view.isGone |
|
|
|
|
import androidx.fragment.app.activityViewModels |
|
|
|
|
import androidx.lifecycle.lifecycleScope |
|
|
|
|
import androidx.recyclerview.widget.GridLayoutManager |
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
@ -31,6 +30,7 @@ import kotlinx.coroutines.flow.catch |
|
|
|
|
import kotlinx.coroutines.flow.conflate |
|
|
|
|
import kotlinx.coroutines.flow.flowOn |
|
|
|
|
import kotlinx.coroutines.flow.map |
|
|
|
|
import kotlinx.coroutines.launch |
|
|
|
|
import kotlin.math.max |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -105,7 +105,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books), |
|
|
|
|
|
|
|
|
|
private fun upRecyclerData() { |
|
|
|
|
booksFlowJob?.cancel() |
|
|
|
|
booksFlowJob = lifecycleScope.launchWhenStarted { |
|
|
|
|
booksFlowJob = launch { |
|
|
|
|
when (groupId) { |
|
|
|
|
AppConst.bookGroupAllId -> appDb.bookDao.flowAll() |
|
|
|
|
AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal() |
|
|
|
|