pull/1434/head
gedoor 3 years ago
parent 8de8af41c4
commit 411b99915c
  1. 19
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleActivity.kt
  2. 31
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleAdapter.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleViewModel.kt
  4. 35
      app/src/main/res/layout/activity_txt_toc_rule.xml
  5. 51
      app/src/main/res/layout/item_txt_toc_rule.xml

@ -0,0 +1,19 @@
package io.legado.app.ui.book.local.rule
import android.os.Bundle
import androidx.activity.viewModels
import io.legado.app.base.VMBaseActivity
import io.legado.app.databinding.ActivityTxtTocRuleBinding
import io.legado.app.utils.viewbindingdelegate.viewBinding
class TxtTocRuleActivity : VMBaseActivity<ActivityTxtTocRuleBinding, TxtTocRuleViewModel>() {
override val viewModel: TxtTocRuleViewModel by viewModels()
override val binding: ActivityTxtTocRuleBinding by viewBinding(ActivityTxtTocRuleBinding::inflate)
override fun onActivityCreated(savedInstanceState: Bundle?) {
TODO("Not yet implemented")
}
}

@ -0,0 +1,31 @@
package io.legado.app.ui.book.local.rule
import android.content.Context
import android.view.ViewGroup
import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.RecyclerAdapter
import io.legado.app.data.entities.TxtTocRule
import io.legado.app.databinding.ItemTxtTocRuleBinding
class TxtTocRuleAdapter(context: Context) :
RecyclerAdapter<TxtTocRule, ItemTxtTocRuleBinding>(context) {
override fun getViewBinding(parent: ViewGroup): ItemTxtTocRuleBinding {
return ItemTxtTocRuleBinding.inflate(inflater, parent, false)
}
override fun convert(
holder: ItemViewHolder,
binding: ItemTxtTocRuleBinding,
item: TxtTocRule,
payloads: MutableList<Any>
) {
binding.cbSource.text = item.name
binding.swtEnabled.isChecked = item.enable
}
override fun registerListener(holder: ItemViewHolder, binding: ItemTxtTocRuleBinding) {
TODO("Not yet implemented")
}
}

@ -0,0 +1,6 @@
package io.legado.app.ui.book.local.rule
import android.app.Application
import io.legado.app.base.BaseViewModel
class TxtTocRuleViewModel(app: Application) : BaseViewModel(app)

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<io.legado.app.ui.widget.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentInsetStartWithNavigation="0dp"
app:contentLayout="@layout/view_search"
app:displayHomeAsUp="true"
app:title="@string/book_source" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
<io.legado.app.ui.widget.SelectActionBar
android:id="@+id/select_action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="16dp">
<io.legado.app.lib.theme.view.ThemeCheckBox
android:id="@+id/cb_source"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:singleLine="true"
android:textColor="@color/primaryText"
tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
<io.legado.app.lib.theme.view.ThemeSwitch
android:id="@+id/swt_enabled"
android:name="@string/enable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
tools:ignore="RtlSymmetry,TouchTargetSizeCheck" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_edit"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/edit"
android:padding="6dp"
android:src="@drawable/ic_edit"
android:tint="@color/primaryText" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu_more"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="6dp"
android:src="@drawable/ic_more_vert"
android:tint="@color/primaryText"
tools:ignore="RtlHardcoded" />
</LinearLayout>
Loading…
Cancel
Save