aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt26
1 files changed, 11 insertions, 15 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index 5cc5cfe8..5fceec19 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -75,6 +75,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
companion object {
const val FRAGMENT_REFRESH = 99
+ const val ACTIVITY_SETTINGS = 97
/*
* Possible responses from the SettingsActivity
* after the configurations have changed
@@ -330,16 +331,9 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
}
foregroundColor = Prefs.textColor
backgroundColor = Prefs.bgColor
- openListener = {
- hiddenSearchView?.pauseLoad = false
- }
- closeListener = {
- hiddenSearchView?.pauseLoad = true
- }
- onItemClick = {
- position, key, content, searchView ->
- launchWebOverlay(key)
- }
+ openListener = { hiddenSearchView?.pauseLoad = false }
+ closeListener = { hiddenSearchView?.pauseLoad = true }
+ onItemClick = { _, key, _, _ -> launchWebOverlay(key) }
}
return true
}
@@ -349,7 +343,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
R.id.action_settings -> {
val intent = Intent(this, SettingsActivity::class.java)
val bundle = ActivityOptionsCompat.makeCustomAnimation(this, R.anim.kau_slide_in_right, R.anim.kau_fade_out).toBundle()
- startActivityForResult(intent, 99, bundle)
+ startActivityForResult(intent, ACTIVITY_SETTINGS, bundle)
}
else -> return super.onOptionsItemSelected(item)
}
@@ -358,10 +352,12 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
- when (requestCode) {
- REQUEST_RESTART -> restart()
- REQUEST_REFRESH -> webFragmentObservable.onNext(FRAGMENT_REFRESH)
- REQUEST_NAV -> frostNavigationBar()
+ if (requestCode == ACTIVITY_SETTINGS) {
+ when (resultCode) {
+ REQUEST_RESTART -> restart()
+ REQUEST_REFRESH -> webFragmentObservable.onNext(FRAGMENT_REFRESH)
+ REQUEST_NAV -> frostNavigationBar()
+ }
}
}