diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-26 14:54:07 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-26 14:54:07 -0700 |
commit | 6270c060e4d33db12903e476146456569d260261 (patch) | |
tree | 828eb1d6da7ea1dae7b4e08c40cbb7fc08c88846 | |
parent | a95107d0d10583bfd95495bdc84cc23022b56000 (diff) | |
download | frost-6270c060e4d33db12903e476146456569d260261.tar.gz frost-6270c060e4d33db12903e476146456569d260261.tar.bz2 frost-6270c060e4d33db12903e476146456569d260261.zip |
Test dependencies
-rw-r--r-- | .idea/misc.xml | 2 | ||||
-rw-r--r-- | app/build.gradle | 2 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt | 31 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/FbSearch.kt | 9 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt | 10 | ||||
-rw-r--r-- | app/src/main/res/menu/menu_main.xml | 7 | ||||
-rw-r--r-- | gradle.properties | 8 |
7 files changed, 41 insertions, 28 deletions
diff --git a/.idea/misc.xml b/.idea/misc.xml index 7319f021..085136f8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -53,7 +53,7 @@ <ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Remove" /> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/build/classes" /> </component> <component name="ProjectType"> diff --git a/app/build.gradle b/app/build.gradle index 099174be..9b19f26c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -100,7 +100,7 @@ dependencies { annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${DBFLOW}" kapt "com.github.Raizlabs.DBFlow:dbflow-processor:${DBFLOW}" compile "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${DBFLOW}" - + //Icons compile "com.mikepenz:material-design-iconic-typeface:${IICON_MATERIAL}@aar" compile "com.mikepenz:community-material-typeface:${IICON_COMMUNITY}@aar" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt index cccb3e0c..2103a8ee 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt @@ -4,10 +4,7 @@ import android.content.Intent import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.support.annotation.StringRes -import android.support.design.widget.AppBarLayout -import android.support.design.widget.FloatingActionButton -import android.support.design.widget.Snackbar -import android.support.design.widget.TabLayout +import android.support.design.widget.* import android.support.v4.app.ActivityOptionsCompat import android.support.v4.app.Fragment import android.support.v4.app.FragmentManager @@ -17,6 +14,9 @@ import android.support.v7.widget.Toolbar import android.view.Menu import android.view.MenuItem import ca.allanwang.kau.changelog.showChangelog +import ca.allanwang.kau.searchview.SearchItem +import ca.allanwang.kau.searchview.SearchView +import ca.allanwang.kau.searchview.bindSearchView import ca.allanwang.kau.utils.* import co.zsmb.materialdrawerkt.builders.Builder import co.zsmb.materialdrawerkt.builders.accountHeader @@ -56,6 +56,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { val fab: FloatingActionButton by bindView(R.id.fab) val tabs: TabLayout by bindView(R.id.tabs) val appBar: AppBarLayout by bindView(R.id.appbar) + val coordinator: CoordinatorLayout by bindView(R.id.main_content) lateinit var drawer: Drawer lateinit var drawerHeader: AccountHeader var webFragmentObservable = PublishSubject.create<Int>()!! @@ -71,6 +72,7 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { currentFragment.frostWebView.addView(hiddenSearchView) } } + var searchView: SearchView? = null companion object { const val FRAGMENT_REFRESH = 99 @@ -306,9 +308,8 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract { //todo remove true searchview and add contract } - //todo add args - override fun emitSearchResponse() { - + override fun emitSearchResponse(items: List<SearchItem>) { + searchView?.results = items } fun refreshAll() { @@ -320,6 +321,22 @@ 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) { + textObserver = { + observable, _ -> + observable.subscribe { + hiddenSearchView?.query(it) + } + } + foregroundColor = Prefs.textColor + backgroundColor = Prefs.bgColor + openListener = { + hiddenSearchView?.pauseLoad = false + } + closeListener = { + hiddenSearchView?.pauseLoad = true + } + } return true } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbSearch.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbSearch.kt deleted file mode 100644 index 151957d3..00000000 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbSearch.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.pitchedapps.frost.facebook - -/** - * Created by Allan Wang on 2017-06-26. - * - * Handles asynchronous user graph searches - */ -class FbSearch { -}
\ 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 6c9ee9d5..d42ea33e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewSearch.kt @@ -6,6 +6,7 @@ import android.view.View import android.webkit.JavascriptInterface import android.webkit.WebView import android.webkit.WebViewClient +import ca.allanwang.kau.searchview.SearchItem import ca.allanwang.kau.utils.gone import com.pitchedapps.frost.facebook.FbTab import com.pitchedapps.frost.facebook.USER_AGENT_BASIC @@ -68,11 +69,11 @@ class FrostWebViewSearch(context: Context, val contract: SearchContract) : WebVi .subscribe { content: List<Pair<List<String>, String>> -> saveResultFrame(content) - content.forEach { + contract.emitSearchResponse(content.map { (texts, href) -> L.d("Search element $texts $href") - } - contract.emitSearchResponse() + SearchItem(href, texts[0], texts.getOrNull(1)) + }) } reload() } @@ -138,8 +139,7 @@ class FrostWebViewSearch(context: Context, val contract: SearchContract) : WebVi interface SearchContract { fun searchOverlayError() - //todo add args - fun emitSearchResponse() + fun emitSearchResponse(items: List<SearchItem>) } } diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index e82d1f44..d4cdddb9 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -4,9 +4,14 @@ tools:context="com.pitchedapps.myapplication.MainActivity"> <item + android:id="@+id/action_search" + android:orderInCategory="200" + android:title="@string/kau_search" + app:showAsAction="always" /> + <item android:id="@+id/action_settings" android:orderInCategory="200" android:title="@string/kau_settings" - app:showAsAction="always" /> + app:showAsAction="ifRoom" /> </menu> diff --git a/gradle.properties b/gradle.properties index 8f76b8d1..ed651a11 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,15 +19,15 @@ BUILD_TOOLS=26.0.0 VERSION_CODE=5 VERSION_NAME=0.5 -KAU=c9302a7b0f -MATERIAL_DRAWER=5.9.2 -MATERIAL_DRAWER_KT=1.0.2 +KAU=c09b59f09a +MATERIAL_DRAWER=5.9.3 +MATERIAL_DRAWER_KT=1.0.4 IICON_MATERIAL=2.2.0.2 IICON_COMMUNITY=1.9.32.1 JSOUP=1.10.2 GLIDE=4.0.0-RC0 RETROFIT=2.2.0 -DBFLOW=4.0.2 +DBFLOW=4.0.4 ROBOELECTRIC=3.3.2 PAPER_PARCEL=2.0.1 SWIPE_BACK=3.1.2 |