feat: 优化代码

pull/111/head
kunfei 5 years ago
parent 4c0deef70c
commit cf0792529c
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  2. 9
      app/src/main/res/drawable/recyclerview_divider_horizontal.xml
  3. 0
      app/src/main/res/drawable/recyclerview_divider_vertical.xml

@ -8,7 +8,6 @@ import android.widget.PopupWindow
import androidx.appcompat.view.SupportMenuInflater import androidx.appcompat.view.SupportMenuInflater
import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.view.menu.MenuBuilder
import androidx.appcompat.view.menu.MenuItemImpl import androidx.appcompat.view.menu.MenuItemImpl
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R import io.legado.app.R
@ -36,9 +35,6 @@ class TextActionMenu(context: Context, callBack: CallBack) :
private fun initRecyclerView() = with(contentView) { private fun initRecyclerView() = with(contentView) {
val adapter = Adapter(context) val adapter = Adapter(context)
recycler_view.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false) recycler_view.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
recycler_view.addItemDecoration(
DividerItemDecoration(context, DividerItemDecoration.HORIZONTAL)
)
recycler_view.adapter = adapter recycler_view.adapter = adapter
val menu = MenuBuilder(context) val menu = MenuBuilder(context)
SupportMenuInflater(context).inflate(R.menu.content_select_action, menu) SupportMenuInflater(context).inflate(R.menu.content_select_action, menu)

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android">
<shape>
<size android:width="1dp" />
<!--分割线的颜色-->
<solid android:color="@color/bg_divider_line" />
</shape>
</inset>
Loading…
Cancel
Save