From 60deb9abc492b591f8adcafea9f033c9f6241540 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:20:08 +0300 Subject: [PATCH 01/38] Update build tools * Android Gradle plugin 3.1.4 * Kotlin Gradle plugin 1.2.61 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 7219a0e..4032be9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.51' + ext.kotlin_version = '1.2.61' repositories { maven { url 'https://maven.google.com' @@ -10,7 +10,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" From e30fdfeeaa4a69af7850b4a317024fa420a4f2cb Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:25:03 +0300 Subject: [PATCH 02/38] Update build * compile SDK -> 27 * target SDK -> 27 * support library -> 27.1.1 --- chatmessageview/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index 2a7f1f0..bd9c02f 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -9,12 +9,12 @@ properties.load(project.rootProject.file('version.properties').newDataInputStrea def libVersion = properties.getProperty('version') android { - compileSdkVersion 26 + compileSdkVersion 27 buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName libVersion } @@ -110,9 +110,9 @@ install { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' - implementation "com.android.support:appcompat-v7:26.1.0" + implementation "com.android.support:appcompat-v7:27.1.1" implementation 'de.hdodenhof:circleimageview:2.1.0' - implementation "com.android.support:support-v4:26.1.0" + implementation "com.android.support:support-v4:27.1.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" testImplementation "org.robolectric:robolectric:3.6.1" testImplementation "org.mockito:mockito-core:2.13.0" From 6c64731db442326f1aef3e64395a2b804343edb5 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:27:53 +0300 Subject: [PATCH 03/38] Update deps * circleimageview -> 2.2.0 * mockito-core -> 2.18.3 --- chatmessageview/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index bd9c02f..b891219 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -111,11 +111,11 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' implementation "com.android.support:appcompat-v7:27.1.1" - implementation 'de.hdodenhof:circleimageview:2.1.0' + implementation 'de.hdodenhof:circleimageview:2.2.0' implementation "com.android.support:support-v4:27.1.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" testImplementation "org.robolectric:robolectric:3.6.1" - testImplementation "org.mockito:mockito-core:2.13.0" + testImplementation "org.mockito:mockito-core:2.18.3" } From 1b05778098cd4e46fcee99112f9ede21306413d4 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:28:50 +0300 Subject: [PATCH 04/38] use kotlin-stdlib instead of kotlin-stdlib-jre7 --- chatmessageview/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index b891219..b67d237 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -113,7 +113,7 @@ dependencies { implementation "com.android.support:appcompat-v7:27.1.1" implementation 'de.hdodenhof:circleimageview:2.2.0' implementation "com.android.support:support-v4:27.1.1" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" testImplementation "org.robolectric:robolectric:3.6.1" testImplementation "org.mockito:mockito-core:2.18.3" } From b9ee6726ee24583150bde02a5b5a20eb83370572 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:31:33 +0300 Subject: [PATCH 05/38] Update example build * compile SDK -> 27 * target SDK -> 27 * support library -> 27.1.1 --- example/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/build.gradle b/example/build.gradle index aca59f6..2ef8424 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 26 + compileSdkVersion 27 buildToolsVersion '27.0.3' defaultConfig { applicationId "com.github.bassaer.example" minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -39,7 +39,7 @@ dependencies { }) testImplementation 'junit:junit:4.12' implementation project(':chatmessageview') - implementation 'com.android.support:appcompat-v7:26+' + implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.google.code.gson:gson:2.3.1' androidTestImplementation 'junit:junit:4.12' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" From 0995b7758a5dbeaadcafa3dda0cb02c7d76adc9b Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:34:13 +0300 Subject: [PATCH 06/38] Update example deps * gson -> 2.8.5 --- example/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/build.gradle b/example/build.gradle index 2ef8424..0e88a55 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -40,7 +40,7 @@ dependencies { testImplementation 'junit:junit:4.12' implementation project(':chatmessageview') implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.google.code.gson:gson:2.3.1' + implementation 'com.google.code.gson:gson:2.8.5' androidTestImplementation 'junit:junit:4.12' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } From 40af31cc6b01220db8d33ab158ce74bf927e98ee Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:43:07 +0300 Subject: [PATCH 07/38] fix issue with named argument --- .../com/github/bassaer/chatmessageview/model/ChatUser.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt index 415a955..df23afb 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt @@ -17,7 +17,7 @@ class ChatUser(internal var id: Int?, internal var name: String, internal var ic return this.icon } - override fun setIcon(icon: Bitmap) { - this.icon = icon + override fun setIcon(bmp: Bitmap) { + this.icon = bmp } } From af4dc3425f31fe580c5f47dc6082ac16aebf01a9 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sat, 25 Aug 2018 03:52:23 +0300 Subject: [PATCH 08/38] fix error: get non-null Drawable --- .../kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt index 00120d8..c04c156 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt @@ -173,7 +173,7 @@ class ChatView : LinearLayout { private fun getColoredDrawable(color: Int, iconId: Int): Drawable { val colorStateList = ColorStateList.valueOf(color) - val icon = ContextCompat.getDrawable(context, iconId) + val icon = ContextCompat.getDrawable(context, iconId)!! val wrappedDrawable = DrawableCompat.wrap(icon) DrawableCompat.setTintList(wrappedDrawable, colorStateList) return wrappedDrawable From 774bc598a84b65771bc55f73c37c92119e5c3874 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sun, 10 Feb 2019 15:25:59 +0300 Subject: [PATCH 09/38] update libs and tools * Android Gradle Plugin -> 3.3.1 * Gradle -> 4.10.1 * Kotlin Version -> 1.3.21 * Compile SDK -> 28 * Target SDK -> 28 * Build Tools -> 28.0.3 * Gradle Bintray Plugin -> 1.8.4 * Android Maven Gradle Plugin -> 2.1 * Android Gradle Plugin JUnit5 -> 1.3.2.0 * Support Library -> 28.0.0 * Robolectric -> 4.1 * Mockito Core -> 2.24.0 * CircleImageView -> 3.0.0 * Espresso Core -> 3.0.2 --- build.gradle | 10 +++++----- chatmessageview/build.gradle | 16 ++++++++-------- example/build.gradle | 23 ++++++++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 4032be9..2d1bbfc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.61' + ext.kotlin_version = '1.3.21' repositories { maven { url 'https://maven.google.com' @@ -10,11 +10,11 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + classpath 'com.android.tools.build:gradle:3.3.1' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.12" + classpath "de.mannodermaus.gradle.plugins:android-junit5:1.3.2.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index b67d237..b89276a 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -9,12 +9,12 @@ properties.load(project.rootProject.file('version.properties').newDataInputStrea def libVersion = properties.getProperty('version') android { - compileSdkVersion 27 - buildToolsVersion '27.0.3' + compileSdkVersion 28 + buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 15 - targetSdkVersion 27 + targetSdkVersion 28 versionCode 1 versionName libVersion } @@ -110,12 +110,12 @@ install { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' - implementation "com.android.support:appcompat-v7:27.1.1" - implementation 'de.hdodenhof:circleimageview:2.2.0' - implementation "com.android.support:support-v4:27.1.1" + implementation "com.android.support:appcompat-v7:28.0.0" + implementation 'de.hdodenhof:circleimageview:3.0.0' + implementation "com.android.support:support-v4:28.0.0" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - testImplementation "org.robolectric:robolectric:3.6.1" - testImplementation "org.mockito:mockito-core:2.18.3" + testImplementation "org.robolectric:robolectric:4.1" + testImplementation "org.mockito:mockito-core:2.24.0" } diff --git a/example/build.gradle b/example/build.gradle index 0e88a55..543ba58 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 27 - buildToolsVersion '27.0.3' + compileSdkVersion 28 + buildToolsVersion '28.0.3' defaultConfig { applicationId "com.github.bassaer.example" minSdkVersion 15 - targetSdkVersion 27 + targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -34,16 +34,21 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) - testImplementation 'junit:junit:4.12' implementation project(':chatmessageview') - implementation 'com.android.support:appcompat-v7:27.1.1' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.google.code.gson:gson:2.8.5' + + testImplementation 'junit:junit:4.12' + + androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) androidTestImplementation 'junit:junit:4.12' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + androidTestImplementation 'com.android.support.test:rules:1.0.2' + } + repositories { mavenCentral() } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3d567e0..ef1d032 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip From 057f60fdff581e4497fb7ba4a66987821d31cab3 Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sun, 10 Feb 2019 15:34:45 +0300 Subject: [PATCH 10/38] Update test * use IdlingRegistry instance instead of deprecated Espresso registerIdlingResources/unregisterIdlingResources --- .../github/bassaer/example/MessengerActivityTest.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt b/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt index c1ef879..7456725 100644 --- a/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt +++ b/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt @@ -8,6 +8,7 @@ import android.support.test.espresso.DataInteraction import android.support.test.espresso.Espresso import android.support.test.espresso.Espresso.onData import android.support.test.espresso.Espresso.onView +import android.support.test.espresso.IdlingRegistry import android.support.test.espresso.action.ViewActions.* import android.support.test.espresso.assertion.ViewAssertions.matches import android.support.test.espresso.matcher.ViewMatchers.withId @@ -76,14 +77,14 @@ class MessengerActivityTest { val replyingUser = mUsers!![1] val waitingTime: Long = 3000 val idlingResource = ElapsedTimeIdlingResource(waitingTime) - Espresso.registerIdlingResources(idlingResource) + IdlingRegistry.getInstance().register(idlingResource) onRow(1).onChildView(withId(R.id.message_user_name)).check(matches(withText(sendingUser.getName()))) onRow(1).onChildView(withId(R.id.message_text)).check(matches(withText(message))) onRow(2).onChildView(withId(R.id.user_icon)).check(matches(withDrawable(R.drawable.face_1))) onRow(2).onChildView(withId(R.id.message_user_name)).check(matches(withText(replyingUser.getName()))) onRow(2).onChildView(withId(R.id.message_text)).check(matches(withText(containsString(sendingUser.getName())))) onRow(2).onChildView(withId(R.id.message_text)).check(matches(withText(containsString(message)))) - Espresso.unregisterIdlingResources(idlingResource) + IdlingRegistry.getInstance().unregister(idlingResource) } @Test @@ -112,14 +113,14 @@ class MessengerActivityTest { val waitingTime: Long = 3000 val idlingResource = ElapsedTimeIdlingResource(waitingTime) - Espresso.registerIdlingResources(idlingResource) + IdlingRegistry.getInstance().register(idlingResource) // Remove reply for message1 onRow(2).onChildView(withId(R.id.user_icon)).perform(longClick()) // Remove reply for message2 onRow(3).onChildView(withId(R.id.user_icon)).perform(longClick()) // message3 should be shown at 3rd message onRow(3).onChildView(withId(R.id.message_text)).check(matches(withText(messages[2]))) - Espresso.unregisterIdlingResources(idlingResource) + IdlingRegistry.getInstance().unregister(idlingResource) } @Test @@ -131,12 +132,12 @@ class MessengerActivityTest { val waitingTime: Long = 3000 val idlingResource = ElapsedTimeIdlingResource(waitingTime) - Espresso.registerIdlingResources(idlingResource) + IdlingRegistry.getInstance().register(idlingResource) onView(withId(R.id.optionButton)).perform(click()) // Remove all messages onView(withText(R.string.clear_messages)).perform(click()) onView(withId(R.id.messageView)).check(matches(MessageListMatcher.withListSize(0))) - Espresso.unregisterIdlingResources(idlingResource) + IdlingRegistry.getInstance().unregister(idlingResource) } From 40e6388749c776b25f1977ca8dec4168a53284fb Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sun, 10 Feb 2019 16:15:17 +0300 Subject: [PATCH 11/38] migrate test on Robolectric 4.1 --- .../bassaer/chatmessageview/view/MessageAdapterTest.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt index e60a400..e75808c 100644 --- a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt +++ b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt @@ -5,25 +5,22 @@ import android.content.Context import android.graphics.BitmapFactory import android.view.View import android.widget.TextView -import com.github.bassaer.chatmessageview.BuildConfig import com.github.bassaer.chatmessageview.R import com.github.bassaer.chatmessageview.model.ChatUser import com.github.bassaer.chatmessageview.model.Message import com.github.bassaer.chatmessageview.models.Attribute -import junit.framework.Assert.assertEquals +import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.RuntimeEnvironment -import org.robolectric.annotation.Config /** * MessageAdapter Unit Test * Created by nakayama on 2018/01/03. */ @RunWith(RobolectricTestRunner::class) -@Config(constants = BuildConfig::class) internal class MessageAdapterTest { private lateinit var messageAdapter: MessageAdapter private lateinit var messageList: ArrayList From 1d1dee8c3d88dc41fffeb267cd528cc3bd2c60ba Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sun, 10 Feb 2019 16:22:22 +0300 Subject: [PATCH 12/38] migrate on androidx, optimize imports --- chatmessageview/build.gradle | 10 +++--- .../chatmessageview/model/Attribute.kt | 3 +- .../bassaer/chatmessageview/model/ChatUser.kt | 1 - .../bassaer/chatmessageview/model/Message.kt | 2 ++ .../util/MessageDateComparator.kt | 1 + .../bassaer/chatmessageview/util/TimeUtils.kt | 2 +- .../bassaer/chatmessageview/view/ChatView.kt | 11 ++++--- .../chatmessageview/view/MessageAdapter.kt | 12 ++++--- .../chatmessageview/view/MessageView.kt | 5 ++- .../src/main/res/layout/chat_view.xml | 4 +-- .../chatmessageview/util/ChatBotTest.kt | 1 + .../chatmessageview/util/DateFormatterTest.kt | 3 +- .../util/DefaultTimeFormatterTest.kt | 3 +- .../util/MessageDateComparatorTest.kt | 3 +- .../chatmessageview/util/TimeUtilsTest.kt | 4 +-- .../view/MessageAdapterTest.kt | 6 ++-- example/build.gradle | 13 ++++---- .../bassaer/example/MainActivityTest.kt | 17 +++++----- .../bassaer/example/MessengerActivityTest.kt | 31 ++++++++++--------- .../example/matcher/DrawableMatcher.kt | 4 ++- .../example/util/ElapsedTimeIdlingResource.kt | 2 +- .../github/bassaer/example/MainActivity.java | 3 +- .../bassaer/example/MessengerActivity.java | 5 +-- .../example/MyMessageStatusFormatter.java | 5 +-- .../java/com/github/bassaer/example/User.java | 1 - 25 files changed, 92 insertions(+), 60 deletions(-) diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index b89276a..4a21cb7 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -109,11 +109,13 @@ install { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - testImplementation 'junit:junit:4.12' - implementation "com.android.support:appcompat-v7:28.0.0" - implementation 'de.hdodenhof:circleimageview:3.0.0' - implementation "com.android.support:support-v4:28.0.0" + implementation "androidx.core:core:1.0.1" + implementation "androidx.appcompat:appcompat:1.0.2" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + implementation 'de.hdodenhof:circleimageview:3.0.0' + + testImplementation 'junit:junit:4.12' testImplementation "org.robolectric:robolectric:4.1" testImplementation "org.mockito:mockito-core:2.24.0" } diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Attribute.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Attribute.kt index 65c4fcc..834c58b 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Attribute.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Attribute.kt @@ -1,7 +1,8 @@ -package com.github.bassaer.chatmessageview.models +package com.github.bassaer.chatmessageview.model import android.content.Context import android.util.AttributeSet + import com.github.bassaer.chatmessageview.R /** diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt index df23afb..8bd51ee 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/ChatUser.kt @@ -1,6 +1,5 @@ package com.github.bassaer.chatmessageview.model - import android.graphics.Bitmap class ChatUser(internal var id: Int?, internal var name: String, internal var icon: Bitmap) : IChatUser { diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Message.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Message.kt index f05ab5a..88c5048 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Message.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/model/Message.kt @@ -2,7 +2,9 @@ package com.github.bassaer.chatmessageview.model import android.graphics.Bitmap import android.graphics.drawable.Drawable + import com.github.bassaer.chatmessageview.util.* + import java.util.* /** diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/MessageDateComparator.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/MessageDateComparator.kt index 0ec1ba5..9f971a0 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/MessageDateComparator.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/MessageDateComparator.kt @@ -1,6 +1,7 @@ package com.github.bassaer.chatmessageview.util import com.github.bassaer.chatmessageview.model.Message + import java.util.* class MessageDateComparator : Comparator { diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt index e913d23..2f84adc 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt @@ -1,7 +1,7 @@ package com.github.bassaer.chatmessageview.util - import android.annotation.SuppressLint + import java.text.SimpleDateFormat import java.util.* diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt index c04c156..27af918 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt @@ -4,9 +4,6 @@ import android.content.Context import android.content.res.ColorStateList import android.graphics.drawable.Drawable import android.os.Handler -import android.support.v4.content.ContextCompat -import android.support.v4.graphics.drawable.DrawableCompat -import android.support.v4.widget.SwipeRefreshLayout import android.text.TextWatcher import android.util.AttributeSet import android.view.LayoutInflater @@ -14,9 +11,15 @@ import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.AdapterView import android.widget.LinearLayout + +import androidx.core.content.ContextCompat +import androidx.core.graphics.drawable.DrawableCompat +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout + import com.github.bassaer.chatmessageview.R +import com.github.bassaer.chatmessageview.model.Attribute import com.github.bassaer.chatmessageview.model.Message -import com.github.bassaer.chatmessageview.models.Attribute + import kotlinx.android.synthetic.main.chat_view.view.* import kotlinx.android.synthetic.main.option_button.view.* diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapter.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapter.kt index a53cf35..9970235 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapter.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapter.kt @@ -5,8 +5,6 @@ import android.content.Context import android.content.res.ColorStateList import android.graphics.Color import android.graphics.drawable.Drawable -import android.support.v4.content.ContextCompat -import android.support.v4.graphics.drawable.DrawableCompat import android.util.TypedValue import android.view.LayoutInflater import android.view.View @@ -15,13 +13,19 @@ import android.widget.ArrayAdapter import android.widget.FrameLayout import android.widget.ImageView import android.widget.TextView + +import androidx.core.content.ContextCompat +import androidx.core.graphics.drawable.DrawableCompat + import com.github.bassaer.chatmessageview.R +import com.github.bassaer.chatmessageview.model.Attribute import com.github.bassaer.chatmessageview.model.Message -import com.github.bassaer.chatmessageview.models.Attribute + import de.hdodenhof.circleimageview.CircleImageView + import kotlinx.android.synthetic.main.date_cell.view.* -import java.util.* +import java.util.* /** * Custom list adapter for the chat timeline diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageView.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageView.kt index 177fa7e..915b47d 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageView.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/MessageView.kt @@ -5,12 +5,15 @@ import android.os.Handler import android.util.AttributeSet import android.view.View import android.widget.ListView + +import com.github.bassaer.chatmessageview.model.Attribute import com.github.bassaer.chatmessageview.model.Message -import com.github.bassaer.chatmessageview.models.Attribute import com.github.bassaer.chatmessageview.util.MessageDateComparator import com.github.bassaer.chatmessageview.util.TimeUtils + import java.lang.ref.WeakReference import java.util.* + import kotlin.collections.ArrayList /** diff --git a/chatmessageview/src/main/res/layout/chat_view.xml b/chatmessageview/src/main/res/layout/chat_view.xml index 174ef53..23dd9f7 100644 --- a/chatmessageview/src/main/res/layout/chat_view.xml +++ b/chatmessageview/src/main/res/layout/chat_view.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - - + Date: Sun, 10 Feb 2019 17:39:19 +0300 Subject: [PATCH 13/38] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7575708..241ec0e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This library aims to provide a chat UI view for Android. | master | [![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) | | develop | [![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView/tree/develop.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) | -``` +```groovy dependencies { compile 'com.github.bassaer:chatmessageview:1.11.2' } @@ -41,7 +41,7 @@ dependencies { Only MessageView -``` +```xml Date: Sun, 10 Feb 2019 17:40:13 +0300 Subject: [PATCH 14/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 241ec0e..165d702 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This library aims to provide a chat UI view for Android. | master | [![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) | | develop | [![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView/tree/develop.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) | -```groovy +```gradle dependencies { compile 'com.github.bassaer:chatmessageview:1.11.2' } From 60557b51c5821687932fcb1ed0f2fe3bf7ba4a6a Mon Sep 17 00:00:00 2001 From: Maxim Paymushkin Date: Sun, 10 Feb 2019 17:59:55 +0300 Subject: [PATCH 15/38] update version --- README.md | 2 +- version.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 165d702..2007474 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This library aims to provide a chat UI view for Android. ```gradle dependencies { - compile 'com.github.bassaer:chatmessageview:1.11.2' + compile 'com.github.bassaer:chatmessageview:1.11.3' } ``` diff --git a/version.properties b/version.properties index a00e350..82f27fa 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=1.11.2 +version=1.11.3 From 07802c3d5a19574dbe15cc1ec91d211122134c93 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Tue, 12 Feb 2019 20:52:32 +0900 Subject: [PATCH 16/38] support travis ci --- .idea/caches/build_file_checksums.ser | Bin 0 -> 599 bytes .idea/codeStyles/Project.xml | 225 ++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 + .travis.yml | 46 ++++ chatmessageview/build.gradle | 4 +- .../bassaer/chatmessageview/util/TimeUtils.kt | 2 +- .../chatmessageview/util/DateFormatterTest.kt | 2 +- 7 files changed, 280 insertions(+), 4 deletions(-) create mode 100644 .idea/caches/build_file_checksums.ser create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .travis.yml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000000000000000000000000000000000000..9725b5305370d795440662490ed8a8e2e863e73b GIT binary patch literal 599 zcmZ4UmVvdnh`~NNKUXg?FQq6yGexf?KR>5fFEb@IQ7^qHF(oHeub?PDD>b=9F91S2 zm1gFoxMk*~I%lLNXBU^|7Q2L-Ts|(GuF1r}uGBYr_F>vMNC#JY1CYR(Fc`|U8WE7 + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..8f1a3b7 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c7078af --- /dev/null +++ b/.travis.yml @@ -0,0 +1,46 @@ +anguage: android + +env: + global: + - GRADLE_OPTS="-Xmx512m -XX:MaxPermSize=512m" + - ADB_INSTALL_TIMEOUT=10 + +android: + components: + # The BuildTools version used by your project + - build-tools-27.0.3 + + # The SDK version used to compile your project + - android-27 + - android-24 + - extra-google-m2repository + - extra-android-m2repository + + # Specify at least one system image, + # if you need to run emulator(s) during your tests + - sys-img-armeabi-v7a-android-27 + - sys-img-armeabi-v7a-android-24 + + licenses: + - android-sdk-preview-license-.+ + - android-sdk-license-.+ + - google-gdk-license-.+ + +branches: + only: + - master + +before_install: + - mkdir "$ANDROID_HOME/licenses" || true + - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" + - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" + + +before_script: + - echo no | android create avd --force -n test -t android-24 --abi armeabi-v7a + - QEMU_AUDIO_DRV=none emulator -avd test -no-skin -no-window & + - android-wait-for-emulator + - adb shell input keyevent 82 & + +script: + - ./gradlew clean lint test :example:connectedAndroidTest diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index 2a7f1f0..0c7af17 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -111,9 +111,9 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' implementation "com.android.support:appcompat-v7:26.1.0" - implementation 'de.hdodenhof:circleimageview:2.1.0' + implementation 'de.hdodenhof:circleimageview:3.0.0' implementation "com.android.support:support-v4:26.1.0" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation "org.robolectric:robolectric:3.6.1" testImplementation "org.mockito:mockito-core:2.13.0" } diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt index e913d23..9059a06 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/util/TimeUtils.kt @@ -19,7 +19,7 @@ object TimeUtils { */ @SuppressLint("SimpleDateFormat") fun calendarToString(calendar: Calendar, format: String?): String { - val sdf = SimpleDateFormat( format ?: "HH:mm") + val sdf = SimpleDateFormat( format ?: "HH:mm", Locale.ENGLISH) return sdf.format(calendar.time) } diff --git a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt index 2df2088..4e714ca 100644 --- a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt +++ b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt @@ -15,7 +15,7 @@ internal class DateFormatterTest { val formatter = DateFormatter() val calendar = Calendar.getInstance() calendar.set(2017, 10, 12) - assertEquals(formatter.getFormattedTimeText(calendar), "Nov. 12, 2017") + assertEquals("Nov. 12, 2017", formatter.getFormattedTimeText(calendar)) } } \ No newline at end of file From ade708012754573a120f42f309eba7e9ec62644d Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Tue, 12 Feb 2019 20:59:58 +0900 Subject: [PATCH 17/38] add license --- .travis.yml | 1 + .../github/bassaer/chatmessageview/util/DateFormatterTest.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c7078af..9fd3099 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ branches: before_install: - mkdir "$ANDROID_HOME/licenses" || true - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" + - echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license" - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" diff --git a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt index 4e714ca..eba636d 100644 --- a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt +++ b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/util/DateFormatterTest.kt @@ -18,4 +18,4 @@ internal class DateFormatterTest { assertEquals("Nov. 12, 2017", formatter.getFormattedTimeText(calendar)) } -} \ No newline at end of file +} From e18e258d9fd86e1cbc79fa4bcf7dedee4a2422ee Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Tue, 12 Feb 2019 21:10:16 +0900 Subject: [PATCH 18/38] fix --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9fd3099..c7078af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,6 @@ branches: before_install: - mkdir "$ANDROID_HOME/licenses" || true - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" - - echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license" - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" From 32d25b0c47ab6e322a394575ce41a937386f0971 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Tue, 12 Feb 2019 21:32:47 +0900 Subject: [PATCH 19/38] fix travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c7078af..a7a330e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -anguage: android +language: android env: global: From ac2967fd916d6c90e2f348946df0b0a98394948f Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Tue, 12 Feb 2019 22:20:22 +0900 Subject: [PATCH 20/38] fix version --- .idea/caches/build_file_checksums.ser | Bin 599 -> 599 bytes chatmessageview/build.gradle | 10 +++++----- .../bassaer/chatmessageview/view/ChatView.kt | 2 +- example/build.gradle | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 9725b5305370d795440662490ed8a8e2e863e73b..b42d8c0c3aa85f5efc3bb117a66ca5a8bb5c04c4 100644 GIT binary patch delta 63 zcmV-F0Kos(1lI(RnFH9P$g!MD0TAXAh!^`FRHhc@pN}x*UM-XN0U;AgaXz_PLIQ(k V=p*lzyDS2901=Zt0UMJ>0ugtq84&;g delta 63 zcmV-F0Kos(1lI(RnFD|r+_9WX0T7T^UGDc34`!7f_jiG#nMjlO0U;B9fH7>hcoDxX VZ@|j8fS~Ji01=Zt0UMJ>0ugp=8g>8x diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index 0c7af17..265c932 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -9,12 +9,12 @@ properties.load(project.rootProject.file('version.properties').newDataInputStrea def libVersion = properties.getProperty('version') android { - compileSdkVersion 26 + compileSdkVersion 27 buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName libVersion } @@ -110,9 +110,9 @@ install { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' - implementation "com.android.support:appcompat-v7:26.1.0" + implementation "com.android.support:appcompat-v7:27.1.1" implementation 'de.hdodenhof:circleimageview:3.0.0' - implementation "com.android.support:support-v4:26.1.0" + implementation "com.android.support:support-v4:27.1.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation "org.robolectric:robolectric:3.6.1" testImplementation "org.mockito:mockito-core:2.13.0" @@ -142,7 +142,7 @@ artifacts { archives sourcesJar } -task findConventions << { +task findConventions doLast { println project.getConvention() } diff --git a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt index 00120d8..0e535ed 100644 --- a/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt +++ b/chatmessageview/src/main/kotlin/com/github/bassaer/chatmessageview/view/ChatView.kt @@ -174,7 +174,7 @@ class ChatView : LinearLayout { private fun getColoredDrawable(color: Int, iconId: Int): Drawable { val colorStateList = ColorStateList.valueOf(color) val icon = ContextCompat.getDrawable(context, iconId) - val wrappedDrawable = DrawableCompat.wrap(icon) + val wrappedDrawable = DrawableCompat.wrap(icon!!) DrawableCompat.setTintList(wrappedDrawable, colorStateList) return wrappedDrawable } diff --git a/example/build.gradle b/example/build.gradle index aca59f6..61c3f80 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 26 + compileSdkVersion 27 buildToolsVersion '27.0.3' defaultConfig { applicationId "com.github.bassaer.example" minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -39,8 +39,8 @@ dependencies { }) testImplementation 'junit:junit:4.12' implementation project(':chatmessageview') - implementation 'com.android.support:appcompat-v7:26+' - implementation 'com.google.code.gson:gson:2.3.1' + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.google.code.gson:gson:2.8.2' androidTestImplementation 'junit:junit:4.12' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } From 348033147fcf9689c933d32e009252826b6176b3 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Tue, 12 Feb 2019 22:55:35 +0900 Subject: [PATCH 21/38] rm -no-skin option --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a7a330e..f68c0b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ before_install: before_script: - echo no | android create avd --force -n test -t android-24 --abi armeabi-v7a - - QEMU_AUDIO_DRV=none emulator -avd test -no-skin -no-window & + - QEMU_AUDIO_DRV=none emulator -avd test -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & From e3daf618cac3dac36a2dc6c886d3236f3c2bcc09 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 01:27:49 +0900 Subject: [PATCH 22/38] use 22 --- .travis.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index f68c0b6..057cfc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,13 @@ env: android: components: - # The BuildTools version used by your project - - build-tools-27.0.3 - - # The SDK version used to compile your project - - android-27 - - android-24 + - build-tools-28.0.3 + - android-28 + - android-22 - extra-google-m2repository - extra-android-m2repository - - # Specify at least one system image, - # if you need to run emulator(s) during your tests - - sys-img-armeabi-v7a-android-27 - - sys-img-armeabi-v7a-android-24 + - addon-google_apis-google-28 + - sys-img-armeabi-v7a-android-22 licenses: - android-sdk-preview-license-.+ @@ -31,14 +25,15 @@ branches: - master before_install: + - yes | sdkmanager "platforms;android-28" - mkdir "$ANDROID_HOME/licenses" || true - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" before_script: - - echo no | android create avd --force -n test -t android-24 --abi armeabi-v7a - - QEMU_AUDIO_DRV=none emulator -avd test -no-window & + - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a + - QEMU_AUDIO_DRV=none emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & From 915adc4f75173591e084b04bb671618f6c60e659 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 01:45:51 +0900 Subject: [PATCH 23/38] fix targetSdkVersion --- .idea/caches/build_file_checksums.ser | Bin 599 -> 599 bytes chatmessageview/build.gradle | 8 ++++---- example/build.gradle | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index b42d8c0c3aa85f5efc3bb117a66ca5a8bb5c04c4..bb377015637986f110dfe8e72d38f6f576a1d674 100644 GIT binary patch delta 64 zcmV-G0Kfm&1lI(Rm;~aN8$z+1O92pC6{FjMrAM};?kXui4NRJo_W>aj6J-b}Eco{N W*pYl6k`iS4bN~^PJpmh&MgkFQo*8EV delta 64 zcmV-G0Kfm&1lI(Rm;~Y2qsXzGO92q(5{MW39#p0l=AVx+ajN^w59T0#PY WX6PgDmb)whbN~^PJpmh&MgkG6q#5!6 diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index 265c932..d87cc53 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -9,12 +9,12 @@ properties.load(project.rootProject.file('version.properties').newDataInputStrea def libVersion = properties.getProperty('version') android { - compileSdkVersion 27 + compileSdkVersion 28 buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 15 - targetSdkVersion 27 + targetSdkVersion 28 versionCode 1 versionName libVersion } @@ -110,9 +110,9 @@ install { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' - implementation "com.android.support:appcompat-v7:27.1.1" + implementation "com.android.support:appcompat-v7:28.0.0" implementation 'de.hdodenhof:circleimageview:3.0.0' - implementation "com.android.support:support-v4:27.1.1" + implementation "com.android.support:support-v4:28.0.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation "org.robolectric:robolectric:3.6.1" testImplementation "org.mockito:mockito-core:2.13.0" diff --git a/example/build.gradle b/example/build.gradle index 61c3f80..2255f6f 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 27 + compileSdkVersion 28 buildToolsVersion '27.0.3' defaultConfig { applicationId "com.github.bassaer.example" minSdkVersion 15 - targetSdkVersion 27 + targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -39,7 +39,7 @@ dependencies { }) testImplementation 'junit:junit:4.12' implementation project(':chatmessageview') - implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.google.code.gson:gson:2.8.2' androidTestImplementation 'junit:junit:4.12' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" From 0997b5ca0f1222cecb8c7d3199138c34b06ce0e8 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 01:59:00 +0900 Subject: [PATCH 24/38] fix buildToolsVersion --- .idea/caches/build_file_checksums.ser | Bin 599 -> 599 bytes chatmessageview/build.gradle | 2 +- example/build.gradle | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index bb377015637986f110dfe8e72d38f6f576a1d674..b02d395054ec1d7e0ed207ee0ec91b189a6cfc7f 100644 GIT binary patch delta 63 zcmV-F0Kos(1lI(RnFFP4f3ciP0T91m0uc_a6HI0{e-QAsXJwQ30U;CliArDzqwnau VC`dCyK2Ruh01=Zt0UMJ>0udf57bO4y delta 63 zcmV-F0Kos(1lI(RnFE&_Lb04n0T5ahquYU{N4BKyDk(n=Oq!GT0U;9;We6xN`1bnP Vk$fML5@h;x01=Zt0UMJ>0ueT97=-`; diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index d87cc53..c2aafd7 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -10,7 +10,7 @@ def libVersion = properties.getProperty('version') android { compileSdkVersion 28 - buildToolsVersion '27.0.3' + buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 15 diff --git a/example/build.gradle b/example/build.gradle index 2255f6f..68b027d 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'kotlin-android' android { compileSdkVersion 28 - buildToolsVersion '27.0.3' + buildToolsVersion '28.0.3' defaultConfig { applicationId "com.github.bassaer.example" From c5e2219c3a96fa9364a2d62a51b5426e71a5ff0e Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 19:16:09 +0900 Subject: [PATCH 25/38] update robolectric ver --- .idea/caches/build_file_checksums.ser | Bin 599 -> 599 bytes chatmessageview/build.gradle | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index b02d395054ec1d7e0ed207ee0ec91b189a6cfc7f..bd07c6f836a670eee79467891b94c2a350e49e56 100644 GIT binary patch delta 35 rcmcc4a-C(uOy(^neH-U^GYTmD4QteVTdLaGdLq{-@<+$y?~Dlm6dw=Y delta 35 rcmcc4a-C(uOy;FI^&97SGYagFXA3m diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index c2aafd7..b515ced 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -114,7 +114,7 @@ dependencies { implementation 'de.hdodenhof:circleimageview:3.0.0' implementation "com.android.support:support-v4:28.0.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation "org.robolectric:robolectric:3.6.1" + testImplementation "org.robolectric:robolectric:4.1" testImplementation "org.mockito:mockito-core:2.13.0" } From 9db1f006354f8462d7b3cc167080d46b9267f831 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 19:28:19 +0900 Subject: [PATCH 26/38] update gitignore --- .gitignore | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index ef2d42b..71628c5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,16 +38,28 @@ captures/ # Intellij *.iml + +.idea/caches/ +.idea/libraries/ +.idea/shelf/ .idea/workspace.xml .idea/tasks.xml -.idea/libraries -.idea/vcs.xml +.idea/.name +.idea/compiler.xml +.idea/copyright/profiles_settings.xml +.idea/encodings.xml .idea/misc.xml .idea/modules.xml -.idea/markdown-navigator/ -.idea/markdown-navigator.xml -.idea/codeStyleSettings.xml -.idea/markdown-exported-files.xml +.idea/scopes/scope_settings.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/datasources.xml +.idea/dataSources.ids +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml +.idea/assetWizardSettings.xml projectFilesBackup/ From 2482033c57e7ab0c3e454d98b4933845e74467ee Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 19:28:58 +0900 Subject: [PATCH 27/38] update gitignore --- .idea/.name | 1 - .idea/caches/build_file_checksums.ser | Bin 599 -> 0 bytes .idea/compiler.xml | 22 ---------------------- .idea/copyright/profiles_settings.xml | 3 --- .idea/dictionaries/nakayama.xml | 8 -------- .idea/gradle.xml | 20 -------------------- 6 files changed, 54 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/caches/build_file_checksums.ser delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/dictionaries/nakayama.xml delete mode 100644 .idea/gradle.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 1984b35..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -ChatMessageView \ No newline at end of file diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser deleted file mode 100644 index bd07c6f836a670eee79467891b94c2a350e49e56..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 599 zcmZ4UmVvdnh`~NNKUXg?FQq6yGexf?KR>5fFEb@IQ7^qHF(oHeub?PDD>b=9F91S2 zm1gFoxMk*~I%lLNXBU^|7Q2L-Ts|(GuF1r}uGBYr_F>vMNC#JY1CYR(Fc`|U8WE73wX^j^u2JNVjuHlu)CypP x4 diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/dictionaries/nakayama.xml b/.idea/dictionaries/nakayama.xml deleted file mode 100644 index 78251db..0000000 --- a/.idea/dictionaries/nakayama.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - github - nakayama - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 309ba23..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - \ No newline at end of file From f6ca934010cd51cc4a6625de2fd6481a142cb1b5 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 19:52:31 +0900 Subject: [PATCH 28/38] migrate Robolectric --- chatmessageview/build.gradle | 2 ++ .../bassaer/chatmessageview/view/MessageAdapterTest.kt | 7 ++----- gradle.properties | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index b515ced..5c2a10b 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -11,6 +11,7 @@ def libVersion = properties.getProperty('version') android { compileSdkVersion 28 buildToolsVersion '28.0.3' + testOptions.unitTests.includeAndroidResources = true defaultConfig { minSdkVersion 15 @@ -115,6 +116,7 @@ dependencies { implementation "com.android.support:support-v4:28.0.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation "org.robolectric:robolectric:4.1" + testImplementation "androidx.test:core:1.1.0" testImplementation "org.mockito:mockito-core:2.13.0" } diff --git a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt index e60a400..85aab9d 100644 --- a/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt +++ b/chatmessageview/src/test/kotlin/com/github/bassaer/chatmessageview/view/MessageAdapterTest.kt @@ -5,7 +5,7 @@ import android.content.Context import android.graphics.BitmapFactory import android.view.View import android.widget.TextView -import com.github.bassaer.chatmessageview.BuildConfig +import androidx.test.core.app.ApplicationProvider import com.github.bassaer.chatmessageview.R import com.github.bassaer.chatmessageview.model.ChatUser import com.github.bassaer.chatmessageview.model.Message @@ -15,15 +15,12 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner -import org.robolectric.RuntimeEnvironment -import org.robolectric.annotation.Config /** * MessageAdapter Unit Test * Created by nakayama on 2018/01/03. */ @RunWith(RobolectricTestRunner::class) -@Config(constants = BuildConfig::class) internal class MessageAdapterTest { private lateinit var messageAdapter: MessageAdapter private lateinit var messageList: ArrayList @@ -31,7 +28,7 @@ internal class MessageAdapterTest { @Before fun setUp() { - context = RuntimeEnvironment.application + context = ApplicationProvider.getApplicationContext() messageList = ArrayList() val senderIcon = BitmapFactory.decodeResource(context.resources, R.drawable.ic_account_circle) val receiverIcon = BitmapFactory.decodeResource(context.resources, R.drawable.ic_action_user) diff --git a/gradle.properties b/gradle.properties index 1d3591c..5d019a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.enableUnitTestBinaryResources=true + From 8f9fd8c2649b38dd099e3df8a3e277a746f23637 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 20:02:57 +0900 Subject: [PATCH 29/38] fix .circleci/config.yml --- .circleci/config.yml | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 754863d..27c52bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,3 @@ -# Java Gradle CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-java/ for more details -# version: 2 jobs: build: @@ -10,36 +6,27 @@ jobs: - master - develop docker: - # specify the version you desire here - image: circleci/android:api-26-alpha - environment: - # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m TERM: dumb ADB_INSTALL_TIMEOUT: "10" - steps: - checkout - - # Download and cache dependencies - restore_cache: key: jars-{{ checksum "build.gradle" }}-{{ checksum "chatmessageview/build.gradle" }} - - run: name: update android sdk command: | + yes | sdkmanager "platforms;android-28" echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-26 echo y | android update sdk --no-ui --all --filter build-tools-26.0.0 - run: name: gradle dependencies command: ./gradlew androidDependencies - - save_cache: paths: ~/.gradle key: jars-{{ checksum "build.gradle" }}-{{ checksum "chatmessageview/build.gradle" }} - - # run unit tests! - run: name: unit test command: | @@ -48,17 +35,14 @@ jobs: - run: name: Show list of system-images command: sdkmanager --list --verbose | grep system-images - - run: name: Setup Emulator command: sdkmanager "system-images;android-19;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;default;armeabi-v7a" - - run: name: Launch Emulator command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on background: true parallel: true - - run: name: Wait emulator command: | @@ -68,7 +52,6 @@ jobs: - run: name: Run UI test command: ./gradlew connectedAndroidTest -PdisablePreDex - - run: name: Distribute Bintray command: | @@ -77,7 +60,6 @@ jobs: else echo "Bintray distribution was skipped." fi - - run: name: Update version command: | @@ -88,7 +70,6 @@ jobs: fi - store_test_results: path: example/build/test-results - - store_artifacts: path: example/build/reports - destination: reports \ No newline at end of file + destination: reports From 3a7023c10d9a9deedfd415f964ebada044db9f81 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 20:10:10 +0900 Subject: [PATCH 30/38] fix .circleci/config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 27c52bf..250358c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: - master - develop docker: - - image: circleci/android:api-26-alpha + - image: circleci/android:api-28 environment: JVM_OPTS: -Xmx3200m TERM: dumb @@ -19,8 +19,8 @@ jobs: name: update android sdk command: | yes | sdkmanager "platforms;android-28" - echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-26 - echo y | android update sdk --no-ui --all --filter build-tools-26.0.0 + echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-28 + echo y | android update sdk --no-ui --all --filter build-tools-28.0.3 - run: name: gradle dependencies command: ./gradlew androidDependencies From 341e9b3937d723c635767d64146749aaa1b86000 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 20:23:56 +0900 Subject: [PATCH 31/38] update gitignore --- .gitignore | 1 + .idea/codeStyles/Project.xml | 225 --------------------------- .idea/codeStyles/codeStyleConfig.xml | 5 - 3 files changed, 1 insertion(+), 230 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.gitignore b/.gitignore index 71628c5..7a645f0 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ captures/ .idea/dynamic.xml .idea/uiDesigner.xml .idea/assetWizardSettings.xml +.idea/codeStyles/* projectFilesBackup/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 430abbc..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 8f1a3b7..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file From 4cae24f67a8a0d68c694ca565acf5c1f96768b15 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 20:32:32 +0900 Subject: [PATCH 32/38] fix config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 250358c..c04ce85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,7 +18,7 @@ jobs: - run: name: update android sdk command: | - yes | sdkmanager "platforms;android-28" + yes | sdkmanager --licenses || exit 0 echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-28 echo y | android update sdk --no-ui --all --filter build-tools-28.0.3 - run: From adaf611609e96200d3069f1c2775afd804dee83d Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Wed, 13 Feb 2019 22:23:37 +0900 Subject: [PATCH 33/38] fix testDebugUnitTest --- build.gradle | 3 --- chatmessageview/build.gradle | 4 ---- example/build.gradle | 6 ++++-- .../com/github/bassaer/example/MainActivityTest.kt | 12 +++++------- .../github/bassaer/example/MessengerActivityTest.kt | 11 ++++++----- example/src/main/AndroidManifest.xml | 1 - .../bassaer/example/MyMessageStatusFormatter.java | 10 +++++----- gradle.properties | 2 -- 8 files changed, 20 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index 2d1bbfc..b64abf8 100644 --- a/build.gradle +++ b/build.gradle @@ -14,9 +14,6 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "de.mannodermaus.gradle.plugins:android-junit5:1.3.2.0" - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index 21d1d2d..c35e5bc 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -1,7 +1,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -apply plugin: "de.mannodermaus.android-junit5" Properties properties = new Properties() properties.load(project.rootProject.file('version.properties').newDataInputStream()) @@ -11,7 +10,6 @@ def libVersion = properties.getProperty('version') android { compileSdkVersion 28 buildToolsVersion '28.0.3' - testOptions.unitTests.includeAndroidResources = true defaultConfig { minSdkVersion 15 @@ -114,8 +112,6 @@ dependencies { implementation "androidx.appcompat:appcompat:1.0.2" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "de.hdodenhof:circleimageview:3.0.0" - implementation "com.android.support:appcompat-v7:28.0.0" - implementation "com.android.support:support-v4:28.0.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation "junit:junit:4.12" testImplementation "org.robolectric:robolectric:4.1" diff --git a/example/build.gradle b/example/build.gradle index e0cc207..f03b94b 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -24,6 +24,7 @@ android { } lintOptions { abortOnError false + disable 'GoogleAppIndexingWarning' } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -35,8 +36,9 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':chatmessageview') - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.google.code.gson:gson:2.8.2' + implementation 'com.google.code.gson:gson:2.8.5' + implementation "androidx.appcompat:appcompat:1.0.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" androidTestImplementation 'junit:junit:4.12' androidTestImplementation "androidx.test.espresso:espresso-core:3.1.1" androidTestImplementation "androidx.test.espresso:espresso-idling-resource:3.1.1" diff --git a/example/src/androidTest/kotlin/com/github/bassaer/example/MainActivityTest.kt b/example/src/androidTest/kotlin/com/github/bassaer/example/MainActivityTest.kt index 632e778..32cf068 100644 --- a/example/src/androidTest/kotlin/com/github/bassaer/example/MainActivityTest.kt +++ b/example/src/androidTest/kotlin/com/github/bassaer/example/MainActivityTest.kt @@ -1,7 +1,6 @@ package com.github.bassaer.example import android.content.Intent - import androidx.test.espresso.DataInteraction import androidx.test.espresso.Espresso.onData import androidx.test.espresso.assertion.ViewAssertions.matches @@ -9,9 +8,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule - import org.hamcrest.Matchers.anything - import org.junit.Before import org.junit.Rule import org.junit.Test @@ -24,17 +21,18 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class MainActivityTest { - @get:Rule - private var mActivityRule = ActivityTestRule(MainActivity::class.java) + @Rule + @JvmField + var activityRule = ActivityTestRule(MainActivity::class.java) @Before fun setUp() { - mActivityRule.launchActivity(Intent()) + activityRule.launchActivity(Intent()) } @Test fun checkMenuList() { - val menu = mActivityRule.activity.gettMenu() + val menu = activityRule.activity.gettMenu() for (i in menu.indices) { onRow(i).check(matches(withText(menu[i]))) } diff --git a/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt b/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt index 2725e0b..bd6e852 100644 --- a/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt +++ b/example/src/androidTest/kotlin/com/github/bassaer/example/MessengerActivityTest.kt @@ -40,16 +40,17 @@ class MessengerActivityTest { private var mContext: Context? = null private var mUsers: List? = null - @get:Rule - private var mActivityRule = ActivityTestRule(MessengerActivity::class.java, true, false) + @Rule + @JvmField + var activityTestRule = ActivityTestRule(MessengerActivity::class.java, true, false) @Before @Throws(Exception::class) fun setUp() { mContext = InstrumentationRegistry.getInstrumentation().targetContext AppData.reset(mContext) - mActivityRule.launchActivity(Intent()) - mUsers = mActivityRule.activity.users + activityTestRule.launchActivity(Intent()) + mUsers = activityTestRule.activity.users } @After @@ -92,7 +93,7 @@ class MessengerActivityTest { @Test fun checkSendingMessageInSequence() { - mActivityRule.activity.setReplyDelay(0) + activityTestRule.activity.setReplyDelay(0) val numOfMessages = 5 for (i in 0 until numOfMessages) { inputText(i.toString()) diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml index fb82895..bbf8093 100644 --- a/example/src/main/AndroidManifest.xml +++ b/example/src/main/AndroidManifest.xml @@ -3,7 +3,6 @@ xmlns:android="http://schemas.android.com/apk/res/android"> Date: Thu, 14 Feb 2019 20:23:52 +0900 Subject: [PATCH 34/38] use 25 image --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c04ce85..92fb3ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ jobs: command: sdkmanager --list --verbose | grep system-images - run: name: Setup Emulator - command: sdkmanager "system-images;android-19;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;default;armeabi-v7a" + command: sdkmanager "system-images;android-25;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-25;default;armeabi-v7a" - run: name: Launch Emulator command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on From 2ca7c4a5a4986803c33020a047932b707a12e70f Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Thu, 14 Feb 2019 22:41:47 +0900 Subject: [PATCH 35/38] 28 -> 26 --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 92fb3ca..ab2cc70 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: - master - develop docker: - - image: circleci/android:api-28 + - image: circleci/android:api-26-alpha environment: JVM_OPTS: -Xmx3200m TERM: dumb @@ -19,8 +19,8 @@ jobs: name: update android sdk command: | yes | sdkmanager --licenses || exit 0 - echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-28 - echo y | android update sdk --no-ui --all --filter build-tools-28.0.3 + echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-26 + echo y | android update sdk --no-ui --all --filter build-tools-26.0.0 - run: name: gradle dependencies command: ./gradlew androidDependencies @@ -37,7 +37,7 @@ jobs: command: sdkmanager --list --verbose | grep system-images - run: name: Setup Emulator - command: sdkmanager "system-images;android-25;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-25;default;armeabi-v7a" + command: sdkmanager "system-images;android-19;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;default;armeabi-v7a" - run: name: Launch Emulator command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on From a52d228f4d5891367ffaf9fac1bc0a548b7d4011 Mon Sep 17 00:00:00 2001 From: Tsubasa Nakayama Date: Sun, 24 Feb 2019 22:44:08 +0900 Subject: [PATCH 36/38] CircleCI -> TravisCI --- .circleci/config.yml | 75 ----------------------------------- .travis.yml | 23 ++++++----- CHANGELOG.md | 8 ++++ build.gradle | 37 +++++++++++++++-- chatmessageview/build.gradle | 75 +++++++++++++---------------------- deploy.sh | 15 ------- example/build.gradle | 29 +++++++------- scripts/bump.sh | 48 ++++++++++++++++++++++ scripts/changelog.sh | 55 +++++++++++++++++++++++++ scripts/deploy.sh | 25 ++++++++++++ travis_key.enc | Bin 0 -> 3392 bytes version.properties | 1 - version.sh | 19 --------- 13 files changed, 223 insertions(+), 187 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 CHANGELOG.md delete mode 100644 deploy.sh create mode 100755 scripts/bump.sh create mode 100755 scripts/changelog.sh create mode 100755 scripts/deploy.sh create mode 100644 travis_key.enc delete mode 100644 version.properties delete mode 100644 version.sh diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ab2cc70..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,75 +0,0 @@ -version: 2 -jobs: - build: - branches: - only: - - master - - develop - docker: - - image: circleci/android:api-26-alpha - environment: - JVM_OPTS: -Xmx3200m - TERM: dumb - ADB_INSTALL_TIMEOUT: "10" - steps: - - checkout - - restore_cache: - key: jars-{{ checksum "build.gradle" }}-{{ checksum "chatmessageview/build.gradle" }} - - run: - name: update android sdk - command: | - yes | sdkmanager --licenses || exit 0 - echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-26 - echo y | android update sdk --no-ui --all --filter build-tools-26.0.0 - - run: - name: gradle dependencies - command: ./gradlew androidDependencies - - save_cache: - paths: ~/.gradle - key: jars-{{ checksum "build.gradle" }}-{{ checksum "chatmessageview/build.gradle" }} - - run: - name: unit test - command: | - ./gradlew test - ./gradlew lint test - - run: - name: Show list of system-images - command: sdkmanager --list --verbose | grep system-images - - run: - name: Setup Emulator - command: sdkmanager "system-images;android-19;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;default;armeabi-v7a" - - run: - name: Launch Emulator - command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on - background: true - parallel: true - - run: - name: Wait emulator - command: | - circle-android wait-for-boot - sleep 30 - adb shell input keyevent 82 - - run: - name: Run UI test - command: ./gradlew connectedAndroidTest -PdisablePreDex - - run: - name: Distribute Bintray - command: | - if [ $CIRCLE_BRANCH = "master" ]; then - sh ./deploy.sh - else - echo "Bintray distribution was skipped." - fi - - run: - name: Update version - command: | - if [ $CIRCLE_BRANCH = "master" ]; then - sh ./version.sh - else - echo "Version update was skipped." - fi - - store_test_results: - path: example/build/test-results - - store_artifacts: - path: example/build/reports - destination: reports diff --git a/.travis.yml b/.travis.yml index 057cfc5..4ef4411 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: android - env: global: - - GRADLE_OPTS="-Xmx512m -XX:MaxPermSize=512m" - - ADB_INSTALL_TIMEOUT=10 - + - GRADLE_OPTS="-Xmx512m -XX:MaxPermSize=512m" + - ADB_INSTALL_TIMEOUT=10 + - secure: "RdQNUckTM43ea1vGjp5umCeL0RMNglTdeB2CQ8iNsATBAMTppvUKS0j7EAaYidO4lfTrLvsMyO/ujbMkBgFmPXCYJUkDi0OUiCkdXQzVYoMrrfY4PIw2LKcm9YhCZ5NJpAdXV56CyiYX67ZzlsR2Jm1y1toEnfSK1u1tQkZxq4qdm+KPIoYhIbSu0RChZs4aBB4Eyt7/Juix094G+mUeRqrmt3FkCwhA450euNTy5NtLCkJe/SLPtKK4lzcc15VoFrMNZ55FJ2qjekiucyrl+6fjbxHP8dFQ8Wa54/iJJKcyH0BLevpA0kYyTzNoD6YBspo3lIGrI+szL6rQSruYqPu49xpjhVb0nTner8Usybj81ILQzkwZ/leEFCZRxlEzHtqYRfmqi4QzxmBtTVF47HK29CQDOhghC1SolOzepulFDAnK6g07dLvhdPt+P0jQba694h8onCLbiamLPtz1+75ZJaG+RNOo+hP8hJ80Wkww95Aa3KR3Gnh4Kapqnf7TF7A/MJPCqktYadZuCpVAX10VWjwyB0B0lcTEsP8S1pl+w1J//nOIjBpb7o3szFnoV3CZzAkHoKAX1ah5uNDYxWPBI/ViVJgzKHdQss/gICwMu4uAkseXsswTvOVdlAqB5laG2rL6ZuqiyZGCFTTtzsggPwFfs2tY+WR0gABbgPE=" + - secure: "OdKFtIaKIlwb5kl5JjasYciuj14+z2qPbCsHPRWdm/QB40tQZnIEWfwrypW3HHxfxzlAJxnKGuv66Y90FLBEL5WvG8r9gxPYcheMNv+AzpXhB4Pzbg8T2k5pJAI4OBTi+yMQkLMnz1Q8YOe7boiNcSC5oCdlQCLADOmu/Wxl9GVpDgEUZX/+4jLQvn/yo58Xxk2ANA56HNt6/ww+yNVdELe9X3bazW9pl7nvBLP5KcyibGYw1pMe3N3W74r6xw21x8ifYUTeeEz1WKwCammJluRXkR7al1o0EZwuS1hA7AbeJAsY5XwNJEUDMYQgrSXif6ie3h9zJYIFi0b8o3f/7KkPXoxCtWvR9s24fmsjlc+ogDw2/0CfGBe6gBlIqItJ6W83+Synk8k2xrkp3brf7nl0e9Flg8ZHL4fFDAexUhwkOGApN0IA8Y2uZCMK2FSB8dkO2hR4goF8sOec1JmkX0KVf+m+Gm7RYXrR1cOoRSKxdjwyc1Py+b069nqANmHSHudw/54L7fiO8AVe9goXCYP3+u74kfgErgBICFZMS8DxIYZa3TZYkJfV1GEMgt1DiOPwhprQmjeoXxCzdln8u6mMYBqvY486f2w2MDenH2AsJMbR77K/TGZGuzhK7ZPKXEiahvYbPI1LyDRhwcDdfR8ZDod4nvx39uPVmIqJHMA=" android: components: - build-tools-28.0.3 @@ -14,28 +14,29 @@ android: - extra-android-m2repository - addon-google_apis-google-28 - sys-img-armeabi-v7a-android-22 - licenses: - android-sdk-preview-license-.+ - android-sdk-license-.+ - google-gdk-license-.+ - branches: only: - master - before_install: - yes | sdkmanager "platforms;android-28" - mkdir "$ANDROID_HOME/licenses" || true - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" - - before_script: - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a - QEMU_AUDIO_DRV=none emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & - script: - - ./gradlew clean lint test :example:connectedAndroidTest + - ./gradlew clean lint test :example:connectedAndroidTest +deploy: + provider: script + script: scripts/deploy.sh + skip_cleanup: true +after_deploy: + - set -e + - scripts/bump.sh diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c59ee19 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# CHANGELOG + +Ver 2.0.0 +- PR: https://github.com/bassaer/ChatMessageView/pull/170 +- update lib version +- migrate AndroidX +- CircleCI -> TravisCI +- change LICENSE diff --git a/build.gradle b/build.gradle index b64abf8..50e4c65 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,4 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { - ext.kotlin_version = '1.3.21' repositories { maven { url 'https://maven.google.com' @@ -13,7 +10,7 @@ buildscript { classpath 'com.android.tools.build:gradle:3.3.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21' } } @@ -28,3 +25,35 @@ task clean(type: Delete) { delete rootProject.buildDir } + +def getLibVersion() { + def stdout = new ByteArrayOutputStream() + exec { + workingDir '.' + commandLine 'scripts/changelog.sh', '-v' + standardOutput = stdout + } + return stdout.toString().trim() +} + +ext { + kotlinVersion = '1.3.21' + compileSdkVersion = 28 + minSdkVersion = 15 + targetSdkVersion = 28 + versionCode = 1 + versionName = getLibVersion() + androidXCoreVersion = '1.0.1' + androidXAppcompatVersion = '1.0.2' + circleimageviewVersion = '3.0.0' + junitVersion = '4.12' + robolectricVersion = '4.1' + androidXTestCoreVersion = '1.1.0' + mockitoCoreVersion = '2.24.0' + gsonVersion = '2.8.5' + androidXEspressoCoreVersion = '3.1.1' + androidXEspressoIdlingResourceVersion = '3.1.1' + androidXTestRulesVersion = '1.1.1' + androidXTestRunnerVersion = '1.1.1' + androidXTestExtJunitVersion = '1.1.0' +} diff --git a/chatmessageview/build.gradle b/chatmessageview/build.gradle index c35e5bc..fe9440b 100644 --- a/chatmessageview/build.gradle +++ b/chatmessageview/build.gradle @@ -1,21 +1,17 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' - -Properties properties = new Properties() -properties.load(project.rootProject.file('version.properties').newDataInputStream()) - -def libVersion = properties.getProperty('version') +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' +apply plugin: "maven" android { - compileSdkVersion 28 - buildToolsVersion '28.0.3' - + compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - minSdkVersion 15 - targetSdkVersion 28 - versionCode 1 - versionName libVersion + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode rootProject.ext.versionCode + versionName rootProject.ext.versionName } buildTypes { release { @@ -38,39 +34,27 @@ android { } } -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' - group = 'com.github.bassaer' -version = libVersion +version = rootProject.ext.versionName def siteUrl = 'https://github.com/bassaer/ChatMessageView' def gitUrl = 'https://github.com/bassaer/ChatMessageView.git' - -def localProperties = project.rootProject.file('local.properties') +def issueUrl = 'https://github.com/bassaer/ChatMessageView/issues' bintray { - if (localProperties.exists()) { - properties.load(localProperties.newDataInputStream()) - user = properties.getProperty('bintray_user') - key = properties.getProperty('bintray_api_key') - } else { - //Circle CI ENV - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_API_KEY') - } - + user = 'bassaer' + key = System.getenv('BINTRAY_API_KEY') // Travis ENV + publish = true configurations = ['archives'] - pkg { repo = 'ChatMessageView' name = project.name userOrg = 'tnakayama' desc = 'Chat UI Library for Android' websiteUrl = siteUrl - issueTrackerUrl = 'https://github.com/bassaer/ChatMessageView/issues' + issueTrackerUrl = issueUrl vcsUrl = gitUrl - licenses = ['MIT'] + licenses = ['Apache-2.0'] labels = ['android'] publicDownloadNumbers = true } @@ -85,8 +69,8 @@ install { url = siteUrl licenses { license { - name 'The MIT License (MIT)' - url 'https://opensource.org/licenses/mit-license.php' + name 'Apache-2.0' + url 'https://www.apache.org/licenses/LICENSE-2.0' } } developers { @@ -108,19 +92,17 @@ install { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "androidx.core:core:1.0.1" - implementation "androidx.appcompat:appcompat:1.0.2" - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation "de.hdodenhof:circleimageview:3.0.0" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation "junit:junit:4.12" - testImplementation "org.robolectric:robolectric:4.1" - testImplementation "androidx.test:core:1.1.0" - testImplementation "org.mockito:mockito-core:2.24.0" + implementation "androidx.core:core:$androidXCoreVersion" + implementation "androidx.appcompat:appcompat:$androidXAppcompatVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" + implementation "de.hdodenhof:circleimageview:$circleimageviewVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + testImplementation "junit:junit:$junitVersion" + testImplementation "org.robolectric:robolectric:$robolectricVersion" + testImplementation "androidx.test:core:$androidXTestCoreVersion" + testImplementation "org.mockito:mockito-core:$mockitoCoreVersion" } - - task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' @@ -149,18 +131,17 @@ task findConventions doLast { def repo = new File(rootDir, "repository") -apply plugin: "maven" - uploadArchives { repositories { mavenDeployer { repository url: "file://${repo.absolutePath}" - pom.version = libVersion + pom.version = rootProject.ext.versionName pom.groupId = 'com.github.bassaer' pom.artifactId = 'chatmessageview' } } } + repositories { mavenCentral() google() diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 9f478a4..0000000 --- a/deploy.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# AAR build -./gradlew chatmessageview:assembleRelease - -# create maven repo -./gradlew chatmessageview:uploadArchives - -# deploy to bintray -./gradlew chatmessageview:build -./gradlew chatmessageview:bintrayUpload - -# Publish with Bintray's REST API -VERSION=`cat version.properties | cut -d'=' -f2` -curl -I -X POST -u$BINTRAY_USER:$BINTRAY_API_KEY https://api.bintray.com/content/tnakayama/ChatMessageView/chatmessageview/$VERSION/publish \ No newline at end of file diff --git a/example/build.gradle b/example/build.gradle index f03b94b..ec32fc2 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -4,15 +4,14 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 28 - buildToolsVersion '28.0.3' + compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { applicationId "com.github.bassaer.example" - minSdkVersion 15 - targetSdkVersion 28 - versionCode 1 - versionName "1.0" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode rootProject.ext.versionCode + versionName rootProject.ext.versionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" DdmPreferences.setTimeOut(60000) } @@ -36,15 +35,15 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':chatmessageview') - implementation 'com.google.code.gson:gson:2.8.5' - implementation "androidx.appcompat:appcompat:1.0.2" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - androidTestImplementation 'junit:junit:4.12' - androidTestImplementation "androidx.test.espresso:espresso-core:3.1.1" - androidTestImplementation "androidx.test.espresso:espresso-idling-resource:3.1.1" - androidTestImplementation "androidx.test:rules:1.1.1" - androidTestImplementation "androidx.test:runner:1.1.1" - androidTestImplementation "androidx.test.ext:junit:1.1.0" + implementation "com.google.code.gson:gson:$gsonVersion" + implementation "androidx.appcompat:appcompat:$androidXAppcompatVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + androidTestImplementation "junit:junit:$junitVersion" + androidTestImplementation "androidx.test.espresso:espresso-core:$androidXEspressoCoreVersion" + androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$androidXEspressoIdlingResourceVersion" + androidTestImplementation "androidx.test:rules:$androidXTestRulesVersion" + androidTestImplementation "androidx.test:runner:$androidXTestRunnerVersion" + androidTestImplementation "androidx.test.ext:junit:$androidXTestExtJunitVersion" } repositories { diff --git a/scripts/bump.sh b/scripts/bump.sh new file mode 100755 index 0000000..e2abfe2 --- /dev/null +++ b/scripts/bump.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -ef + +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + echo "pull request build." + exit 0 +fi + +curr_ver=$(git describe --tags --abbrev=0) +next_ver=$(scripts/changelog.sh -v) +if [ $curr_ver = $next_ver ]; then + echo 'skip bump version' + exit 0 +fi + +version=$(scripts/changelog.sh -v) +desc=$(scripts/changelog.sh -d) + +openssl aes-256-cbc -K $encrypted_a3a257078b28_key -iv $encrypted_a3a257078b28_iv -in travis_key.enc -out ~/.ssh/id_rsa -d +chmod 600 ~/.ssh/id_rsa +echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + +git config --global user.name "TravisCI" +git config --global user.email "app.nakayama@gmail.com" + +git clone "git@github.com:$TRAVIS_REPO_SLUG.git" +cd git-test +sed -i "/compile/s/[0-9]*\.[0-9]*\.[0-9]*/$version/" README.md +git add README.md +git commit -m "bump version [ci skip]" +git push origin master + +body=$(cat << EOF +{ + "tag_name": "$version", + "target_commitish": "master", + "name": "$version", + "body": "$desc", + "draft": false, + "prerelease": false +} +EOF +) + +curl -X POST -d "$body" -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases" \ + > /dev/null 2>&1 diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 0000000..fbc131d --- /dev/null +++ b/scripts/changelog.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +function usage { + + cat <HxDEAV#X=>z( z(+BZ@racArP7YegfJJ;)l5`qF2Y0pxx!c8EF;AkU+q{98gjOMweZoKHz|S?dGPJfb zN2s!&58R(Zneu;*dMlgU?`ZEOZcgT?<7|S;X}Mh*mDz5r z5=_&i0MVL-rR(uWEJps&KC1?kw!jBgeE<=wS_)*9WOl&_)tw$~DW~YC3Q;4G`QOoR z^7yfYKvyynQnF$)NB|vGRcQ62Hg+qaO=uHpLHdFP=*TwI(Fbl7S!AP8jhZEJ5lfQL-FwBTqXEKFq@@ul;OqUj{2_SG6@GU13N$mF3dzDZ zhMp~~nSSoSA4xgVFN0l%F`=;d+Z@$Y{~6Bfk$nx$oQ-k>_rGQOfUq5skfl6>2E@ei z%mA5Va17OS1rC00XdrjD0}d!HEb&l|^+uRtf4WZ&7g-;sw1;(>=o?cfe3RKSrV&7z zhZdW`iUBF;mGYZatj7|5YB!#dBh!nPc$*v!o0Hbb)ailDY=l4J2Y63Eca?(JJ;PrL z#d2WzSr>aIt>taPN;Ha2oa5A!R#V9iLS+qrw5Ld_tLX(%asBH32hp<=DbAD_E9upu zOA5mjis~Zl-z_st zm*JX5S7t*Onq6DWkbTK=|I3EQQ!tdISzSb>+;DH@DpJ^9T&(o_=9mTvqiIOzaj3AD zFcn>C^NVyr>ggU>{!<4+q&C-gk&ur*0HIz3h)~6Tt~SoMsfbaJq&vpoM+j-ykj{Tu z#X@3>^!S&Xv_CME1T`!XoSCFz)%%y~F(~1c%Dl^)3{R@lrcbaDOkUOM?LEe(_J-eU zs;N(nmj6tl{L;jUg6S(+>Vk;-aS_GTxpX9@(tS(FM{GBp(0R|xH0I!Nsm!Ffhk6=* zDwY3zQ3}giz_3UodXN|GI5Xl?D8^D+)xetVJgPB^@ij+%o^G&TSG! z3U={Q4gRRXJFRs8i`?VuTI6;hK%Ht&xJ5z~rvrQX5tW!6IHO5tJhO^SP!tP4BLIK` z43+`WR2Wjy{I?F=UauwXSD%N^MfS0d3J}l#bli3KL zIPK9@bX{YLg&OWA6#LD4l0L+HfUnxK=MxRuJV+CVpg705pnXgs=9k4-JI4{7UU_(m zG_gPi@k+r-9Mo8?e8L`DrINrQxDS&nIRV|K@>EWiy|Q3WLeaA*M-ahAZQG&5Z0_mq zf_`UcB=w3D1hLTRo=z^6k<{wSBjImFRo2^5YcsDXy`i1Ejb$4*<$@a2HKL`ox>x@L z1>2NjZaxV**K=CP%d)DnTw(Q1|LXrqV)#0Iv2uS|i`XkYDMQB+LvO1_2?%}$o}-m9 zAKr$w#wIeOsERN%jmh@_0g=aXIkUm`+s5B|4eNw7wE=U(%i|F*n2{4^K&1|H&kGY3 z6cH^3nI`_XOQWbj$Jz?HgyO906dylCK4qGFWF>F|6w^1CxGu+@MvrxzTvDwbIjtuK7>tp&6SmtI-0?ggv@M3O zmk1uwdSKA2T|i|#d%r4-zL@y6w?vw`Xus~KDsj_DWon?L^Y=f0|1B|JRkPQslmhBY z`Aw$dM6ak#CyH{#V5h0I;g(+9W5EV_76qLM+NxTzT zh+CEQmF|^bH=vWtIag7Ml~7N`u)B9dSz8h)+$g11i`(ldW1Vcp;K)>WFhN|Cl*8Ma<3fwb0sM^*rD;< z=T}yEkQIAi^yB`#%UldT$ zonAWDr&N6r5SwY-=%pBw?W)t=z73(q%^~q&N`ogpL}hqvSmfSS2TVOgo0vQ}(QBO> zrD&SB%|pMajm!R_J?>-Uo$r?GK<9ns={xp6_VFluvosxEdNP#C#NoM%T+w zX3`{5YF_+QoaP(KoOM?Pob2&C@7=D~X7R;Y)8TknT0E;Y4@v)n$3+cXH}0tHM9N3n z$3g+E3G94l6#j!o2&%cYajjo5%S-Vh;%@|yl(oBm^0sB1Z{Z)bI5jx3>o*@WJz<*f z1UJc4{dyPU@p;P~%P5?nCy$L?QS7B}Q8eX0v<`fHOm?JM_9u(-lUQu(1>r!1vXWXG zay(Du5N|AAcBcb^=bdxgO0o`sY=l)9H0Oz1euaQ{-Fmoq`z!KDhptPvS6F*|?y-}} zN`a#`JC_>u90*gt>Tbb8PEic*hY(L!p4+F$PEQ^>PnQak;y+U)sCZuT^i0fhmens1 zw*KM4jV|F$Wo}?y9-?vIq)!MhH=99aFZ24fwuwJ+9!dNNxTFZe&J3<`+Cz+tq`?qg z|Dl%x3h4=TeV!6a&RR7QJzfg?BFbtZLQUS*=biqEz9^OICH0j7S@1UxzmZ`3bMC+6 z{TrR{@IQe;`r^M>XMOV!qQ}eDEhv1uA}{KJHQ`Ufgch9gOh6q^I^ z2^T=*yue}E^#s7pY2uAbw{~yB!m|$(b9{SIrZm4XhV(Rz@0#^CCDMt3w!VPmH7fHG Wa4 Date: Sun, 24 Feb 2019 23:21:15 +0900 Subject: [PATCH 38/38] update README --- README.md | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 2007474..c4bc1a6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # ChatMessageView -[![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) +[![Build Status](https://travis-ci.org/bassaer/ChatMessageView.svg?branch=master)](https://travis-ci.org/bassaer/ChatMessageView) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ChatMessageView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5032) [![Download](https://api.bintray.com/packages/tnakayama/ChatMessageView/chatmessageview/images/download.svg) ](https://bintray.com/tnakayama/ChatMessageView/chatmessageview/_latestVersion) [![API](https://img.shields.io/badge/API-15%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=15) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/bassaer/ChatMessageView/blob/master/LICENSE) -This library aims to provide a chat UI view for Android. +This library aims to provide a chat UI view for Android. @@ -23,11 +23,6 @@ This library aims to provide a chat UI view for Android. ## Gradle [ ![Download](https://api.bintray.com/packages/tnakayama/ChatMessageView/chatmessageview/images/download.svg) ](https://bintray.com/tnakayama/ChatMessageView/chatmessageview/_latestVersion) -| branch| status | -----|---- -| master | [![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) | -| develop | [![CircleCI](https://circleci.com/gh/bassaer/ChatMessageView/tree/develop.svg?style=svg)](https://circleci.com/gh/bassaer/ChatMessageView) | - ```gradle dependencies { compile 'com.github.bassaer:chatmessageview:1.11.3' @@ -158,28 +153,4 @@ public class MessengerActivity extends Activity { ``` ## License - -``` -MIT License - -Copyright (c) 2016 Tsubasa Nakayama - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -``` +[Apache-2.0](https://github.com/bassaer/ChatMessageView/blob/master/LICENSE)