|
|
@ -1,18 +1,23 @@ |
|
|
|
package io.legado.app.ui.download |
|
|
|
package io.legado.app.ui.download |
|
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
|
|
|
|
import androidx.lifecycle.LiveData |
|
|
|
|
|
|
|
import androidx.lifecycle.Observer |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
|
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import kotlinx.android.synthetic.main.activity_download.* |
|
|
|
import kotlinx.android.synthetic.main.activity_download.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DownloadActivity : BaseActivity(R.layout.activity_download) { |
|
|
|
class DownloadActivity : BaseActivity(R.layout.activity_download) { |
|
|
|
|
|
|
|
|
|
|
|
lateinit var adapter: DownloadAdapter |
|
|
|
lateinit var adapter: DownloadAdapter |
|
|
|
|
|
|
|
private var bookshelfLiveData: LiveData<List<Book>>? = null |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
initRecyclerView() |
|
|
|
initRecyclerView() |
|
|
|
|
|
|
|
initLiveData() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initRecyclerView() { |
|
|
|
private fun initRecyclerView() { |
|
|
@ -21,4 +26,10 @@ class DownloadActivity : BaseActivity(R.layout.activity_download) { |
|
|
|
recycler_view.adapter = adapter |
|
|
|
recycler_view.adapter = adapter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun initLiveData() { |
|
|
|
|
|
|
|
bookshelfLiveData?.removeObservers(this) |
|
|
|
|
|
|
|
bookshelfLiveData?.observe(this, Observer { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |