From 7f4b0a45e684f0b44eee471f61807d69cc14a10d Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 31 Aug 2019 21:52:39 +0800 Subject: [PATCH] up --- app/src/debug/res/values/strings.xml | 4 ++ app/src/debug/res/xml/shortcuts.xml | 35 +++++++++++ .../app/ui/booksource/GroupManageDialog.kt | 58 +++++++++++++++++++ .../main/res/layout/dialog_recycler_view.xml | 17 ++++++ app/src/main/res/layout/item_group_manage.xml | 28 +++++++++ app/src/main/res/xml/shortcuts.xml | 35 +++++++++++ 6 files changed, 177 insertions(+) create mode 100644 app/src/debug/res/values/strings.xml create mode 100644 app/src/debug/res/xml/shortcuts.xml create mode 100644 app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt create mode 100644 app/src/main/res/layout/dialog_recycler_view.xml create mode 100644 app/src/main/res/layout/item_group_manage.xml create mode 100644 app/src/main/res/xml/shortcuts.xml diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml new file mode 100644 index 000000000..b91572ada --- /dev/null +++ b/app/src/debug/res/values/strings.xml @@ -0,0 +1,4 @@ + + 阅读.debug + 阅读.debug·搜索 + \ No newline at end of file diff --git a/app/src/debug/res/xml/shortcuts.xml b/app/src/debug/res/xml/shortcuts.xml new file mode 100644 index 000000000..340b48f86 --- /dev/null +++ b/app/src/debug/res/xml/shortcuts.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt new file mode 100644 index 000000000..738a71338 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt @@ -0,0 +1,58 @@ +package io.legado.app.ui.booksource + +import android.content.Context +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.DialogFragment +import androidx.lifecycle.Observer +import androidx.recyclerview.widget.LinearLayoutManager +import io.legado.app.App +import io.legado.app.R +import io.legado.app.base.adapter.ItemViewHolder +import io.legado.app.base.adapter.SimpleRecyclerAdapter +import io.legado.app.utils.splitNotBlank +import kotlinx.android.synthetic.main.dialog_recycler_view.* + +class GroupManageDialog : DialogFragment() { + + private lateinit var adapter: GroupAdapter + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.dialog_recycler_view, container) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + initData() + } + + private fun initData() { + tool_bar.title = getString(R.string.group_manage) + adapter = GroupAdapter(requireContext()) + recycler_view.layoutManager = LinearLayoutManager(requireContext()) + recycler_view.adapter = adapter + App.db.bookSourceDao().observeGroup().observe(viewLifecycleOwner, Observer { + val groups = linkedSetOf() + it.map { group -> + groups.addAll(group.splitNotBlank(",", ";")) + } + adapter.setItems(groups.toList()) + }) + } + + + class GroupAdapter(context: Context) : + SimpleRecyclerAdapter(context, R.layout.item_group_manage) { + + override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList) { + + } + + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_recycler_view.xml b/app/src/main/res/layout/dialog_recycler_view.xml new file mode 100644 index 000000000..6ac7d8c01 --- /dev/null +++ b/app/src/main/res/layout/dialog_recycler_view.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_group_manage.xml b/app/src/main/res/layout/item_group_manage.xml new file mode 100644 index 000000000..de089dbb4 --- /dev/null +++ b/app/src/main/res/layout/item_group_manage.xml @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml new file mode 100644 index 000000000..05445a90b --- /dev/null +++ b/app/src/main/res/xml/shortcuts.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +