From 824a6fb6eb88b0f180d832dba37613d7e88a9761 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Wed, 17 Apr 2019 23:05:05 +0200
Subject: [PATCH] Fix build issues

---
 .../ui/chat/input/MessageHistoryAdapter.kt    |  3 +-
 .../graphics/drawable/TintAwareDrawable.java  | 35 +++++++++++++++++++
 .../ui/shape/MaterialShapeDrawable.java       |  3 +-
 .../viewmodel/data/AutoCompleteItem.kt        | 19 ++++++++++
 4 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 ui_spinner/src/main/java/de/kuschku/ui/graphics/drawable/TintAwareDrawable.java

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 d7ec751ee..c8c07b223 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 000000000..fda79ce4d
--- /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 fe95b9534..2ce6cd3b5 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 260814b3d..007b28992 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,
-- 
GitLab