From 89673894356e29ac48ebaba5bd75d03690da1d66 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 20 Jun 2017 19:53:21 -0700 Subject: Fix up url overlays and theme more components --- .../kotlin/com/pitchedapps/frost/WebOverlayActivity.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt') 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,11 +51,25 @@ 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 */ -- cgit v1.2.3