-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
352 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.jocmp.basil | ||
|
||
import androidx.paging.Pager | ||
import androidx.paging.PagingConfig | ||
import com.jocmp.basil.persistence.ArticlePagerFactory | ||
|
||
fun Account.buildPager( | ||
filter: Filter = Filter.Articles(status = Filter.Status.ALL) | ||
): Pager<Int, Article> { | ||
val pagerFactory = ArticlePagerFactory( | ||
database = database, | ||
filter = filter | ||
) | ||
|
||
return Pager( | ||
config = PagingConfig(pageSize = 10), | ||
pagingSourceFactory = { pagerFactory.find() } | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.jocmp.basil | ||
|
||
sealed class Filter(val status: Status) { | ||
enum class Status(value: String) { | ||
ALL("all"), | ||
READ("read"), | ||
STARRED("starred") | ||
} | ||
|
||
class Articles(status: Status) : Filter(status) | ||
|
||
class Feeds(val feed: Feed, status: Status) : Filter(status) | ||
|
||
class Folders(val folder: Folder, status: Status) : Filter(status) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
basil/src/main/java/com/jocmp/basil/accounts/AccountDelegate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ava/com/jocmp/basil/feeds/ExternalFeed.kt → .../com/jocmp/basil/accounts/ExternalFeed.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
basil/src/main/java/com/jocmp/basil/accounts/FeedOPMLExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.jocmp.basil.accounts | ||
|
||
import com.jocmp.basil.Feed | ||
import com.jocmp.basil.shared.prepending | ||
|
||
fun Feed.asOPML(indentLevel: Int): String { | ||
val opml = | ||
"<outline text=\"${name}\" title=\"${name}\" description=\"\" type=\"rss\" version=\"RSS\" htmlUrl=\"${siteURL}\" xmlUrl=\"${feedURL}\" basil_id=\"${id}\"/>\n" | ||
return opml.prepending(tabCount = indentLevel) | ||
} |
23 changes: 23 additions & 0 deletions
23
basil/src/main/java/com/jocmp/basil/accounts/FolderOPMLExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.jocmp.basil.accounts | ||
|
||
import com.jocmp.basil.Folder | ||
import com.jocmp.basil.shared.prepending | ||
import com.jocmp.basil.shared.repeatTab | ||
|
||
internal fun Folder.asOPML(indentLevel: Int = 0): String { | ||
if (feeds.isEmpty()) { | ||
val opml = "<outline text=\"${title}\" title=\"${title}\"/>\n" | ||
return opml.prepending(tabCount = indentLevel) | ||
} | ||
|
||
var opml = "<outline text=\"${title}\" title=\"${title}\">\n" | ||
opml = opml.prepending(tabCount = indentLevel) | ||
|
||
feeds.forEach { feed -> | ||
opml += feed.asOPML(indentLevel = indentLevel + 1) | ||
} | ||
|
||
opml = opml + repeatTab(tabCount = indentLevel) + "</outline>\n" | ||
|
||
return opml | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.