diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt index d7ec751ee98abf4adda0c92f2c9dd6a5230dacb2..c8c07b223fbd1a4744a2169a872ec9220104ed67 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/MessageHistoryAdapter.kt @@ -19,6 +19,7 @@ package de.kuschku.quasseldroid.ui.chat.input +import android.text.TextUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -36,7 +37,7 @@ class MessageHistoryAdapter : ListAdapter<CharSequence, MessageHistoryAdapter.Me oldItem === newItem override fun areContentsTheSame(oldItem: CharSequence, newItem: CharSequence) = - oldItem == newItem + TextUtils.equals(oldItem, newItem) }) { private var clickListener: ((CharSequence) -> Unit)? = null private var updateFinishedListener: (() -> Unit)? = null diff --git a/ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java b/ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java new file mode 100644 index 0000000000000000000000000000000000000000..fda79ce4da99530db04e75cc685c25f7a4a0358a --- /dev/null +++ b/ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.kuschku.ui.graphics.drawable; + +import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP; + +import android.content.res.ColorStateList; +import android.graphics.PorterDuff; + +import androidx.annotation.ColorInt; +import androidx.annotation.RestrictTo; + +/** + * Interface which allows a {@link android.graphics.drawable.Drawable} to receive tinting calls + * from {@code DrawableCompat}. + */ +public interface TintAwareDrawable { + void setTint(@ColorInt int tint); + void setTintList(ColorStateList tint); + void setTintMode(PorterDuff.Mode tintMode); +} diff --git a/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java b/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java index fe95b95346c1f4fb1001575ffaf99ca263f6be74..2ce6cd3b5ba16ec86256ebfc592025c7ace3b2a3 100644 --- a/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java +++ b/ui_spinner/src/main/java/de/kuschku/ui/shape/MaterialShapeDrawable.java @@ -41,9 +41,10 @@ import androidx.annotation.ColorInt; import androidx.annotation.IntRange; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.core.graphics.drawable.TintAwareDrawable; import androidx.core.util.ObjectsCompat; +import de.kuschku.ui.graphics.drawable.TintAwareDrawable; + /** * Base drawable class for Material Shapes that handles shadows, elevation, scale and color for a * generated path. diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt index 260814b3dacb35ec93ba39cbb0defd30db6db410..007b2899200a119ed1f3d4dcdefd9d2fa26235cb 100644 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt +++ b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/AutoCompleteItem.kt @@ -30,6 +30,25 @@ sealed class AutoCompleteItem(open val name: String, val suffix: String, private else -> this.name.compareTo(other.name) } + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is AutoCompleteItem) return false + + if (name != other.name) return false + if (suffix != other.suffix) return false + if (type != other.type) return false + + return true + } + + override fun hashCode(): Int { + var result = name.hashCode() + result = 31 * result + suffix.hashCode() + result = 31 * result + type + return result + } + + data class UserItem( val nick: String, val hostMask: String,