|
1 | 1 | package me.jbusdriver.db.bean |
2 | 2 |
|
3 | | -import android.content.ContentValues |
4 | 3 | import android.content.Context |
5 | 4 | import me.jbusdriver.base.* |
| 5 | +import me.jbusdriver.base.mvp.bean.PageInfo |
| 6 | +import me.jbusdriver.commen.bean.ICollectCategory |
| 7 | +import me.jbusdriver.commen.bean.ILink |
6 | 8 | import me.jbusdriver.common.JBus |
7 | 9 | import me.jbusdriver.common.isEndWithXyzHost |
8 | | -import me.jbusdriver.db.CategoryTable |
9 | 10 | import me.jbusdriver.http.JAVBusService |
10 | 11 | import me.jbusdriver.mvp.bean.* |
11 | 12 | import me.jbusdriver.ui.activity.MovieDetailActivity |
12 | 13 | import me.jbusdriver.ui.activity.MovieListActivity |
13 | 14 | import java.util.* |
14 | 15 |
|
15 | 16 |
|
16 | | -data class Category(val name: String, val pid: Int = -1, val tree: String, var order: Int = 0) { |
17 | | - var id: Int? = null |
18 | | - |
19 | | - @delegate:Transient |
20 | | - val depth: Int by lazy { tree.split("/").filter { it.isNotBlank() }.size } |
21 | | - |
22 | | - fun cv(update: Boolean = false): ContentValues = ContentValues().also { |
23 | | - if (id != null || update) it.put(CategoryTable.COLUMN_ID, id) |
24 | | - it.put(CategoryTable.COLUMN_NAME, name) |
25 | | - it.put(CategoryTable.COLUMN_P_ID, pid) |
26 | | - it.put(CategoryTable.COLUMN_TREE, tree) |
27 | | - it.put(CategoryTable.COLUMN_ORDER, order) |
28 | | - } |
29 | | - |
30 | | - override fun equals(other: Any?) = |
31 | | - other?.let { (it as? Category)?.id == this.id } ?: false |
32 | | - |
33 | | - fun equalAll(other: Category?) = other?.let { it.id == this.id && it.name == this.name && it.pid == this.pid && it.tree == this.tree } |
34 | | - ?: false |
35 | | -} |
36 | | - |
37 | | -/** |
38 | | - * 预留 [3..9]的分类 |
39 | | - */ |
40 | | -val MovieCategory = Category("默认电影分类", -1, "1/", Int.MAX_VALUE).apply { id = 1 } |
41 | | -val ActressCategory = Category("默认演员分类", -1, "2/", Int.MAX_VALUE).apply { id = 2 } |
42 | | -val LinkCategory = Category("默认链接分类", -1, "10/", Int.MAX_VALUE).apply { id = 10 } |
43 | | -val AllFirstParentDBCategoryGroup by lazy { arrayMapof(1 to MovieCategory, 2 to ActressCategory, 10 to LinkCategory) } |
44 | | - |
45 | | - |
46 | 17 | data class LinkItem(val type: Int, val createTime: Date, val key: String, val jsonStr: String, var categoryId: Int = -1) { |
47 | 18 | var id: Int? = null |
48 | 19 | fun getLinkValue(): ILink = doGet(type, jsonStr).also { |
@@ -104,11 +75,6 @@ private fun doGet(type: Int, jsonStr: String) = when (type) { |
104 | 75 | } |
105 | 76 |
|
106 | 77 |
|
107 | | -interface ICollectCategory { |
108 | | - var categoryId: Int |
109 | | -} |
110 | | - |
111 | | - |
112 | 78 | data class DBPage(val currentPage: Int, val totalPage: Int, val pageSize: Int = 20) |
113 | 79 |
|
114 | 80 | val DBPage.toPageInfo |
|
0 commit comments