aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-09-12 00:08:34 -0400
committerGitHub <noreply@github.com>2017-09-12 00:08:34 -0400
commitcfa645abd84a7dc356e2e158145b039303cd919e (patch)
tree8e365d5a3cc164c29220c18d3e3908a76189c814 /app/src/main/kotlin/com
parentfa00faa72c9764c72c6075e52e13df5c3561693b (diff)
downloadfrost-cfa645abd84a7dc356e2e158145b039303cd919e.tar.gz
frost-cfa645abd84a7dc356e2e158145b039303cd919e.tar.bz2
frost-cfa645abd84a7dc356e2e158145b039303cd919e.zip
Fix most recents in main activity (#269)
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt28
1 files changed, 16 insertions, 12 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
index fd2b6cc1..f0bf2efa 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
@@ -30,18 +30,22 @@ class WebFragment : Fragment() {
const val REQUEST_TEXT_ZOOM = 17
const val REQUEST_REFRESH = 99
- operator fun invoke(data: FbItem, position: Int) = WebFragment().withArguments(
- ARG_URL to data.url,
- ARG_POSITION to position,
- ARG_URL_ENUM to when (data) {
- //If is feed, check if sorting method is specified
- FbItem.FEED -> when (FeedSort(Prefs.feedSort)) {
- FeedSort.DEFAULT -> data
- FeedSort.MOST_RECENT -> FbItem.FEED_MOST_RECENT
- FeedSort.TOP -> FbItem.FEED_TOP_STORIES
- }
- else -> data
- })
+ operator fun invoke(data: FbItem, position: Int) = WebFragment().apply {
+ val d = when (data) {
+ //If is feed, check if sorting method is specified
+ FbItem.FEED -> when (FeedSort(Prefs.feedSort)) {
+ FeedSort.DEFAULT -> data
+ FeedSort.MOST_RECENT -> FbItem.FEED_MOST_RECENT
+ FeedSort.TOP -> FbItem.FEED_TOP_STORIES
+ }
+ else -> data
+ }
+ withArguments(
+ ARG_URL to d.url,
+ ARG_POSITION to position,
+ ARG_URL_ENUM to d
+ )
+ }
}
// val refresh: SwipeRefreshLayout by lazy { frostWebView.refresh }