From d11191f259c16a062232276af932a07c27247773 Mon Sep 17 00:00:00 2001 From: Pramono Date: Wed, 14 Nov 2018 23:18:02 +0700 Subject: [PATCH] Add several functionalities, remove test files --- .../ExampleInstrumentedTest.kt | 24 ----------------- .../com/simplesearchview/ExampleUnitTest.kt | 17 ------------ build.gradle | 1 + searchviewmodule/build.gradle | 2 -- .../ExampleInstrumentedTest.java | 26 ------------------- .../com/searchviewmodule/SimpleSearchView.kt | 14 ++++++++-- .../com/searchviewmodule/ExampleUnitTest.java | 17 ------------ 7 files changed, 13 insertions(+), 88 deletions(-) delete mode 100644 app/src/androidTest/java/pramonow/com/simplesearchview/ExampleInstrumentedTest.kt delete mode 100644 app/src/test/java/pramonow/com/simplesearchview/ExampleUnitTest.kt delete mode 100644 searchviewmodule/src/androidTest/java/pramonow/com/searchviewmodule/ExampleInstrumentedTest.java delete mode 100644 searchviewmodule/src/test/java/pramonow/com/searchviewmodule/ExampleUnitTest.java diff --git a/app/src/androidTest/java/pramonow/com/simplesearchview/ExampleInstrumentedTest.kt b/app/src/androidTest/java/pramonow/com/simplesearchview/ExampleInstrumentedTest.kt deleted file mode 100644 index 677623b..0000000 --- a/app/src/androidTest/java/pramonow/com/simplesearchview/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package pramonow.com.simplesearchview - -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getTargetContext() - assertEquals("pramonow.com.simplesearchview", appContext.packageName) - } -} diff --git a/app/src/test/java/pramonow/com/simplesearchview/ExampleUnitTest.kt b/app/src/test/java/pramonow/com/simplesearchview/ExampleUnitTest.kt deleted file mode 100644 index b5307ba..0000000 --- a/app/src/test/java/pramonow/com/simplesearchview/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package pramonow.com.simplesearchview - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} diff --git a/build.gradle b/build.gradle index 34ba386..3c4ba9f 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,7 @@ allprojects { repositories { google() jcenter() + maven { url 'https://jitpack.io' } } } diff --git a/searchviewmodule/build.gradle b/searchviewmodule/build.gradle index 39c26c0..408459e 100644 --- a/searchviewmodule/build.gradle +++ b/searchviewmodule/build.gradle @@ -1,8 +1,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -ext.kotlin_version = '1.2.41' - android { compileSdkVersion 28 diff --git a/searchviewmodule/src/androidTest/java/pramonow/com/searchviewmodule/ExampleInstrumentedTest.java b/searchviewmodule/src/androidTest/java/pramonow/com/searchviewmodule/ExampleInstrumentedTest.java deleted file mode 100644 index cea9f82..0000000 --- a/searchviewmodule/src/androidTest/java/pramonow/com/searchviewmodule/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package pramonow.com.searchviewmodule; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("pramonow.com.searchviewmodule.test", appContext.getPackageName()); - } -} diff --git a/searchviewmodule/src/main/java/pramonow/com/searchviewmodule/SimpleSearchView.kt b/searchviewmodule/src/main/java/pramonow/com/searchviewmodule/SimpleSearchView.kt index 9ef3cb5..de804dc 100644 --- a/searchviewmodule/src/main/java/pramonow/com/searchviewmodule/SimpleSearchView.kt +++ b/searchviewmodule/src/main/java/pramonow/com/searchviewmodule/SimpleSearchView.kt @@ -17,10 +17,10 @@ class SimpleSearchView: RelativeLayout { lateinit var clearButton: ImageButton constructor(context: Context, attr: AttributeSet) : super(context,attr) { - init(context,attr) + init(context) } - private fun init(context: Context, attr: AttributeSet) + private fun init(context: Context) { View.inflate(context, R.layout.layout_search_view,this) @@ -65,4 +65,14 @@ class SimpleSearchView: RelativeLayout { backButton.setOnClickListener{v -> buttonCallback.onBack()} } + + public fun setTextHint(text:String) + { + queryText.setHint(text) + } + + public fun setFocused(focus:Boolean) + { + queryText.isFocusable = focus + } } \ No newline at end of file diff --git a/searchviewmodule/src/test/java/pramonow/com/searchviewmodule/ExampleUnitTest.java b/searchviewmodule/src/test/java/pramonow/com/searchviewmodule/ExampleUnitTest.java deleted file mode 100644 index 2ec2013..0000000 --- a/searchviewmodule/src/test/java/pramonow/com/searchviewmodule/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package pramonow.com.searchviewmodule; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file