aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-04 00:32:45 -0700
committerAllan Wang <me@allanwang.ca>2017-07-04 00:32:45 -0700
commit43885c6c063a76738ed7220aba619e47db7c4080 (patch)
tree6269af12c2656f81c54daad59b6b6aee5d4a1066 /app/src/main/kotlin/com
parentab98d536da8cd5e98132e125b81dde7bfcfa8056 (diff)
parent7a13673828f088c179763e8621a94e334319f226 (diff)
downloadfrost-43885c6c063a76738ed7220aba619e47db7c4080.tar.gz
frost-43885c6c063a76738ed7220aba619e47db7c4080.tar.bz2
frost-43885c6c063a76738ed7220aba619e47db7c4080.zip
fix update
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt2
6 files changed, 27 insertions, 14 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index cba6b878..aa84edf7 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -6,12 +6,14 @@ import android.net.Uri
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
+import com.bumptech.glide.signature.ApplicationVersionSignature
import com.crashlytics.android.Crashlytics
import com.crashlytics.android.answers.Answers
import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader
import com.mikepenz.materialdrawer.util.DrawerImageLoader
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.CrashReportingTree
+import com.pitchedapps.frost.utils.GlideApp
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.Showcase
import com.raizlabs.android.dbflow.config.FlowConfig
@@ -57,10 +59,16 @@ class FrostApp : Application() {
super.onCreate()
- //Drawer profile loading logic
+ /**
+ * Drawer profile loading logic
+ * Reload the image on every version update
+ */
DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String) {
- Glide.with(imageView.context).load(uri).apply(RequestOptions().placeholder(placeholder)).into(imageView)
+ val c = imageView.context
+ val old = GlideApp.with(c).load(uri).apply(RequestOptions().placeholder(placeholder))
+ GlideApp.with(c).load(uri).apply(RequestOptions().signature(ApplicationVersionSignature.obtain(c)))
+ .thumbnail(old).into(imageView)
}
})
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index b8d47027..d52c12ac 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -77,6 +77,8 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
}
}
var searchView: SearchView? = null
+ override val isSearchOpened: Boolean
+ get() = searchView?.isOpen ?: false
companion object {
const val FRAGMENT_REFRESH = 99
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index 7eb6bae9..cf565b09 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -97,12 +97,6 @@ object Prefs : KPref() {
var analytics: Boolean by kpref("analytics", true)
- var experimentalDefault:Boolean by kpref("experimental_by_default", false)
-
- /*
- * Experimental features must be listed below so the default is initialized
- */
-
- var searchBar: Boolean by kpref("search_bar", experimentalDefault)
+ var searchBar: Boolean by kpref("search_bar", false)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index b255c59c..44a392b9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -17,6 +17,9 @@ import android.widget.FrameLayout
import android.widget.TextView
import ca.allanwang.kau.utils.*
import com.afollestad.materialdialogs.MaterialDialog
+import com.bumptech.glide.GlideBuilder
+import com.bumptech.glide.annotation.GlideModule
+import com.bumptech.glide.module.AppGlideModule
import com.crashlytics.android.answers.Answers
import com.crashlytics.android.answers.CustomEvent
import com.pitchedapps.frost.*
@@ -31,6 +34,9 @@ import com.pitchedapps.frost.services.NotificationService
internal const val EXTRA_COOKIES = "extra_cookies"
internal const val ARG_URL = "arg_url"
+@GlideModule
+class FrostGlideModule : AppGlideModule()
+
fun Context.launchNewTask(clazz: Class<out Activity>, cookieList: ArrayList<CookieModel> = arrayListOf(), clearStack: Boolean = false) {
startActivity(clazz, clearStack, intentBuilder = {
putParcelableArrayListExtra(EXTRA_COOKIES, cookieList)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
index 10499bfa..00e72cc7 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
@@ -1,10 +1,7 @@
package com.pitchedapps.frost.web
import android.net.Uri
-import android.webkit.ConsoleMessage
-import android.webkit.ValueCallback
-import android.webkit.WebChromeClient
-import android.webkit.WebView
+import android.webkit.*
import com.pitchedapps.frost.utils.L
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
@@ -36,7 +33,7 @@ class FrostChromeClient(webCore: FrostWebViewCore) : WebChromeClient() {
override fun onShowFileChooser(webView: WebView, filePathCallback: ValueCallback<Array<Uri>>?, fileChooserParams: FileChooserParams?): Boolean {
L.d("On show file chooser")
fileChooserParams?.apply {
- L.d(filenameHint)
+ L.d(filenameHint ?: "hi")
L.d("$mode")
L.d(acceptTypes.contentToString())
}
@@ -44,6 +41,10 @@ class FrostChromeClient(webCore: FrostWebViewCore) : WebChromeClient() {
return super.onShowFileChooser(webView, filePathCallback, fileChooserParams)
}
+ override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) {
+ super.onGeolocationPermissionsShowPrompt(origin, callback)
+ L.d("Geo prompt")
+ }
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt
index 837df260..83dccb9a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt
@@ -127,6 +127,7 @@ class FrostWebViewSearch(context: Context, val contract: SearchContract) : WebVi
when (flag) {
0 -> {
L.d("Search loaded successfully")
+ if (!contract.isSearchOpened) pauseLoad = true
}
1 -> { //something is not found in the search view; this is effectively useless
L.eThrow("Search subject error; reverting to full overlay")
@@ -147,6 +148,7 @@ class FrostWebViewSearch(context: Context, val contract: SearchContract) : WebVi
interface SearchContract {
fun searchOverlayDispose()
fun emitSearchResponse(items: List<SearchItem>)
+ val isSearchOpened: Boolean
}
}