aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt1
-rw-r--r--app/src/main/res/layout/activity_main.xml4
5 files changed, 13 insertions, 9 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index 2103a8ee..5cc5cfe8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -69,7 +69,6 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
field = value
if (value && hiddenSearchView == null) {
hiddenSearchView = FrostWebViewSearch(this, this)
- currentFragment.frostWebView.addView(hiddenSearchView)
}
}
var searchView: SearchView? = null
@@ -321,10 +320,11 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
toolbar.tint(Prefs.iconColor)
setMenuIcons(menu, Prefs.iconColor,
R.id.action_settings to GoogleMaterial.Icon.gmd_settings)
- searchView = coordinator.bindSearchView(menu, R.id.action_search) {
+ searchView = bindSearchView(menu, R.id.action_search) {
textObserver = {
observable, _ ->
- observable.subscribe {
+ observable.observeOn(AndroidSchedulers.mainThread()).subscribe {
+ L.d("Input $it")
hiddenSearchView?.query(it)
}
}
@@ -336,6 +336,10 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
closeListener = {
hiddenSearchView?.pauseLoad = true
}
+ onItemClick = {
+ position, key, content, searchView ->
+ launchWebOverlay(key)
+ }
}
return true
}
@@ -367,6 +371,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
}
override fun onBackPressed() {
+ if (searchView?.onBackPressed() ?: false) return
if (currentFragment.onBackPressed()) return
super.onBackPressed()
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
index 178a072f..7cd6d9c2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -25,7 +25,7 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract {
.replace("\$T\$", Prefs.textColor.toRgbaString())
.replace("\$TT\$", Prefs.textColor.colorToBackground(0.05f).toRgbaString())
.replace("\$B\$", Prefs.bgColor.toRgbaString())
- .replace("\$BBT\$", Prefs.bgColor.adjustAlpha(0.2f).colorToForeground(0.05f).toRgbaString())
+ .replace("\$BBT\$", Prefs.bgColor.adjustAlpha(0.2f).colorToForeground(0.5f).toRgbaString())
.replace("\$O\$", Prefs.bgColor.withAlpha(255).toRgbaString())
.replace("\$D\$", Prefs.textColor.adjustAlpha(0.3f).toRgbaString())
}
@@ -38,4 +38,4 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract {
injector = null
}
-} \ No newline at end of file
+}
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 9b41d454..29593929 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -1,11 +1,11 @@
package com.pitchedapps.frost.utils
import android.graphics.Color
+import ca.allanwang.kau.kotlin.lazyResettable
import ca.allanwang.kau.kpref.KPref
import ca.allanwang.kau.kpref.StringSet
import ca.allanwang.kau.kpref.kpref
import ca.allanwang.kau.utils.isColorVisibleOn
-import ca.allanwang.kau.utils.lazyResettable
import com.pitchedapps.frost.facebook.FeedSort
import com.pitchedapps.frost.injectors.InjectorContract
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 d42ea33e..71bb51ef 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt
@@ -96,6 +96,7 @@ class FrostWebViewSearch(context: Context, val contract: SearchContract) : WebVi
* Sets the input to have our given text, then dispatches the input event so the webpage recognizes it
*/
fun query(input: String) {
+ L.d("Searching attempt for $input")
JsBuilder().js("var e=document.getElementById('main-search-input');if(e){e.value='$input';var n=new Event('input',{bubbles:!0,cancelable:!0});e.dispatchEvent(n)}else console.log('Input field not found')").build().inject(this) {
L.d("Searching for $input")
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index f6c29f8b..bbb7dc70 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -12,16 +12,14 @@
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:fitsSystemWindows="true"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
- android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">