File tree 12 files changed +66
-62
lines changed
androidTest/java/searchview/danbroid/searchviewdemo2
java/danbroid/searchviewdemo
test/java/searchview/danbroid/searchviewdemo2
12 files changed +66
-62
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,16 @@ apply plugin: 'kotlin-android-extensions'
6
6
7
7
android {
8
8
compileSdkVersion 28
9
+
9
10
defaultConfig {
10
- applicationId " searchview. danbroid.searchviewdemo2 "
11
+ applicationId " danbroid.searchviewdemo "
11
12
minSdkVersion 15
12
13
targetSdkVersion 28
13
- versionCode 1
14
- versionName " 1.0 "
14
+ versionCode 4
15
+ versionName " 1.04 "
15
16
testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
16
17
}
18
+
17
19
buildTypes {
18
20
release {
19
21
minifyEnabled false
@@ -34,7 +36,6 @@ project.afterEvaluate {
34
36
}
35
37
36
38
37
-
38
39
dependencies {
39
40
implementation " org.slf4j:slf4j-api:1.7.25"
40
41
@@ -45,10 +46,9 @@ dependencies {
45
46
// implementation "org.slf4j:slf4j-android:1.7.25"
46
47
47
48
implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version "
48
- implementation ' androidx.appcompat:appcompat:1.0.0-rc01'
49
- implementation ' androidx.constraintlayout:constraintlayout:1.1.2'
50
- implementation ' com.google.android.material:material:1.0.0-rc01'
51
- testImplementation ' junit:junit:4.12'
52
- androidTestImplementation ' androidx.test:runner:1.1.0-rc01'
53
- androidTestImplementation ' androidx.test.espresso:espresso-core:3.1.0-alpha4'
49
+ implementation ' androidx.appcompat:appcompat:1.0.2'
50
+ implementation ' androidx.constraintlayout:constraintlayout:1.1.3'
51
+ implementation ' com.google.android.material:material:1.0.0'
52
+ implementation ' com.github.arimorty:floatingsearchview:2.1.1'
53
+
54
54
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 70
70
71
71
</activity >
72
72
73
+ <activity
74
+ android : name =" .demo5.Demo5Activity"
75
+ android : label =" @string/title_demo5"
76
+ android : launchMode =" singleTop"
77
+ android : theme =" @style/AppTheme.NoActionBar" >
78
+ </activity >
79
+
73
80
74
81
<provider
75
82
android : name =" danbroid.searchviewdemo.CheeseSuggestionsProvider"
Original file line number Diff line number Diff line change @@ -110,8 +110,9 @@ abstract class BaseActivity : AppCompatActivity() {
110
110
protected fun closeSearchView () {
111
111
menu?.findItem(R .id.action_search)?.let {
112
112
if (it.isActionViewExpanded) {
113
- it.collapseActionView()
114
- it.actionView.clearFocus()
113
+ /* it.actionView.clearFocus()
114
+ it.collapseActionView()*/
115
+ invalidateOptionsMenu()
115
116
}
116
117
}
117
118
}
Original file line number Diff line number Diff line change 1
1
package danbroid.searchviewdemo
2
2
3
- import android.app.SearchManager
4
3
import android.content.Context
5
- import android.database.Cursor
6
- import android.database.MatrixCursor
7
- import android.provider.BaseColumns
8
4
import android.text.TextUtils
9
5
import java.io.BufferedReader
10
6
import java.io.InputStreamReader
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import danbroid.searchviewdemo.demo1.Demo1Activity
7
7
import danbroid.searchviewdemo.demo2.Demo2Activity
8
8
import danbroid.searchviewdemo.demo3.Demo3Activity
9
9
import danbroid.searchviewdemo.demo4.Demo4Activity
10
+ import danbroid.searchviewdemo.demo5.Demo5Activity
10
11
11
12
12
13
class MainActivity : BaseActivity () {
@@ -26,9 +27,13 @@ class MainActivity : BaseActivity() {
26
27
startActivity(Intent (this , Demo1Activity ::class .java))
27
28
}
28
29
29
- addButton(" Demo4 " ) {
30
+ addButton(" Search Dialog " ) {
30
31
startActivity(Intent (this , Demo4Activity ::class .java))
31
32
}
33
+
34
+ addButton(" Floating Search" ) {
35
+ startActivity(Intent (this , Demo5Activity ::class .java))
36
+ }
32
37
}
33
38
34
39
override fun configureSearchMenu (menuItem : MenuItem ) {
Original file line number Diff line number Diff line change
1
+ package danbroid.searchviewdemo.demo5
2
+
3
+ import android.view.MenuItem
4
+ import android.view.View
5
+ import danbroid.searchviewdemo.BaseActivity
6
+ import danbroid.searchviewdemo.R
7
+ import kotlinx.android.synthetic.main.activity.*
8
+
9
+
10
+ private val log by lazy {
11
+ org.slf4j.LoggerFactory .getLogger(Demo5Activity ::class .java)
12
+ }
13
+
14
+ class Demo5Activity : BaseActivity () {
15
+
16
+ override fun configureSearchMenu (menuItem : MenuItem ) {
17
+ }
18
+
19
+ override fun onOptionsItemSelected (item : MenuItem ) = when (item.itemId) {
20
+ R .id.action_search -> {
21
+ floating_search_view.visibility = View .VISIBLE
22
+ toolbar.visibility = View .GONE
23
+ true
24
+ }
25
+ else -> super .onOptionsItemSelected(item)
26
+ }
27
+
28
+
29
+ }
Original file line number Diff line number Diff line change 20
20
21
21
</com .google.android.material.appbar.AppBarLayout>
22
22
23
+ <com .arlib.floatingsearchview.FloatingSearchView
24
+ android : id =" @+id/floating_search_view"
25
+ android : layout_width =" match_parent"
26
+ android : layout_height =" wrap_content"
27
+ app : floatingSearch_leftActionMode =" showHamburger"
28
+ android : fitsSystemWindows =" true"
29
+ android : visibility =" gone" />
23
30
24
31
<LinearLayout
25
32
android : id =" @+id/content_container"
Original file line number Diff line number Diff line change 7
7
<string name =" title_demo2" >Demo 2</string >
8
8
<string name =" title_demo3" >Demo 3</string >
9
9
<string name =" title_demo4" >Demo4</string >
10
+ <string name =" title_demo5" >Demo5</string >
10
11
</resources >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
2
3
3
buildscript {
4
- ext. kotlin_version = ' 1.2.60 '
4
+ ext. kotlin_version = ' 1.3.11 '
5
5
repositories {
6
6
google()
7
7
jcenter()
8
8
}
9
9
dependencies {
10
- classpath ' com.android.tools.build:gradle:3.3.0-alpha05 '
10
+ classpath ' com.android.tools.build:gradle:3.3.0'
11
11
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
12
12
13
13
// NOTE: Do not place your application dependencies here; they belong
@@ -20,7 +20,6 @@ allprojects {
20
20
google()
21
21
jcenter()
22
22
maven { url ' https://jitpack.io' }
23
-
24
23
}
25
24
}
26
25
Original file line number Diff line number Diff line change 1
1
distributionBase =GRADLE_USER_HOME
2
2
distributionPath =wrapper/dists
3
- distributionUrl =https\://services.gradle.org/distributions/gradle-4.9 -all.zip
3
+ distributionUrl =https\://services.gradle.org/distributions/gradle-5.1.1 -all.zip
4
4
zipStoreBase =GRADLE_USER_HOME
5
5
zipStorePath =wrapper/dists
You can’t perform that action at this time.
0 commit comments