From 2481fa242c8b5fdf909e64ef8c56930468bc5700 Mon Sep 17 00:00:00 2001 From: zlj <390057892@qq.com> Date: Fri, 13 Dec 2019 16:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=81=B6=E5=B0=94=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=BB=9A=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../read/activity/NovelBookDetailActivity.kt | 14 ++--- .../novel/read/activity/NovelReadActivity.kt | 1 - .../com/novel/read/adapter/SearchAdapter.kt | 6 +-- app/src/main/res/layout/activity_read.xml | 54 +++++++++++-------- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/com/novel/read/activity/NovelBookDetailActivity.kt b/app/src/main/java/com/novel/read/activity/NovelBookDetailActivity.kt index c526aa7..1875937 100644 --- a/app/src/main/java/com/novel/read/activity/NovelBookDetailActivity.kt +++ b/app/src/main/java/com/novel/read/activity/NovelBookDetailActivity.kt @@ -38,7 +38,7 @@ class NovelBookDetailActivity : NovelBaseActivity(), View.OnClickListener { private var isCollected = false private var mCollBookBean: CollBookBean? = null - private var mProgressDialog: ProgressDialog? = null + private lateinit var mProgressDialog: ProgressDialog override val layoutId: Int get() = R.layout.activity_book_detail @@ -47,6 +47,7 @@ class NovelBookDetailActivity : NovelBaseActivity(), View.OnClickListener { rlv_lovely.layoutManager = LinearLayoutManager(this) mAdapter = LoveLyAdapter(mList) rlv_lovely.adapter = mAdapter + mProgressDialog = ProgressDialog(this) } override fun initData() { @@ -73,11 +74,8 @@ class NovelBookDetailActivity : NovelBaseActivity(), View.OnClickListener { tv_add_book.text = resources.getString(R.string.add_book) isCollected = false } else { - if (mProgressDialog == null) { - mProgressDialog = ProgressDialog(this) - mProgressDialog!!.setTitle("正在添加到书架中") - } - mProgressDialog!!.show() + mProgressDialog.setTitle("正在添加到书架中") + mProgressDialog.show() AccountManager.getInstance() .getBookArticle(mBookId.toString(), "2", "1", "100000") @@ -185,9 +183,7 @@ class NovelBookDetailActivity : NovelBaseActivity(), View.OnClickListener { } private fun dismiss() { - if (mProgressDialog != null) { - mProgressDialog!!.dismiss() - } + mProgressDialog.dismiss() } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { diff --git a/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt b/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt index a9e9975..82d93af 100644 --- a/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt +++ b/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt @@ -595,7 +595,6 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene super.onDestroy() EventManager.instance.unregisterSubscriber(this) mPageLoader.closeBook() -// mPageLoader = null unbindService(mConn) unregisterReceiver(mReceiver) } diff --git a/app/src/main/java/com/novel/read/adapter/SearchAdapter.kt b/app/src/main/java/com/novel/read/adapter/SearchAdapter.kt index a4da871..3802822 100644 --- a/app/src/main/java/com/novel/read/adapter/SearchAdapter.kt +++ b/app/src/main/java/com/novel/read/adapter/SearchAdapter.kt @@ -92,10 +92,7 @@ class SearchAdapter(private val mList: List, recyclerView: val bookBean = mList[i] viewHolder.mTvBookName.text = bookBean.title viewHolder.itemView.setOnClickListener { view -> - mClickListener!!.onItemClick( - view, - i - ) + mClickListener!!.onItemClick(view, i) } } is BookHolder -> { @@ -158,7 +155,6 @@ class SearchAdapter(private val mList: List, recyclerView: this.mClickListener = mListener } - interface OnItemClickListener { fun onItemClick(view: View, pos: Int) } diff --git a/app/src/main/res/layout/activity_read.xml b/app/src/main/res/layout/activity_read.xml index 72974ca..92b0899 100644 --- a/app/src/main/res/layout/activity_read.xml +++ b/app/src/main/res/layout/activity_read.xml @@ -2,9 +2,9 @@ @@ -43,21 +43,21 @@ android:id="@+id/read_tv_brief" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginEnd="10dp" android:layout_toStartOf="@id/read_tv_community" android:drawableStart="@drawable/ic_book_detail" - android:text="@string/brief" - android:gravity="center" android:drawablePadding="10dp" - android:layout_marginEnd="10dp"/> + android:gravity="center" + android:text="@string/brief" /> @@ -72,27 +72,29 @@ tools:visibility="gone" /> - + app:layout_constraintTop_toTopOf="parent" /> + android:layout_height="wrap_content" + app:layout_constraintBottom_toTopOf="@+id/read_ll_bottom_menu" /> - + android:layout_height="190dp" + app:layout_constraintBottom_toTopOf="@+id/read_ll_bottom_menu" /> - - - - + + + + - - + + android:layout_height="0dp" + android:layout_weight="1"> + + + @@ -188,8 +196,8 @@ android:id="@+id/iv_guide" android:layout_width="match_parent" android:layout_height="match_parent" - android:src="@drawable/ic_guide" android:scaleType="fitXY" - android:visibility="gone"/> + android:src="@drawable/ic_guide" + android:visibility="gone" /> \ No newline at end of file