diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
6 files changed, 33 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt index 759e8298..9014b50d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt @@ -18,6 +18,7 @@ import co.zsmb.materialdrawerkt.builders.Builder import co.zsmb.materialdrawerkt.builders.accountHeader import co.zsmb.materialdrawerkt.builders.drawer import co.zsmb.materialdrawerkt.draweritems.badgeable.primaryItem +import co.zsmb.materialdrawerkt.draweritems.divider import co.zsmb.materialdrawerkt.draweritems.profile.profile import co.zsmb.materialdrawerkt.draweritems.profile.profileSetting import com.mikepenz.google_material_typeface_library.GoogleMaterial @@ -226,9 +227,17 @@ class MainActivity : BaseActivity() { } } drawerHeader.setActiveProfile(Prefs.userId) + primaryItem(FbTab.FEED_MOST_RECENT) + primaryItem(FbTab.FEED_TOP_STORIES) primaryItem(FbTab.ACTIVITY_LOG) + divider() + primaryItem(FbTab.EVENTS) + primaryItem(FbTab.BIRTHDAYS) + divider() primaryItem(FbTab.PHOTOS) primaryItem(FbTab.GROUPS) + primaryItem(FbTab.PAGES) + primaryItem(FbTab.SAVED) } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt index 8df7f1bd..665e32b4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt @@ -1,5 +1,6 @@ package com.pitchedapps.frost +import android.content.Intent import android.os.Bundle import android.support.design.widget.CoordinatorLayout import android.support.v7.app.AppCompatActivity @@ -50,12 +51,26 @@ open class WebOverlayActivity : AppCompatActivity() { frostWeb.web.setupWebview(url) frostWeb.web.addTitleListener({ toolbar.title = it }) - L.d("UU $userId") if (userId != Prefs.userId) FbCookie.switchUser(userId) { frostWeb.web.loadBaseUrl() } else frostWeb.web.loadBaseUrl() } /** + * Manage url loadings + * This is usually only called when multiple listeners are added and inject the same url + * We will avoid reloading if the url is the same + */ + override fun onNewIntent(intent: Intent) { + super.onNewIntent(intent) + val newUrl = intent.extras!!.getString(ARG_URL).formattedFbUrl + if (url != newUrl) { + this.intent = intent + frostWeb.web.baseUrl = newUrl + frostWeb.web.loadBaseUrl() + } + } + + /** * Our theme for the overlay should be fully opaque */ fun theme() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt index 95991d90..4deef24c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbTab.kt @@ -12,7 +12,7 @@ import com.pitchedapps.frost.web.FrostWebViewCore enum class FbTab(@StringRes val titleId: Int, val icon: IIcon, relativeUrl: String, val webClient: ((webCore: FrostWebViewCore) -> FrostWebViewClient)? = null) { FEED(R.string.feed, CommunityMaterial.Icon.cmd_newspaper, ""), - FEED_MOST_RECENT(R.string.most_recent, GoogleMaterial.Icon.gmd_grade, "/?sk=h_chr"), + FEED_MOST_RECENT(R.string.most_recent, GoogleMaterial.Icon.gmd_history, "/?sk=h_chr"), FEED_TOP_STORIES(R.string.top_stories, GoogleMaterial.Icon.gmd_star, "/?sk=h_nor"), PROFILE(R.string.profile, CommunityMaterial.Icon.cmd_account, "me"), EVENTS(R.string.events, GoogleMaterial.Icon.gmd_event, "events/upcoming"), @@ -33,5 +33,4 @@ enum class FbTab(@StringRes val titleId: Int, val icon: IIcon, relativeUrl: Stri val url = "$FB_URL_BASE$relativeUrl" } -fun defaultTabs(): List<FbTab> = listOf(FbTab.FEED, FbTab.MESSAGES, FbTab.NOTIFICATIONS, FbTab.MENU) -fun defaultDrawers(): List<FbTab> = listOf(FbTab.ACTIVITY_LOG, FbTab.PAGES, FbTab.GROUPS, FbTab.SAVED)
\ No newline at end of file +fun defaultTabs(): List<FbTab> = listOf(FbTab.FEED, FbTab.MESSAGES, FbTab.NOTIFICATIONS, FbTab.MENU)
\ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt index e3db5444..7bb73471 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt @@ -10,7 +10,7 @@ import com.pitchedapps.frost.utils.L * //TODO add folder mapping using Prefs */ enum class JsAssets : InjectorContract { - MENU, MENU_CLICK, CLICK_INTERCEPTOR, HEADER_BADGES + MENU, CLICK_A, CLICK_INTERCEPTOR, HEADER_BADGES ; var file = "${name.toLowerCase()}.min.js" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt index d015e22e..a791363e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt @@ -65,7 +65,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() { L.d("Page finished reveal") webCore.jsInject(CssHider.HEADER, Prefs.themeInjector, - // JsAssets.CLICK_INTERCEPTOR, + JsAssets.CLICK_A, callback = { refreshObservable.onNext(false) }) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClientMenu.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClientMenu.kt index af13c459..5d44b580 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClientMenu.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClientMenu.kt @@ -36,11 +36,11 @@ class FrostWebViewClientMenu(webCore: FrostWebViewCore) : FrostWebViewClient(web super.onPageFinished(view, url) if (url == webCore.baseUrl && content == null) { jsInject(JsAssets.MENU, callback = { - jsInject(JsAssets.MENU_CLICK) //menu injection must be after or we will have a loop from the click listener +// jsInject(JsAssets.CLICK_A) //menu injection must be after or we will have a loop from the click listener }) - } else if (url == contentBaseUrl) { - L.i("Inject content") - jsInject(JsAssets.MENU_CLICK) +// } else if (url == contentBaseUrl) { +// L.i("Inject content") +// jsInject(JsAssets.CLICK_A) } } |