aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-06 02:52:18 -0400
committerGitHub <noreply@github.com>2017-07-06 02:52:18 -0400
commitbbe30297a216218ded4c2c6e3e8c2843652eb7a7 (patch)
treed120e124cb12d5474d37f1bc3e67fdaa5179c4c3 /app/src/main/kotlin
parent311c7eeb304048c31f986d2d06010d0a486555ad (diff)
downloadfrost-bbe30297a216218ded4c2c6e3e8c2843652eb7a7.tar.gz
frost-bbe30297a216218ded4c2c6e3e8c2843652eb7a7.tar.bz2
frost-bbe30297a216218ded4c2c6e3e8c2843652eb7a7.zip
Dev (#29) - micro fixes mostly from KAUv1.1.4
* Add changelog * Add play descriptions * Test build since tag * Adjust view on keyboard, fixes * Update kau, merge kpref singles, update swipe * Fix swipe background * Allow swipe customization
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt19
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt1
6 files changed, 19 insertions, 12 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
index 1bd4777d..000a862e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
@@ -10,8 +10,10 @@ import android.support.v7.widget.Toolbar
import android.webkit.ValueCallback
import android.webkit.WebChromeClient
import ca.allanwang.kau.permissions.kauOnRequestPermissionsResult
+import ca.allanwang.kau.swipe.kauSwipeOnCreate
+import ca.allanwang.kau.swipe.kauSwipeOnDestroy
+import ca.allanwang.kau.swipe.kauSwipeOnPostCreate
import ca.allanwang.kau.utils.*
-import com.jude.swipbackhelper.SwipeBackHelper
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.pitchedapps.frost.contracts.ActivityWebContract
import com.pitchedapps.frost.contracts.FileChooserContract
@@ -49,12 +51,10 @@ open class WebOverlayActivity : AppCompatActivity(),
supportActionBar?.setDisplayHomeAsUpEnabled(true)
toolbar.navigationIcon = GoogleMaterial.Icon.gmd_close.toDrawable(this, 16, Prefs.iconColor)
toolbar.setNavigationOnClickListener { finishSlideOut() }
- SwipeBackHelper.onCreate(this)
- SwipeBackHelper.getCurrentPage(this)
- .setSwipeBackEnable(true)
- .setSwipeSensitivity(0.5f)
- .setSwipeRelateEnable(true)
- .setSwipeRelateOffset(300)
+ kauSwipeOnCreate {
+ if (!Prefs.overlayFullScreenSwipe) edgeSize = 20.dpToPx
+ transitionSystemBars = false
+ }
setFrostColors(toolbar, themeWindow = false)
coordinator.setBackgroundColor(Prefs.bgColor.withAlpha(255))
@@ -63,7 +63,6 @@ open class WebOverlayActivity : AppCompatActivity(),
if (userId != Prefs.userId) FbCookie.switchUser(userId) { frostWeb.web.loadBaseUrl() }
else frostWeb.web.loadBaseUrl()
if (Showcase.firstWebOverlay) {
- Showcase.firstWebOverlay = false
coordinator.frostSnackbar(R.string.web_overlay_swipe_hint) {
duration = Snackbar.LENGTH_INDEFINITE
setAction(R.string.kau_got_it) { _ -> this.dismiss() }
@@ -101,12 +100,12 @@ open class WebOverlayActivity : AppCompatActivity(),
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
- SwipeBackHelper.onPostCreate(this)
+ kauSwipeOnPostCreate()
}
override fun onDestroy() {
super.onDestroy()
- SwipeBackHelper.onDestroy(this)
+ kauSwipeOnDestroy()
}
override fun onBackPressed() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
index 28554092..ae7fd061 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
@@ -22,4 +22,8 @@ fun SettingsActivity.getBehaviourPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.analytics_desc
}
+ checkbox(R.string.overlay_full_screen_swipe, { Prefs.overlayFullScreenSwipe }, { Prefs.overlayFullScreenSwipe = it }) {
+ descRes = R.string.overlay_full_screen_swipe_desc
+ }
+
}
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 07127dd5..7b5eca2a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -99,4 +99,6 @@ object Prefs : KPref() {
var searchBar: Boolean by kpref("search_bar", Showcase.experimentalDefault)
+ var overlayFullScreenSwipe: Boolean by kpref("overlay_full_screen_swipe", true)
+
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
index b1dbe6f1..57cbef7e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
@@ -2,6 +2,7 @@ package com.pitchedapps.frost.utils
import ca.allanwang.kau.kpref.KPref
import ca.allanwang.kau.kpref.kpref
+import ca.allanwang.kau.kpref.kprefSingle
/**
* Created by Allan Wang on 2017-07-03.
@@ -11,7 +12,7 @@ import ca.allanwang.kau.kpref.kpref
object Showcase : KPref() {
//check if this is the first time launching the web overlay; show snackbar if true
- var firstWebOverlay: Boolean by kpref("first_web_overlay", true)
+ val firstWebOverlay: Boolean by kprefSingle("first_web_overlay")
//not a showcase but cannot be in the same file as Prefs
var experimentalDefault: Boolean by kpref("experimental_by_default", 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 44a392b9..a3124dea 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -103,7 +103,7 @@ fun MaterialDialog.Builder.theme(): MaterialDialog.Builder {
fun Activity.setFrostTheme(forceTransparent: Boolean = false) {
val isTransparent = (Color.alpha(Prefs.bgColor) != 255) || forceTransparent
- if (Prefs.bgColor.isColorDark())
+ if (Prefs.bgColor.isColorDark)
setTheme(if (isTransparent) R.style.FrostTheme_Transparent else R.style.FrostTheme)
else
setTheme(if (isTransparent) R.style.FrostTheme_Light_Transparent else R.style.FrostTheme_Light)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
index a0ffa3b5..c2c89b8a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
@@ -62,6 +62,7 @@ class FrostWebViewCore @JvmOverloads constructor(
javaScriptEnabled = true
userAgentString = USER_AGENT_BASIC
allowFileAccess = true
+ defaultFontSize
}
setLayerType(View.LAYER_TYPE_HARDWARE, null)
frostWebClient = baseEnum?.webClient?.invoke(this) ?: FrostWebViewClient(this)