diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-29 22:13:26 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-29 22:13:26 -0700 |
commit | 213a6b8a9213240801a84cfcfb9925d4709cdbe4 (patch) | |
tree | a7980ee4eaad2a828b6508450afd2e6f98f39574 | |
parent | 86f789f8ec0d150098904b85dd6feb7a19725b1c (diff) | |
download | frost-213a6b8a9213240801a84cfcfb9925d4709cdbe4.tar.gz frost-213a6b8a9213240801a84cfcfb9925d4709cdbe4.tar.bz2 frost-213a6b8a9213240801a84cfcfb9925d4709cdbe4.zip |
Release alpha build
7 files changed, 49 insertions, 19 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/AboutActivity.kt index cb95a855..552339ba 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/AboutActivity.kt @@ -31,7 +31,8 @@ class AboutActivity : AboutActivityBase(R.string::class.java, configBuilder = { val exclude = arrayOf( "GoogleMaterialDesignIcons", "intellijannotations", -// "MaterialDesignIconicIcons", + "MaterialDesignIconicIcons", + "MaterialDesignIcons", "materialize", "appcompat_v7", "design", @@ -39,7 +40,7 @@ class AboutActivity : AboutActivityBase(R.string::class.java, configBuilder = { "support_v4" ) val l = libs.prepareLibraries(this, null, exclude, true, true) - l.forEach { KL.d("Lib ${it.definedName}") } +// l.forEach { KL.d("Lib ${it.definedName}") } return l } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt index 5fceec19..02191730 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt @@ -14,6 +14,7 @@ import android.support.v7.widget.Toolbar import android.view.Menu import android.view.MenuItem import ca.allanwang.kau.changelog.showChangelog +import ca.allanwang.kau.logging.KL import ca.allanwang.kau.searchview.SearchItem import ca.allanwang.kau.searchview.SearchView import ca.allanwang.kau.searchview.bindSearchView @@ -83,6 +84,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { const val REQUEST_RESTART = 90909 const val REQUEST_REFRESH = 80808 const val REQUEST_NAV = 10101 + const val REQUEST_SEARCH = 70707 } override fun onCreate(savedInstanceState: Bundle?) { @@ -303,8 +305,10 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { * Something happened where the normal search function won't work * Fallback to overlay style */ - override fun searchOverlayError() { + override fun searchOverlayDispose() { + hiddenSearchView?.dispose() hiddenSearchView = null + searchView = null //todo remove true searchview and add contract } @@ -320,21 +324,29 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { menuInflater.inflate(R.menu.menu_main, menu) toolbar.tint(Prefs.iconColor) setMenuIcons(menu, Prefs.iconColor, - R.id.action_settings to GoogleMaterial.Icon.gmd_settings) - searchView = bindSearchView(menu, R.id.action_search) { - textObserver = { - observable, _ -> - observable.observeOn(AndroidSchedulers.mainThread()).subscribe { - L.d("Input $it") - hiddenSearchView?.query(it) + R.id.action_settings to GoogleMaterial.Icon.gmd_settings, + R.id.action_search to GoogleMaterial.Icon.gmd_search) + if (Prefs.searchBar) { + if (firstLoadFinished && hiddenSearchView == null) hiddenSearchView = FrostWebViewSearch(this, this) + if (searchView == null) searchView = bindSearchView(menu, R.id.action_search, Prefs.iconColor) { + textObserver = { + observable, _ -> + observable.observeOn(AndroidSchedulers.mainThread()).subscribe { + L.d("Input $it") + hiddenSearchView?.query(it) + } } + foregroundColor = Prefs.textColor + backgroundColor = Prefs.bgColor + openListener = { hiddenSearchView?.pauseLoad = false } + closeListener = { hiddenSearchView?.pauseLoad = true } + onItemClick = { _, key, _, _ -> launchWebOverlay(key) } } - foregroundColor = Prefs.textColor - backgroundColor = Prefs.bgColor - openListener = { hiddenSearchView?.pauseLoad = false } - closeListener = { hiddenSearchView?.pauseLoad = true } - onItemClick = { _, key, _, _ -> launchWebOverlay(key) } + } else { + searchOverlayDispose() + menu.findItem(R.id.action_search).setOnMenuItemClickListener { _ -> launchWebOverlay(FbTab.SEARCH.url); true } } + KL.e("SearchView ${searchView == null} HID ${hiddenSearchView == null}") return true } @@ -357,6 +369,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { REQUEST_RESTART -> restart() REQUEST_REFRESH -> webFragmentObservable.onNext(FRAGMENT_REFRESH) REQUEST_NAV -> frostNavigationBar() + REQUEST_SEARCH -> invalidateOptionsMenu() } } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt index 2184a111..679eef36 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt @@ -1,6 +1,7 @@ package com.pitchedapps.frost.settings import ca.allanwang.kau.kpref.KPrefAdapterBuilder +import com.pitchedapps.frost.MainActivity import com.pitchedapps.frost.R import com.pitchedapps.frost.SettingsActivity import com.pitchedapps.frost.utils.Prefs @@ -9,7 +10,12 @@ import com.pitchedapps.frost.utils.Prefs * Created by Allan Wang on 2017-06-29. */ fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = { - checkbox(R.string.search, { Prefs.searchBar }, { Prefs.searchBar = it }) { + + plainText(R.string.experimental_disclaimer) { + descRes = R.string.experimental_disclaimer_info + } + + checkbox(R.string.search, { Prefs.searchBar }, { Prefs.searchBar = it; setResult(MainActivity.REQUEST_SEARCH) }) { descRes = R.string.search_desc } }
\ 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 71bb51ef..f83fd63b 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt @@ -132,14 +132,21 @@ class FrostWebViewSearch(context: Context, val contract: SearchContract) : WebVi 1 -> { //something is not found in the search view; this is effectively useless L.d("Search subject error; reverting to full overlay") searchSubject.onComplete() - contract.searchOverlayError() + contract.searchOverlayDispose() } } } } + /** + * Clear up some components + */ + fun dispose() { + searchSubject.onComplete() + } + interface SearchContract { - fun searchOverlayError() + fun searchOverlayDispose() fun emitSearchResponse(items: List<SearchItem>) } } diff --git a/app/src/main/res/values/strings_preferences b/app/src/main/res/values/strings_preferences index e2376493..b282c7ea 100644 --- a/app/src/main/res/values/strings_preferences +++ b/app/src/main/res/values/strings_preferences @@ -40,6 +40,8 @@ <string name="experimental">Experimental</string> <string name="experimental_desc">Enable early access to potentially unstable features</string> + <string name="experimental_disclaimer">Disclaimer</string> + <string name="experimental_disclaimer_info">Experimental features may be unstable and may never make it to production. Use at your own risk, send feedback, and feel free to disable them if they don\'t work well.</string> <string name="search">Search Type</string> <string name="search_desc">Enable the search bar instead of a search overlay</string> diff --git a/app/src/main/res/xml/changelog.xml b/app/src/main/res/xml/changelog.xml index a7c895bd..f85aaf53 100644 --- a/app/src/main/res/xml/changelog.xml +++ b/app/src/main/res/xml/changelog.xml @@ -16,7 +16,7 @@ <item text="Added experimental section" /> <item text="Added search option" /> <item text="Fixed up main layout" /> - <item text="" /> + <item text="Fix some theme components" /> <item text="" /> <version title="v0.3" /> diff --git a/docs/Changelog.md b/docs/Changelog.md index 9b3e7b67..f73f7e14 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -9,6 +9,7 @@ * Added experimental section * Added search option * Fixed up main layout +* Fix some theme components ## v0.3 * Added rounded icons option |