aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-25 00:00:09 -0700
committerAllan Wang <me@allanwang.ca>2017-07-25 00:00:09 -0700
commitb06dac5ce219d5b9c5df0a08d31af5b7ccf359e1 (patch)
tree3d3cd1765ccc5499429a07d430682ba09ae600da
parent16e621f3db97b2e1a49832f4fecb784cf446f32c (diff)
downloadfrost-b06dac5ce219d5b9c5df0a08d31af5b7ccf359e1.tar.gz
frost-b06dac5ce219d5b9c5df0a08d31af5b7ccf359e1.tar.bz2
frost-b06dac5ce219d5b9c5df0a08d31af5b7ccf359e1.zip
Add intent checker
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt12
-rw-r--r--docs/Changelog.md2
2 files changed, 14 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index 658b6591..7d5282d8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -1,6 +1,8 @@
package com.pitchedapps.frost.web
+import android.content.ActivityNotFoundException
import android.content.Context
+import android.content.Intent
import android.graphics.Bitmap
import android.webkit.WebResourceRequest
import android.webkit.WebResourceResponse
@@ -9,6 +11,7 @@ import android.webkit.WebViewClient
import com.pitchedapps.frost.activities.LoginActivity
import com.pitchedapps.frost.activities.MainActivity
import com.pitchedapps.frost.activities.SelectorActivity
+import com.pitchedapps.frost.activities.WebOverlayActivity
import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FbCookie
@@ -105,9 +108,11 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
/**
* Helper to format the request and launch it
* returns true to override the url
+ * returns false if we are already in an overlaying activity
*/
private fun launchRequest(request: WebResourceRequest): Boolean {
L.d("Launching Url", request.url.toString())
+ if (webCore.context is WebOverlayActivity) return false
webCore.context.launchWebOverlay(request.url.toString())
return true
}
@@ -126,6 +131,13 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
if (path.startsWith("/composer/")) return launchRequest(request)
if (request.url.toString().contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png")))
return launchImage(request)
+ if (!request.url.toString().contains(FACEBOOK_COM)) {
+ val intent = Intent(Intent.ACTION_VIEW, request.url)
+ if (intent.resolveActivity(view.context.packageManager) != null) {
+ view.context.startActivity(Intent(Intent.ACTION_VIEW, request.url))
+ return true
+ }
+ }
return super.shouldOverrideUrlLoading(view, request)
}
diff --git a/docs/Changelog.md b/docs/Changelog.md
index b762f996..35f9ebad 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -2,6 +2,8 @@
## Beta Updates
* Allow for multiple result flags in settings to better reload the main view
+* :adapter: Make KauAnimator extensible
+* :imagepicker: Create single image picker counterpart with overlay
## v1.4
* Update IAB helper