pull/32/head
parent
ff3af56226
commit
7f4b0a45e6
@ -0,0 +1,4 @@ |
|||||||
|
<resources> |
||||||
|
<string name="app_name">阅读.debug</string> |
||||||
|
<string name="receiving_shared_label">阅读.debug·搜索</string> |
||||||
|
</resources> |
@ -0,0 +1,35 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<shortcuts xmlns:tools="http://schemas.android.com/tools" |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<shortcut |
||||||
|
android:shortcutId="bookRead" |
||||||
|
android:enabled="true" |
||||||
|
android:icon="@drawable/ic_read_book" |
||||||
|
android:shortcutShortLabel="@string/last_read" |
||||||
|
android:shortcutLongLabel="@string/last_read" |
||||||
|
android:shortcutDisabledMessage="@string/last_read" |
||||||
|
tools:ignore="UnusedAttribute"> |
||||||
|
|
||||||
|
<intent |
||||||
|
android:action="android.intent.action.VIEW" |
||||||
|
android:targetPackage="com.gedoor.monkeybook.debug" |
||||||
|
android:targetClass="com.kunfei.bookshelf.view.activity.WelcomeToReadActivity" /> |
||||||
|
<categories android:name="android.shortcut.conversation" /> |
||||||
|
</shortcut> |
||||||
|
|
||||||
|
<shortcut |
||||||
|
android:shortcutId="bookshelf" |
||||||
|
android:enabled="true" |
||||||
|
android:icon="@drawable/ic_read_book" |
||||||
|
android:shortcutShortLabel="@string/bookshelf" |
||||||
|
android:shortcutLongLabel="@string/bookshelf" |
||||||
|
android:shortcutDisabledMessage="@string/bookshelf" |
||||||
|
tools:ignore="UnusedAttribute"> |
||||||
|
|
||||||
|
<intent |
||||||
|
android:action="android.intent.action.VIEW" |
||||||
|
android:targetPackage="com.gedoor.monkeybook.debug" |
||||||
|
android:targetClass="com.kunfei.bookshelf.view.activity.MainActivity" /> |
||||||
|
<categories android:name="android.shortcut.conversation" /> |
||||||
|
</shortcut> |
||||||
|
</shortcuts> |
@ -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<String>() |
||||||
|
it.map { group -> |
||||||
|
groups.addAll(group.splitNotBlank(",", ";")) |
||||||
|
} |
||||||
|
adapter.setItems(groups.toList()) |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
class GroupAdapter(context: Context) : |
||||||
|
SimpleRecyclerAdapter<String>(context, R.layout.item_group_manage) { |
||||||
|
|
||||||
|
override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:orientation="vertical" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar |
||||||
|
android:id="@+id/tool_bar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" /> |
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView |
||||||
|
android:id="@+id/recycler_view" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" /> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -0,0 +1,28 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:padding="16dp" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/group" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_weight="1" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/tv_edit" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:padding="8dp" |
||||||
|
android:text="@string/edit" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/tv_del" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:padding="8dp" |
||||||
|
android:text="@string/delete" /> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -0,0 +1,35 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<shortcuts xmlns:tools="http://schemas.android.com/tools" |
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<shortcut |
||||||
|
android:shortcutId="bookRead" |
||||||
|
android:enabled="true" |
||||||
|
android:icon="@drawable/ic_read_book" |
||||||
|
android:shortcutShortLabel="@string/last_read" |
||||||
|
android:shortcutLongLabel="@string/last_read" |
||||||
|
android:shortcutDisabledMessage="@string/last_read" |
||||||
|
tools:ignore="UnusedAttribute"> |
||||||
|
|
||||||
|
<intent |
||||||
|
android:action="android.intent.action.VIEW" |
||||||
|
android:targetPackage="com.gedoor.monkeybook" |
||||||
|
android:targetClass="com.kunfei.bookshelf.view.activity.WelcomeToReadActivity" /> |
||||||
|
<categories android:name="android.shortcut.conversation" /> |
||||||
|
</shortcut> |
||||||
|
|
||||||
|
<shortcut |
||||||
|
android:shortcutId="bookshelf" |
||||||
|
android:enabled="true" |
||||||
|
android:icon="@drawable/ic_read_book" |
||||||
|
android:shortcutShortLabel="@string/bookshelf" |
||||||
|
android:shortcutLongLabel="@string/bookshelf" |
||||||
|
android:shortcutDisabledMessage="@string/bookshelf" |
||||||
|
tools:ignore="UnusedAttribute"> |
||||||
|
|
||||||
|
<intent |
||||||
|
android:action="android.intent.action.VIEW" |
||||||
|
android:targetPackage="com.gedoor.monkeybook" |
||||||
|
android:targetClass="com.kunfei.bookshelf.view.activity.MainActivity" /> |
||||||
|
<categories android:name="android.shortcut.conversation" /> |
||||||
|
</shortcut> |
||||||
|
</shortcuts> |
Loading…
Reference in new issue