| author | Da Risk <da_risk@geekorum.com> |
| Wed, 12 Jan 2022 17:29:59 -0400 | |
| changeset 882 | 7a74abf66c49 |
| parent 846 | ac0863af5ef6 |
| child 936 | 60a20fbca644 |
| permissions | -rw-r--r-- |
|
137
5464f07a306c
Update copyright headers for 2019
Da Risk <da_risk@geekorum.com>
parents:
0
diff
changeset
|
1 |
/* |
| 0 | 2 |
* Geekttrss is a RSS feed reader application on the Android Platform. |
3 |
* |
|
| 882 | 4 |
* Copyright (C) 2017-2022 by Frederic-Charles Barthelery. |
| 0 | 5 |
* |
6 |
* This file is part of Geekttrss. |
|
7 |
* |
|
8 |
* Geekttrss is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* Geekttrss is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with Geekttrss. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
21 |
package com.geekorum.ttrss.providers |
| 0 | 22 |
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
23 |
import android.net.Uri |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
24 |
import android.provider.BaseColumns |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
25 |
import androidx.core.net.toUri |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
26 |
import com.geekorum.ttrss.BuildConfig |
| 0 | 27 |
|
28 |
/** |
|
29 |
* Allows to interact with the ArticlesProvider. |
|
30 |
*/ |
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
31 |
object ArticlesContract {
|
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
32 |
const val AUTHORITY = "${BuildConfig.APPLICATION_ID}.providers.articles"
|
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
33 |
@JvmStatic |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
34 |
@get:JvmName("AUTHORITY_URI")
|
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
35 |
val AUTHORITY_URI = "content://$AUTHORITY".toUri() |
| 0 | 36 |
|
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
37 |
object Article {
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
38 |
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, "articles") |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
39 |
const val CONTENT_TYPE = "vnd.android.cursor.dir/vnd.com.geekorum.ttrss.article" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
40 |
const val CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.com.geekorum.ttrss.article" |
| 0 | 41 |
|
42 |
// columns of an Article |
|
43 |
// booleans |
|
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
44 |
const val _ID = BaseColumns._ID |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
45 |
const val UNREAD = "unread" |
| 0 | 46 |
// only use temporary to prevent cursors to remove the articles to be shown after reading it |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
47 |
const val TRANSIENT_UNREAD = "transiant_unread" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
48 |
const val STARRED = "marked" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
49 |
const val PUBLISHED = "published" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
50 |
const val IS_UPDATED = "is_updated" |
| 0 | 51 |
// integers |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
52 |
const val SCORE = "score" |
| 0 | 53 |
// longs |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
54 |
const val LAST_TIME_UPDATE = "last_time_update" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
55 |
const val FEED_ID = "feed_id" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
56 |
const val TITLE = "title" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
57 |
const val LINK = "link" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
58 |
const val TAGS = "tags" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
59 |
const val CONTENT = "content" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
60 |
const val AUTHOR = "author" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
61 |
const val FLAVOR_IMAGE_URI = "flavor_image_uri" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
62 |
const val CONTENT_EXCERPT = "content_excerpt" |
| 0 | 63 |
} |
64 |
||
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
65 |
object Feed {
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
66 |
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, "feeds") |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
67 |
// columns of a Feed |
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
68 |
const val _ID = BaseColumns._ID |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
69 |
const val URL = "url" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
70 |
const val TITLE = "title" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
71 |
const val CAT_ID = "cat_id" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
72 |
const val LAST_TIME_UPDATE = "last_time_update" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
73 |
const val DISPLAY_TITLE = "display_title" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
74 |
const val UNREAD_COUNT = "unread_count" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
75 |
const val IS_SUBSCRIBED = "is_subscribed" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
76 |
const val ICON_URL = "feed_icon_url" |
| 0 | 77 |
} |
78 |
||
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
79 |
object Category {
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
80 |
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, "categories") |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
81 |
// columns of a Category |
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
82 |
const val _ID = BaseColumns._ID |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
83 |
const val TITLE = "title" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
84 |
const val UNREAD_COUNT = "unread_count" |
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
85 |
} |
| 0 | 86 |
|
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
87 |
object Transaction {
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
88 |
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, "transactions") |
| 0 | 89 |
// columns of a Transaction |
90 |
// long |
|
|
571
f3a32e5ef624
ArticlesContract: declare _ID
Da Risk <da_risk@geekorum.com>
parents:
568
diff
changeset
|
91 |
const val _ID = BaseColumns._ID |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
92 |
const val ARTICLE_ID = "article_id" |
| 0 | 93 |
// String |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
94 |
const val FIELD = "field" |
| 0 | 95 |
//boolean |
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
96 |
const val VALUE = "value" |
| 0 | 97 |
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
98 |
enum class Field(val apiInteger: Int) {
|
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
99 |
STARRED(0), PUBLISHED(1), UNREAD(2), NOTE(3); |
| 0 | 100 |
|
|
568
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
101 |
@Deprecated("use property", ReplaceWith("apiInteger"))
|
|
0023b4c9eb17
ArticlesContract: convert to kotlin
Da Risk <da_risk@geekorum.com>
parents:
440
diff
changeset
|
102 |
fun asApiInteger(): Int = apiInteger |
| 0 | 103 |
|
104 |
} |
|
105 |
} |
|
106 |
} |