修改偶尔无法滚动问题

old
zlj 5 years ago
parent 0fa8900c43
commit 2481fa242c
  1. 14
      app/src/main/java/com/novel/read/activity/NovelBookDetailActivity.kt
  2. 1
      app/src/main/java/com/novel/read/activity/NovelReadActivity.kt
  3. 6
      app/src/main/java/com/novel/read/adapter/SearchAdapter.kt
  4. 32
      app/src/main/res/layout/activity_read.xml

@ -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?) {

@ -595,7 +595,6 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
super.onDestroy()
EventManager.instance.unregisterSubscriber(this)
mPageLoader.closeBook()
// mPageLoader = null
unbindService(mConn)
unregisterReceiver(mReceiver)
}

@ -92,10 +92,7 @@ class SearchAdapter(private val mList: List<SearchResp.BookBean>, 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<SearchResp.BookBean>, recyclerView:
this.mClickListener = mListener
}
interface OnItemClickListener {
fun onItemClick(view: View, pos: Int)
}

@ -2,9 +2,9 @@
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/read_dl_slide"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/read_dl_slide"
tools:context=".activity.NovelReadActivity">
@ -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" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/read_tv_community"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:drawableStart="@drawable/ic_label"
android:drawablePadding="10dp"
android:gravity="center"
android:drawableStart="@drawable/ic_label"
android:text="@string/label" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
@ -72,21 +72,23 @@
tools:visibility="gone" />
<include layout="@layout/layout_download"
<include
layout="@layout/layout_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<include
layout="@layout/layout_light"
app:layout_constraintBottom_toTopOf="@+id/read_ll_bottom_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/read_ll_bottom_menu" />
<include layout="@layout/layout_read_mark"
app:layout_constraintBottom_toTopOf="@+id/read_ll_bottom_menu"
<include
layout="@layout/layout_read_mark"
android:layout_width="match_parent"
android:layout_height="190dp" />
android:layout_height="190dp"
app:layout_constraintBottom_toTopOf="@+id/read_ll_bottom_menu" />
<!--<include-->
<!--layout="@layout/layout_setting"-->
@ -174,12 +176,18 @@
android:text="@string/contents"
android:textColor="@color/black"
android:textSize="20sp" />
<!-- 这里用ListView是因为它带有旁边的滚动条,加RelativeLayout是解决ListView偶尔无法滚动问题 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ListView
android:id="@+id/rlv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</RelativeLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
@ -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:src="@drawable/ic_guide"
android:visibility="gone" />
</androidx.drawerlayout.widget.DrawerLayout>
Loading…
Cancel
Save