|
|
@ -10,15 +10,18 @@ import androidx.recyclerview.widget.DiffUtil |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
|
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
import io.legado.app.lib.theme.ColorUtils |
|
|
|
import io.legado.app.lib.theme.ColorUtils |
|
|
|
import io.legado.app.utils.gone |
|
|
|
import io.legado.app.utils.gone |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import kotlinx.android.synthetic.main.item_find_book.view.* |
|
|
|
import kotlinx.android.synthetic.main.item_find_book.view.* |
|
|
|
import kotlinx.android.synthetic.main.item_text.view.* |
|
|
|
import kotlinx.android.synthetic.main.item_text.view.* |
|
|
|
|
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FindBookAdapter:PagedListAdapter<BookSource, FindBookAdapter.MyViewHolder>(DIFF_CALLBACK) { |
|
|
|
class FindBookAdapter(private val scope: CoroutineScope) : |
|
|
|
|
|
|
|
PagedListAdapter<BookSource, FindBookAdapter.MyViewHolder>(DIFF_CALLBACK) { |
|
|
|
|
|
|
|
|
|
|
|
var exIndex = 0 |
|
|
|
var exIndex = 0 |
|
|
|
|
|
|
|
|
|
|
@ -58,7 +61,10 @@ class FindBookAdapter:PagedListAdapter<BookSource, FindBookAdapter.MyViewHolder> |
|
|
|
} |
|
|
|
} |
|
|
|
if (exIndex == position) { |
|
|
|
if (exIndex == position) { |
|
|
|
gl_child.visible() |
|
|
|
gl_child.visible() |
|
|
|
bookSource.getExploreRule().getExploreKinds(bookSource.bookSourceUrl)?.let { |
|
|
|
Coroutine.async(scope) { |
|
|
|
|
|
|
|
bookSource.getExploreRule().getExploreKinds(bookSource.bookSourceUrl) |
|
|
|
|
|
|
|
}.onSuccess { |
|
|
|
|
|
|
|
it?.let { |
|
|
|
var rowNum = 0 |
|
|
|
var rowNum = 0 |
|
|
|
var columnNum = 0 |
|
|
|
var columnNum = 0 |
|
|
|
gl_child.removeAllViews() |
|
|
|
gl_child.removeAllViews() |
|
|
@ -81,6 +87,7 @@ class FindBookAdapter:PagedListAdapter<BookSource, FindBookAdapter.MyViewHolder> |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
gl_child.gone() |
|
|
|
gl_child.gone() |
|
|
|
} |
|
|
|
} |
|
|
|