Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates and fixes #160

Merged
merged 15 commits into from
Feb 13, 2019
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ 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) |

```
```gradle
dependencies {
compile 'com.github.bassaer:chatmessageview:1.11.2'
compile 'com.github.bassaer:chatmessageview:1.11.3'
}
```

Expand All @@ -41,7 +41,7 @@ dependencies {

Only MessageView

```
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
Expand All @@ -58,7 +58,7 @@ Only MessageView

ChatView has MessageView and text box.

```
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
Expand All @@ -75,7 +75,7 @@ ChatView has MessageView and text box.

Sample code

```
```java
public class MessengerActivity extends Activity {

private ChatView mChatView;
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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.3.21'
repositories {
maven {
url 'https://maven.google.com'
Expand All @@ -10,11 +10,11 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
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
}
Expand Down
20 changes: 11 additions & 9 deletions chatmessageview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ properties.load(project.rootProject.file('version.properties').newDataInputStrea
def libVersion = properties.getProperty('version')

android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName libVersion
}
Expand Down Expand Up @@ -109,13 +109,15 @@ 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'

testImplementation 'junit:junit:4.12'
implementation "com.android.support:appcompat-v7:26.1.0"
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation "com.android.support:support-v4:26.1.0"
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.robolectric:robolectric:4.1"
testImplementation "org.mockito:mockito-core:2.24.0"
}


Expand Down
Original file line number Diff line number Diff line change
@@ -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

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -17,7 +16,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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.bassaer.chatmessageview.util

import com.github.bassaer.chatmessageview.model.Message

import java.util.*

class MessageDateComparator : Comparator<Message> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.bassaer.chatmessageview.util


import android.annotation.SuppressLint

import java.text.SimpleDateFormat
import java.util.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ 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
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.*

Expand Down Expand Up @@ -173,7 +176,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
4 changes: 2 additions & 2 deletions chatmessageview/src/main/res/layout/chat_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/chatContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
Expand All @@ -17,7 +17,7 @@
android:cacheColorHint="@android:color/transparent"
android:listSelector="@android:color/transparent"/>

</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>


<LinearLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.bassaer.chatmessageview.util

import org.hamcrest.CoreMatchers.startsWith

import org.junit.Assert.assertEquals
import org.junit.Assert.assertThat
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.github.bassaer.chatmessageview.util

import junit.framework.Assert.assertEquals
import org.junit.Assert.assertEquals
import org.junit.Test

import java.util.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.github.bassaer.chatmessageview.util

import junit.framework.Assert.assertEquals
import org.junit.Assert.assertEquals
import org.junit.Test

import java.util.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.github.bassaer.chatmessageview.util


import com.github.bassaer.chatmessageview.model.Message

import org.junit.Assert.assertEquals
import org.junit.Test

import java.util.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.bassaer.chatmessageview.util


import junit.framework.Assert.assertEquals
import org.junit.Assert.assertEquals
import org.junit.Test

import java.util.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
package com.github.bassaer.chatmessageview.view


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.Attribute
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<Any>
Expand Down
28 changes: 17 additions & 11 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "com.github.bassaer.example"
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
DdmPreferences.setTimeOut(60000)
}
buildTypes {
Expand All @@ -34,16 +34,22 @@ 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:26+'
implementation 'com.google.code.gson:gson:2.3.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation 'com.google.code.gson:gson:2.8.5'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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"

}

repositories {
mavenCentral()
}
Loading