From e065ea45eb04fc89b35c0bdf3b6705ff83be57e9 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 22 Nov 2019 15:34:30 +0800 Subject: [PATCH] up --- .../app/ui/book/info/BookInfoActivity.kt | 41 +-- .../res/layout-land/activity_book_info.xml | 330 ------------------ .../main/res/layout/activity_book_info.xml | 93 ++--- 3 files changed, 28 insertions(+), 436 deletions(-) delete mode 100644 app/src/main/res/layout-land/activity_book_info.xml diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index fc9e193d9..ac28de108 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -6,8 +6,6 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import androidx.lifecycle.Observer -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.constant.BookType @@ -15,13 +13,11 @@ import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.help.ImageLoader import io.legado.app.help.IntentDataHelp -import io.legado.app.lib.theme.ATH import io.legado.app.ui.audio.AudioPlayActivity import io.legado.app.ui.book.info.edit.BookInfoEditActivity import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.source.edit.BookSourceEditActivity import io.legado.app.ui.changesource.ChangeSourceDialog -import io.legado.app.utils.getCompatDrawable import io.legado.app.utils.getViewModel import io.legado.app.utils.gone import io.legado.app.utils.visible @@ -38,11 +34,8 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo override val viewModel: BookInfoViewModel get() = getViewModel(BookInfoViewModel::class.java) - private lateinit var adapter: ChapterListAdapter - override fun onActivityCreated(savedInstanceState: Bundle?) { setSupportActionBar(toolbar) - initRecyclerView() viewModel.bookData.observe(this, Observer { showBook(it) }) viewModel.isLoadingData.observe(this, Observer { upLoading(it) }) viewModel.chapterListData.observe(this, Observer { showChapter(it) }) @@ -124,14 +117,11 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo private fun showChapter(chapterList: List) { viewModel.bookData.value?.let { if (it.durChapterIndex < chapterList.size) { - tv_current_chapter_info.text = chapterList[it.durChapterIndex].title + tv_chapter.text = chapterList[it.durChapterIndex].title } else { - tv_current_chapter_info.text = chapterList.last().title + tv_chapter.text = chapterList.last().title } } - adapter.clearItems() - adapter.addItems(chapterList) - rv_chapter_list.scrollToPosition(viewModel.durChapterIndex) upLoading(false) } @@ -148,20 +138,6 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo } } - private fun initRecyclerView() { - adapter = ChapterListAdapter(this, this) - ATH.applyEdgeEffectColor(rv_chapter_list) - rv_chapter_list.layoutManager = LinearLayoutManager(this) - getCompatDrawable(R.drawable.recyclerview_item_divider)?.let { drawable -> - rv_chapter_list.addItemDecoration( - DividerItemDecoration(this, DividerItemDecoration.VERTICAL).apply { - setDrawable(drawable) - } - ) - } - rv_chapter_list.adapter = adapter - } - private fun initOnClick() { tv_read.onClick { viewModel.bookData.value?.let { @@ -194,16 +170,11 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo ChangeSourceDialog.show(supportFragmentManager, it.name, it.author) } } - tv_current_chapter_info.onClick { - viewModel.bookData.value?.let { - rv_chapter_list.scrollToPosition(it.durChapterIndex) - } - } - iv_chapter_top.onClick { - rv_chapter_list.scrollToPosition(0) + tv_chapter.onClick { + } - iv_chapter_bottom.onClick { - rv_chapter_list.scrollToPosition(adapter.itemCount - 1) + tv_group.onClick { + } } diff --git a/app/src/main/res/layout-land/activity_book_info.xml b/app/src/main/res/layout-land/activity_book_info.xml deleted file mode 100644 index a284835eb..000000000 --- a/app/src/main/res/layout-land/activity_book_info.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_book_info.xml b/app/src/main/res/layout/activity_book_info.xml index 9c2887c68..080f66590 100644 --- a/app/src/main/res/layout/activity_book_info.xml +++ b/app/src/main/res/layout/activity_book_info.xml @@ -140,10 +140,11 @@ + app:layout_constraintTop_toBottomOf="@+id/iv_cover" + app:layout_constraintBottom_toTopOf="@+id/view_other"> + + + app:layout_constraintTop_toBottomOf="@+id/view_info" + app:layout_constraintBottom_toTopOf="@+id/fl_action"> - + android:layout_height="wrap_content" + android:padding="12dp" + android:text="@string/group" + android:textColor="@color/tv_text_default" + android:textSize="16sp" /> - - - - - - - - - - - - -