From b8a8050e3d7664110795efda8126043ea18acc1f Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Tue, 27 Mar 2018 23:20:04 +0200
Subject: [PATCH] Fix lint issues, correctly sort messages

---
 app/build.gradle.kts                          |  6 ++
 .../quasseldroid/ui/chat/ToolbarFragment.kt   |  3 +-
 .../ui/chat/input/FormatHandler.kt            | 12 +--
 .../ui/chat/nicks/NickListAdapter.kt          |  4 +-
 .../quasseldroid/ui/setup/SetupActivity.kt    |  4 +-
 .../util/QuasseldroidNotificationManager.kt   |  2 +-
 .../util/backport/ReadableWrappedChannel.kt   |  2 +-
 .../util/backport/WritableWrappedChannel.kt   |  2 +-
 .../quasseldroid/util/helper/SpannedHelper.kt |  2 +-
 .../util/irc/format/IrcFormatDeserializer.kt  | 50 +++++-----
 .../util/irc/format/IrcFormatSerializer.kt    | 18 ++--
 .../quasseldroid/util/quassel/IrcUserUtils.kt | 20 ++--
 .../util/ui/ContextThemeWrapper.kt            |  6 +-
 .../util/ui/DrawerRecyclerView.kt             |  6 +-
 .../ui/MaterialContentLoadingProgressBar.kt   |  4 +-
 .../util/ui/NavigationDrawerLayout.kt         |  6 +-
 .../res/drawable/ic_format_strikethrough.xml  |  1 -
 app/src/main/res/layout/activity_main.xml     |  2 +-
 app/src/main/res/layout/layout_history.xml    | 94 +++++++++----------
 .../main/res/layout/preference_vertical.xml   |  3 +
 .../res/layout/setup_account_connection.xml   |  2 +
 .../main/res/layout/setup_account_edit.xml    |  5 +
 .../main/res/layout/setup_account_name.xml    |  1 +
 .../main/res/layout/setup_account_user.xml    |  2 +
 .../res/layout/widget_core_account_add.xml    |  2 +-
 app/src/main/res/layout/widget_nick.xml       |  1 +
 app/src/main/res/layout/widget_nick_away.xml  |  1 +
 app/src/main/res/values-de/strings.xml        |  1 +
 .../main/res/values-de/strings_messages.xml   |  2 +-
 app/src/main/res/values-de/strings_setup.xml  |  4 +-
 app/src/main/res/values/attrs.xml             |  3 +
 app/src/main/res/values/strings.xml           |  3 +-
 app/src/main/res/values/styles_widgets.xml    | 18 ++++
 .../de/kuschku/libquassel/protocol/QTypes.kt  |  2 +-
 .../libquassel/quassel/syncables/IrcUser.kt   |  8 --
 .../libquassel/quassel/syncables/Network.kt   | 32 +++----
 .../syncables/interfaces/invokers/Invokers.kt |  2 +-
 .../kuschku/libquassel/session/SignalProxy.kt |  4 +-
 malheur/build.gradle.kts                      |  2 +-
 .../kuschku/malheur/collectors/Collector.kt   | 13 +--
 persistence/src/main/AndroidManifest.xml      |  2 +-
 .../persistence/QuasselDatabase.kt            | 36 +------
 slidingpanel/src/main/AndroidManifest.xml     |  2 +-
 .../slidinguppanel/SlidingUpPanelLayout.java  | 22 +++--
 .../src/main/res/drawable/above_shadow.xml    |  2 +-
 .../src/main/res/drawable/below_shadow.xml    |  2 +-
 46 files changed, 205 insertions(+), 216 deletions(-)

diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 5f394079e..fc09650aa 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -49,6 +49,8 @@ android {
 
     setProperty("archivesBaseName", "QuasselDroidNG-$versionName")
 
+    multiDexEnabled = false
+
     // Disable test runner analytics
     testInstrumentationRunnerArguments = mapOf(
       "disableAnalytics" to "true"
@@ -80,6 +82,10 @@ android {
       )
     }
   }
+
+  lintOptions {
+    disable("ResourceType")
+  }
 }
 
 dependencies {
diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt
index a54b42ca7..1ad188e65 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ToolbarFragment.kt
@@ -81,7 +81,7 @@ class ToolbarFragment : ServiceBoundFragment() {
             this.subtitle = colorizeDescription(data?.description)
           } else {
             val description = colorizeDescription(data?.description)
-            if (description.isNullOrBlank()) {
+            if (description.isBlank()) {
               this.subtitle = "Lag: ${lag}ms"
             } else {
               this.subtitle = SpanFormatter.format(
@@ -101,5 +101,4 @@ class ToolbarFragment : ServiceBoundFragment() {
   private fun colorizeDescription(description: String?) = ircFormatDeserializer.formatString(
     requireContext(), description, appearanceSettings.colorizeMirc
   )
-                                                          ?: description
 }
\ No newline at end of file
diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/FormatHandler.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/FormatHandler.kt
index bce5465b2..770e01905 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/FormatHandler.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/input/FormatHandler.kt
@@ -88,9 +88,9 @@ class FormatHandler(
       return
 
     val exists = editText.text.removeSpans<UnderlineSpan, IrcUnderlineSpan>(range) { span ->
-      when {
-        span is IrcUnderlineSpan -> span
-        else                     -> IrcUnderlineSpan()
+      when (span) {
+        is IrcUnderlineSpan -> span
+        else                -> IrcUnderlineSpan()
       }
     }
 
@@ -106,9 +106,9 @@ class FormatHandler(
       return
 
     val exists = editText.text.removeSpans<StrikethroughSpan, IrcStrikethroughSpan>(range) { span ->
-      when {
-        span is IrcStrikethroughSpan -> span
-        else                         -> IrcStrikethroughSpan()
+      when (span) {
+        is IrcStrikethroughSpan -> span
+        else                    -> IrcStrikethroughSpan()
       }
     }
 
diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt
index dc9ae4214..4090fe00a 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListAdapter.kt
@@ -82,7 +82,7 @@ class NickListAdapter(
   }
 
   companion object {
-    val VIEWTYPE_ACTIVE = 0
-    val VIEWTYPE_AWAY = 1
+    const val VIEWTYPE_ACTIVE = 0
+    const val VIEWTYPE_AWAY = 1
   }
 }
\ No newline at end of file
diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt
index 864ce9f86..ee6e7bd9d 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/ui/setup/SetupActivity.kt
@@ -54,7 +54,7 @@ abstract class SetupActivity : DaggerAppCompatActivity() {
     override fun onPageSelected(position: Int) = Unit
   }
 
-  private val pageChangeListener = SetupActivityViewPagerPageChangeListener(this)
+  private lateinit var pageChangeListener: SetupActivityViewPagerPageChangeListener
 
   private fun pageChanged() {
     currentPage.value = adapter.getItem(viewPager.currentItem)
@@ -84,6 +84,8 @@ abstract class SetupActivity : DaggerAppCompatActivity() {
     fragments.forEach(adapter::addFragment)
     viewPager.adapter = adapter
 
+    pageChangeListener = SetupActivityViewPagerPageChangeListener(this)
+
     button.setOnClickListener {
       if (viewPager.currentItem == adapter.totalCount - 1)
         onDoneInternal()
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt b/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt
index 29b9039c1..4e27ecfd9 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt
@@ -83,7 +83,7 @@ class QuasseldroidNotificationManager(private val context: Context) {
   }
 
   companion object {
-    val BACKGROUND_NOTIFICATION_ID = Int.MAX_VALUE
+    const val BACKGROUND_NOTIFICATION_ID = Int.MAX_VALUE
   }
 
   data class Handle(
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt
index 92b6c78b9..a0bf3ecce 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/backport/ReadableWrappedChannel.kt
@@ -61,6 +61,6 @@ class ReadableWrappedChannel(
   override fun implCloseChannel() = backingStream.close()
 
   companion object {
-    private val PAGE_SIZE = 8192
+    private const val PAGE_SIZE = 8192
   }
 }
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt b/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt
index e326508e8..091db6ab6 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/backport/WritableWrappedChannel.kt
@@ -48,6 +48,6 @@ class WritableWrappedChannel(
   override fun implCloseChannel() = backingStream.close()
 
   companion object {
-    private val PAGE_SIZE = 8192
+    private const val PAGE_SIZE = 8192
   }
 }
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt
index 974c257c2..cb1fdb818 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/helper/SpannedHelper.kt
@@ -28,7 +28,7 @@ private class DelimitedRangesSequence(
             nextSearchIndex = -1
           } else {
             val (index, length) = match
-            nextItem = currentStartIndex..index - 1
+            nextItem = currentStartIndex until index
             currentStartIndex = index + length
             nextSearchIndex = currentStartIndex + if (length == 0) 1 else 0
           }
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt
index 5c73885da..8b36cb6c8 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatDeserializer.kt
@@ -96,12 +96,12 @@ class IrcFormatDeserializer @Inject constructor() {
           normalCount = 0
 
           // If there is an element on stack with the same code, close it
-          if (bold != null) {
+          bold = if (bold != null) {
             if (colorize) bold.apply(plainText, plainText.length)
-            bold = null
+            null
             // Otherwise create a new one
           } else {
-            bold = FormatDescription(plainText.length, BoldIrcFormat())
+            FormatDescription(plainText.length, BoldIrcFormat())
           }
         }
         CODE_ITALIC        -> {
@@ -109,12 +109,12 @@ class IrcFormatDeserializer @Inject constructor() {
           normalCount = 0
 
           // If there is an element on stack with the same code, close it
-          if (italic != null) {
+          italic = if (italic != null) {
             if (colorize) italic.apply(plainText, plainText.length)
-            italic = null
+            null
             // Otherwise create a new one
           } else {
-            italic = FormatDescription(plainText.length, ItalicIrcFormat())
+            FormatDescription(plainText.length, ItalicIrcFormat())
           }
         }
         CODE_UNDERLINE     -> {
@@ -122,12 +122,12 @@ class IrcFormatDeserializer @Inject constructor() {
           normalCount = 0
 
           // If there is an element on stack with the same code, close it
-          if (underline != null) {
+          underline = if (underline != null) {
             if (colorize) underline.apply(plainText, plainText.length)
-            underline = null
+            null
             // Otherwise create a new one
           } else {
-            underline = FormatDescription(plainText.length, UnderlineIrcFormat())
+            FormatDescription(plainText.length, UnderlineIrcFormat())
           }
         }
         CODE_STRIKETHROUGH -> {
@@ -135,12 +135,12 @@ class IrcFormatDeserializer @Inject constructor() {
           normalCount = 0
 
           // If there is an element on stack with the same code, close it
-          if (strikethrough != null) {
+          strikethrough = if (strikethrough != null) {
             if (colorize) strikethrough.apply(plainText, plainText.length)
-            strikethrough = null
+            null
             // Otherwise create a new one
           } else {
-            strikethrough = FormatDescription(plainText.length, StrikethroughIrcFormat())
+            FormatDescription(plainText.length, StrikethroughIrcFormat())
           }
         }
         CODE_MONOSPACE     -> {
@@ -148,12 +148,12 @@ class IrcFormatDeserializer @Inject constructor() {
           normalCount = 0
 
           // If there is an element on stack with the same code, close it
-          if (monospace != null) {
+          monospace = if (monospace != null) {
             if (colorize) monospace.apply(plainText, plainText.length)
-            monospace = null
+            null
             // Otherwise create a new one
           } else {
-            monospace = FormatDescription(plainText.length, MonospaceIrcFormat())
+            FormatDescription(plainText.length, MonospaceIrcFormat())
           }
         }
         CODE_COLOR         -> {
@@ -308,7 +308,7 @@ class IrcFormatDeserializer @Inject constructor() {
     fun applyTo(editable: SpannableStringBuilder, from: Int, to: Int)
   }
 
-  private class FormatDescription<U : IrcFormat>(val start: Int, val format: U) {
+  private class FormatDescription<out U : IrcFormat>(val start: Int, val format: U) {
 
     fun apply(editable: SpannableStringBuilder, end: Int) {
       format.applyTo(editable, start, end)
@@ -387,15 +387,15 @@ class IrcFormatDeserializer @Inject constructor() {
   }
 
   companion object {
-    val CODE_BOLD = 0x02.toChar()
-    val CODE_COLOR = 0x03.toChar()
-    val CODE_HEXCOLOR = 0x04.toChar()
-    val CODE_ITALIC = 0x1D.toChar()
-    val CODE_UNDERLINE = 0x1F.toChar()
-    val CODE_STRIKETHROUGH = 0x1E.toChar()
-    val CODE_MONOSPACE = 0x11.toChar()
-    val CODE_SWAP = 0x16.toChar()
-    val CODE_RESET = 0x0F.toChar()
+    private const val CODE_BOLD = 0x02.toChar()
+    private const val CODE_COLOR = 0x03.toChar()
+    private const val CODE_HEXCOLOR = 0x04.toChar()
+    private const val CODE_ITALIC = 0x1D.toChar()
+    private const val CODE_UNDERLINE = 0x1F.toChar()
+    private const val CODE_STRIKETHROUGH = 0x1E.toChar()
+    private const val CODE_MONOSPACE = 0x11.toChar()
+    private const val CODE_SWAP = 0x16.toChar()
+    private const val CODE_RESET = 0x0F.toChar()
 
     /**
      * Try to read a number from a String in specified bounds
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
index 0c316abd7..267659da8 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
@@ -209,14 +209,14 @@ class IrcFormatSerializer @Inject constructor(private val context: Context) {
   }
 
   companion object {
-    val CODE_BOLD: Char = 0x02.toChar()
-    val CODE_COLOR: Char = 0x03.toChar()
-    val CODE_HEXCOLOR = 0x04.toChar()
-    val CODE_ITALIC: Char = 0x1D.toChar()
-    val CODE_UNDERLINE: Char = 0x1F.toChar()
-    val CODE_STRIKETHROUGH = 0x1E.toChar()
-    val CODE_MONOSPACE = 0x11.toChar()
-    val CODE_SWAP: Char = 0x16.toChar()
-    val CODE_RESET: Char = 0x0F.toChar()
+    private const val CODE_BOLD: Char = 0x02.toChar()
+    private const val CODE_COLOR: Char = 0x03.toChar()
+    private const val CODE_HEXCOLOR = 0x04.toChar()
+    private const val CODE_ITALIC: Char = 0x1D.toChar()
+    private const val CODE_UNDERLINE: Char = 0x1F.toChar()
+    private const val CODE_STRIKETHROUGH = 0x1E.toChar()
+    private const val CODE_MONOSPACE = 0x11.toChar()
+    private const val CODE_SWAP: Char = 0x16.toChar()
+    private const val CODE_RESET: Char = 0x0F.toChar()
   }
 }
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/quassel/IrcUserUtils.kt b/app/src/main/java/de/kuschku/quasseldroid/util/quassel/IrcUserUtils.kt
index 301198838..403c63523 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/quassel/IrcUserUtils.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/quassel/IrcUserUtils.kt
@@ -39,19 +39,19 @@ object IrcUserUtils {
                                 startIndex: Int? = null,
                                 ignoreCase: Boolean = false): Int? {
     val lastIndex = indexOf(char, startIndex ?: 0, ignoreCase)
-    if (lastIndex < 0)
-      return null
+    return if (lastIndex < 0)
+      null
     else
-      return lastIndex
+      lastIndex
   }
 
   private fun String.lastIndex(char: Char,
                                startIndex: Int? = null,
-                               ignoreCase: Boolean = false): Int? {
-    val lastIndex = lastIndexOf(char, startIndex ?: lastIndex, ignoreCase)
-    if (lastIndex < 0)
-      return null
-    else
-      return lastIndex
-  }
+                               ignoreCase: Boolean = false): Int? =
+    lastIndexOf(char, startIndex ?: lastIndex, ignoreCase).let { lastIndex ->
+      if (lastIndex < 0)
+        null
+      else
+        lastIndex
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt
index ebcc0969d..9d6e12420 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ContextThemeWrapper.kt
@@ -16,7 +16,7 @@ import de.kuschku.quasseldroid.R
  *
  * @hide
  */
-class ContextThemeWrapper : ContextWrapper {
+open class ContextThemeWrapper : ContextWrapper {
   var themeResId: Int = 0
     private set
   private var mTheme: Resources.Theme? = null
@@ -70,10 +70,6 @@ class ContextThemeWrapper : ContextWrapper {
     mTheme = theme
   }
 
-  override fun attachBaseContext(newBase: Context) {
-    super.attachBaseContext(newBase)
-  }
-
   /**
    * Call to set an "override configuration" on this context -- this is
    * a configuration that replies one or more values of the standard
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/DrawerRecyclerView.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/DrawerRecyclerView.kt
index 9aa7ca95e..c80c03883 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/DrawerRecyclerView.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/ui/DrawerRecyclerView.kt
@@ -22,10 +22,10 @@ class DrawerRecyclerView @JvmOverloads constructor(
   init {
     val a = context.obtainStyledAttributes(
       attrs,
-      R.styleable.ScrimInsetsFrameLayout, defStyleAttr,
-      R.style.Widget_Design_ScrimInsetsFrameLayout
+      R.styleable.DrawerRecyclerView, defStyleAttr,
+      R.style.Widget_DrawerRecyclerView
     )
-    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground)
+    mInsetForeground = a.getDrawable(R.styleable.DrawerRecyclerView_insetBackground)
     a.recycle()
     setWillNotDraw(true) // No need to draw until the insets are adjusted
     ViewCompat.setOnApplyWindowInsetsListener(
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/MaterialContentLoadingProgressBar.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/MaterialContentLoadingProgressBar.kt
index e9324978e..6856596c4 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/MaterialContentLoadingProgressBar.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/ui/MaterialContentLoadingProgressBar.kt
@@ -105,7 +105,7 @@ class MaterialContentLoadingProgressBar @JvmOverloads constructor(context: Conte
   }
 
   companion object {
-    private val MIN_SHOW_TIME = 500 // ms
-    private val MIN_DELAY = 500 // ms
+    private const val MIN_SHOW_TIME = 500 // ms
+    private const val MIN_DELAY = 500 // ms
   }
 }
diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/NavigationDrawerLayout.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/NavigationDrawerLayout.kt
index 09f3d52a9..dd86776bc 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/NavigationDrawerLayout.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/ui/NavigationDrawerLayout.kt
@@ -37,10 +37,10 @@ class NavigationDrawerLayout @JvmOverloads constructor(
   init {
     val a = context.obtainStyledAttributes(
       attrs,
-      R.styleable.ScrimInsetsFrameLayout, defStyleAttr,
-      R.style.Widget_Design_ScrimInsetsFrameLayout
+      R.styleable.NavigationDrawerLayout, defStyleAttr,
+      R.style.Widget_NavigationDrawerLayout
     )
-    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground)
+    mInsetForeground = a.getDrawable(R.styleable.NavigationDrawerLayout_insetBackground)
     a.recycle()
     setWillNotDraw(true) // No need to draw until the insets are adjusted
     ViewCompat.setOnApplyWindowInsetsListener(
diff --git a/app/src/main/res/drawable/ic_format_strikethrough.xml b/app/src/main/res/drawable/ic_format_strikethrough.xml
index 4a9ace4d4..24c1282a4 100644
--- a/app/src/main/res/drawable/ic_format_strikethrough.xml
+++ b/app/src/main/res/drawable/ic_format_strikethrough.xml
@@ -1,4 +1,3 @@
-<!-- drawable/format_strikethrough_variant.xml -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
   android:width="24dp"
   android:height="24dp"
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 3db33f9dc..e786a8756 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,7 +22,7 @@
     android:layout_gravity="start"
     android:background="?attr/colorBackground"
     android:fitsSystemWindows="true"
-    app:insetForeground="?attr/colorPrimaryDark">
+    app:insetBackground="?attr/colorPrimaryDark">
 
     <fragment
       android:id="@+id/fragment_chat_list"
diff --git a/app/src/main/res/layout/layout_history.xml b/app/src/main/res/layout/layout_history.xml
index 7a07fa7dd..e42496899 100644
--- a/app/src/main/res/layout/layout_history.xml
+++ b/app/src/main/res/layout/layout_history.xml
@@ -1,63 +1,57 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:id="@+id/card_panel"
+  style="?attr/cardStyle"
   android:layout_width="fill_parent"
-  android:layout_height="fill_parent">
-
-  <android.support.v7.widget.CardView
-    style="?attr/cardStyle"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:layout_marginBottom="16dp"
-    android:layout_marginLeft="16dp"
-    android:layout_marginRight="16dp"
-    android:layout_marginTop="16dp"
-    app:cardBackgroundColor="?attr/colorBackgroundCard">
+  android:layout_height="fill_parent"
+  android:layout_marginBottom="16dp"
+  android:layout_marginLeft="16dp"
+  android:layout_marginRight="16dp"
+  android:layout_marginTop="16dp"
+  app:cardBackgroundColor="?attr/colorBackgroundCard">
+
+  <LinearLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
 
     <LinearLayout
       android:layout_width="match_parent"
-      android:layout_height="match_parent"
-      android:orientation="vertical">
-
-      <LinearLayout
-        android:layout_width="match_parent"
+      android:layout_height="48dp"
+      android:orientation="horizontal">
+
+      <TextView
+        android:layout_width="0dip"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_vertical|fill_horizontal"
+        android:paddingLeft="16dp"
+        android:paddingRight="16dp"
+        android:text="@string/label_input_history"
+        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
+        android:textColor="?attr/colorForegroundSecondary" />
+
+      <android.support.v7.widget.AppCompatImageView
+        android:id="@+id/close"
+        android:layout_width="48dp"
         android:layout_height="48dp"
-        android:orientation="horizontal">
-
-        <TextView
-          android:layout_width="0dip"
-          android:layout_height="match_parent"
-          android:layout_weight="1"
-          android:gravity="center_vertical|fill_horizontal"
-          android:paddingLeft="16dp"
-          android:paddingRight="16dp"
-          android:text="@string/label_input_history"
-          android:textAppearance="@style/TextAppearance.AppCompat.Body2"
-          android:textColor="?attr/colorForegroundSecondary" />
-
-        <android.support.v7.widget.AppCompatImageView
-          android:id="@+id/send"
-          android:layout_width="48dp"
-          android:layout_height="48dp"
-          android:layout_gravity="top"
-          android:background="?attr/selectableItemBackgroundBorderless"
-          android:padding="12dp"
-          android:scaleType="fitXY"
-          app:tint="?attr/colorForegroundSecondary"
-          app:srcCompat="@drawable/ic_close" />
-
-      </LinearLayout>
-
-      <android.support.v7.widget.RecyclerView
-        android:id="@+id/msg_history"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        tools:listitem="@layout/widget_history_message" />
+        android:layout_gravity="top"
+        android:background="?attr/selectableItemBackgroundBorderless"
+        android:padding="12dp"
+        android:scaleType="fitXY"
+        app:srcCompat="@drawable/ic_close"
+        app:tint="?attr/colorForegroundSecondary" />
 
     </LinearLayout>
 
-  </android.support.v7.widget.CardView>
+    <android.support.v7.widget.RecyclerView
+      android:id="@+id/msg_history"
+      android:layout_width="fill_parent"
+      android:layout_height="fill_parent"
+      tools:listitem="@layout/widget_history_message" />
+
+  </LinearLayout>
 
-</FrameLayout>
\ No newline at end of file
+</android.support.v7.widget.CardView>
\ No newline at end of file
diff --git a/app/src/main/res/layout/preference_vertical.xml b/app/src/main/res/layout/preference_vertical.xml
index f2bd7b80d..3799ea31b 100644
--- a/app/src/main/res/layout/preference_vertical.xml
+++ b/app/src/main/res/layout/preference_vertical.xml
@@ -26,6 +26,7 @@
   android:paddingEnd="?android:attr/listPreferredItemPaddingRight"
   android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
   android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+  android:baselineAligned="false"
   android:paddingStart="?android:attr/listPreferredItemPaddingLeft">
 
   <FrameLayout
@@ -38,6 +39,8 @@
     android:minWidth="60dp"
     android:orientation="horizontal"
     android:paddingBottom="4dp"
+    android:paddingLeft="0dp"
+    android:paddingStart="0dp"
     android:paddingEnd="12dp"
     android:paddingRight="12dp"
     android:paddingTop="4dp">
diff --git a/app/src/main/res/layout/setup_account_connection.xml b/app/src/main/res/layout/setup_account_connection.xml
index 328f2cb32..d19300717 100644
--- a/app/src/main/res/layout/setup_account_connection.xml
+++ b/app/src/main/res/layout/setup_account_connection.xml
@@ -18,6 +18,7 @@
       android:id="@+id/host"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
+      android:hint="@string/label_connection_host"
       android:inputType="textUri" />
   </android.support.design.widget.TextInputLayout>
 
@@ -33,6 +34,7 @@
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:inputType="number"
+      android:hint="@string/labelConnectionPort"
       android:text="@string/defaultConnectionPort" />
   </android.support.design.widget.TextInputLayout>
 
diff --git a/app/src/main/res/layout/setup_account_edit.xml b/app/src/main/res/layout/setup_account_edit.xml
index b95d98987..471051625 100644
--- a/app/src/main/res/layout/setup_account_edit.xml
+++ b/app/src/main/res/layout/setup_account_edit.xml
@@ -43,6 +43,7 @@
           android:id="@+id/name"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
+          android:hint="@string/label_account_name"
           android:inputType="text" />
       </android.support.design.widget.TextInputLayout>
     </LinearLayout>
@@ -86,6 +87,7 @@
             android:id="@+id/host"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:hint="@string/label_connection_host"
             android:inputType="textUri" />
         </android.support.design.widget.TextInputLayout>
 
@@ -105,6 +107,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:inputType="number"
+            android:hint="@string/labelConnectionPort"
             android:text="@string/defaultConnectionPort" />
         </android.support.design.widget.TextInputLayout>
       </LinearLayout>
@@ -150,6 +153,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:inputType="textVisiblePassword|textNoSuggestions"
+            android:hint="@string/label_account_user"
             app:errorEnabled="true" />
         </android.support.design.widget.TextInputLayout>
 
@@ -165,6 +169,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:inputType="textPassword"
+            android:hint="@string/label_account_pass"
             app:errorEnabled="true" />
         </android.support.design.widget.TextInputLayout>
 
diff --git a/app/src/main/res/layout/setup_account_name.xml b/app/src/main/res/layout/setup_account_name.xml
index 7321ec065..4b027e387 100644
--- a/app/src/main/res/layout/setup_account_name.xml
+++ b/app/src/main/res/layout/setup_account_name.xml
@@ -16,6 +16,7 @@
       android:id="@+id/name"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
+      android:hint="@string/label_account_name"
       android:inputType="text" />
   </android.support.design.widget.TextInputLayout>
 
diff --git a/app/src/main/res/layout/setup_account_user.xml b/app/src/main/res/layout/setup_account_user.xml
index 60214fa1d..0ca50d271 100644
--- a/app/src/main/res/layout/setup_account_user.xml
+++ b/app/src/main/res/layout/setup_account_user.xml
@@ -16,6 +16,7 @@
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:inputType="textVisiblePassword|textNoSuggestions"
+      android:hint="@string/label_account_user"
       app:errorEnabled="true" />
   </android.support.design.widget.TextInputLayout>
 
@@ -31,6 +32,7 @@
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:inputType="textPassword"
+      android:hint="@string/label_account_pass"
       app:errorEnabled="true" />
   </android.support.design.widget.TextInputLayout>
 
diff --git a/app/src/main/res/layout/widget_core_account_add.xml b/app/src/main/res/layout/widget_core_account_add.xml
index f6c839109..295b1679c 100644
--- a/app/src/main/res/layout/widget_core_account_add.xml
+++ b/app/src/main/res/layout/widget_core_account_add.xml
@@ -31,6 +31,6 @@
     android:fontFamily="sans-serif-medium"
     android:lines="1"
     android:singleLine="true"
-    android:text="New Account"
+    android:text="@string/label_new_account"
     android:textSize="14sp" />
 </LinearLayout>
diff --git a/app/src/main/res/layout/widget_nick.xml b/app/src/main/res/layout/widget_nick.xml
index 91a35f4a4..b54a3aeda 100644
--- a/app/src/main/res/layout/widget_nick.xml
+++ b/app/src/main/res/layout/widget_nick.xml
@@ -10,6 +10,7 @@
   android:paddingEnd="?listPreferredItemPaddingRight"
   android:paddingLeft="?listPreferredItemPaddingLeft"
   android:paddingRight="?listPreferredItemPaddingRight"
+  android:baselineAligned="false"
   android:paddingStart="?listPreferredItemPaddingLeft">
 
   <FrameLayout
diff --git a/app/src/main/res/layout/widget_nick_away.xml b/app/src/main/res/layout/widget_nick_away.xml
index 29837a9bc..276583648 100644
--- a/app/src/main/res/layout/widget_nick_away.xml
+++ b/app/src/main/res/layout/widget_nick_away.xml
@@ -10,6 +10,7 @@
   android:paddingEnd="?listPreferredItemPaddingRight"
   android:paddingLeft="?listPreferredItemPaddingLeft"
   android:paddingRight="?listPreferredItemPaddingRight"
+  android:baselineAligned="false"
   android:paddingStart="?listPreferredItemPaddingLeft">
 
   <FrameLayout
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 05a6f9bc4..a5f74cb0d 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -26,6 +26,7 @@
   <string name="label_join">Verbinden</string>
   <string name="label_libraries">Bibliotheken</string>
   <string name="label_license">Lizenz</string>
+  <string name="label_new_account">Account hinzufügen</string>
   <string name="label_no">Nein</string>
   <string name="label_open">Öffnen</string>
   <string name="label_part">Verlassen</string>
diff --git a/app/src/main/res/values-de/strings_messages.xml b/app/src/main/res/values-de/strings_messages.xml
index aa54ae050..d18185b5f 100644
--- a/app/src/main/res/values-de/strings_messages.xml
+++ b/app/src/main/res/values-de/strings_messages.xml
@@ -13,7 +13,7 @@
   <string name="message_format_action">* %1$s%2$s %3$s</string>
   <string name="message_format_notice">[%1$s%2$s] %3$s</string>
   <string name="message_format_nick">%1$s%2$s heißt jetzt %3$s%4$s</string>
-  <string name="message_format_nick_self">Du heißt jetzt justJanne</string>
+  <string name="message_format_nick_self">Du heißt jetzt %1$s%2$s</string>
   <string name="message_format_mode">Modus %1$s durch %2$s%3$s</string>
   <string name="message_format_join">%1$s%2$s hat %3$s betreten</string>
   <string name="message_format_part_1">%1$s%2$s hat den Kanal verlassen</string>
diff --git a/app/src/main/res/values-de/strings_setup.xml b/app/src/main/res/values-de/strings_setup.xml
index e24e3a95c..b63b2ef92 100644
--- a/app/src/main/res/values-de/strings_setup.xml
+++ b/app/src/main/res/values-de/strings_setup.xml
@@ -3,11 +3,11 @@
   <!-- Account Selection -->
   <string name="slide_account_select_title">Account Auswählen</string>
   <string name="slide_account_select_description">Wähle einen Account aus oder erstelle einen neuen</string>
-  <string name="label_user_on_host">%1$s @ %2$s:%3$s</string>
+  <string name="label_user_on_host">%1$s auf %2$s:%3$d</string>
 
   <!-- Account Connection -->
   <string name="slide_account_connection_title">Verbindung</string>
-  <string name="slideAccountConnectionDescription">Bitte gebe an die Addresse des Servers an, auf dem dein Core läuft</string>
+  <string name="slideAccountConnectionDescription">Bitte gebe an die Adresse des Servers an, auf dem dein Core läuft</string>
 
   <string name="label_connection_host">Hostname</string>
   <string name="labelConnectionPort">Port</string>
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index b31f5bb0b..123ee8f5d 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -158,4 +158,7 @@
 
   <!-- Menu Items -->
   <attr name="backgroundMenuItem" format="reference" />
+
+  <!-- InsetLayouts -->
+  <attr name="insetBackground" format="color|reference" />
 </resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a25b5e071..5968a73c7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -26,6 +26,7 @@
   <string name="label_join">Join</string>
   <string name="label_libraries">Libraries</string>
   <string name="label_license">License</string>
+  <string name="label_new_account">New Account</string>
   <string name="label_no">No</string>
   <string name="label_open">Open</string>
   <string name="label_part">Part</string>
@@ -35,7 +36,7 @@
   <string name="label_select_multiple">Select</string>
   <string name="label_settings">Settings</string>
   <string name="label_share">Share</string>
-  <string name="label_share_crashreport">Share Crashreport</string>
+  <string name="label_share_crashreport">Share Crash Report</string>
   <string name="label_show_hidden">Show Hidden</string>
   <string name="label_unhide">Make Visible</string>
   <string name="label_website">Website</string>
diff --git a/app/src/main/res/values/styles_widgets.xml b/app/src/main/res/values/styles_widgets.xml
index 2524553dd..831104e6f 100644
--- a/app/src/main/res/values/styles_widgets.xml
+++ b/app/src/main/res/values/styles_widgets.xml
@@ -56,4 +56,22 @@
   <style name="Widget.DialogTheme" parent="Theme.AppCompat.Dialog.Alert" />
 
   <style name="Widget.DialogTheme.Light" parent="Theme.AppCompat.Light.Dialog.Alert" />
+
+  <!-- NavigationDrawerLayout -->
+  <declare-styleable name="NavigationDrawerLayout">
+    <attr name="insetBackground" />
+  </declare-styleable>
+
+  <style name="Widget.NavigationDrawerLayout" parent="">
+    <item name="insetBackground">#4000</item>
+  </style>
+
+  <!-- DrawerRecyclerView -->
+  <declare-styleable name="DrawerRecyclerView">
+    <attr name="insetBackground" />
+  </declare-styleable>
+
+  <style name="Widget.DrawerRecyclerView" parent="">
+    <item name="insetBackground">#4000</item>
+  </style>
 </resources>
diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt
index 090db4833..a40e2a8f2 100644
--- a/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt
+++ b/lib/src/main/java/de/kuschku/libquassel/protocol/QTypes.kt
@@ -55,7 +55,7 @@ fun QVariantList.toVariantMap(): QVariantMap {
   while (i < size) {
     val key = get(i).value<ByteBuffer?>().deserializeString(StringSerializer.UTF8) ?: ""
     val value = get(i + 1)
-    map.put(key, value)
+    map[key] = value
     i += 2
   }
   return map
diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt
index ee9a6d515..de37e29f9 100644
--- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt
+++ b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/IrcUser.kt
@@ -261,14 +261,6 @@ class IrcUser(
     proxy.stopSynchronize(this)
   }
 
-  override fun addUserModes(modes: String) {
-    super.addUserModes(modes)
-  }
-
-  override fun removeUserModes(modes: String) {
-    super.removeUserModes(modes)
-  }
-
   fun updateObjectName() {
     val identifier = "${network().networkId()}/${nick()}"
     renameObject(identifier)
diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt
index a4649b299..b9fbab55a 100644
--- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt
+++ b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/Network.kt
@@ -349,24 +349,24 @@ class Network constructor(
 
   fun ircUsers() = _ircUsers.values.toList()
   fun ircUserCount(): UInt = _ircUsers.size
-  fun newIrcChannel(channelName: String, initData: QVariantMap = emptyMap()): IrcChannel {
-    val channel = ircChannel(channelName)
-    if (channel == null) {
-      val ircChannel = IrcChannel(channelName, this, proxy)
-      ircChannel.init()
-      if (initData.isNotEmpty()) {
-        ircChannel.fromVariantMap(initData)
-        ircChannel.initialized = true
+  fun newIrcChannel(channelName: String, initData: QVariantMap = emptyMap()): IrcChannel =
+    ircChannel(channelName).let { channel ->
+      return if (channel == null) {
+        val ircChannel = IrcChannel(channelName, this, proxy)
+        ircChannel.init()
+        if (initData.isNotEmpty()) {
+          ircChannel.fromVariantMap(initData)
+          ircChannel.initialized = true
+        }
+        proxy.synchronize(ircChannel)
+        _ircChannels[caseMapper.toLowerCase(channelName)] = ircChannel
+        live_ircChannels.onNext(_ircChannels)
+        super.addIrcChannel(channelName)
+        ircChannel
+      } else {
+        channel
       }
-      proxy.synchronize(ircChannel)
-      _ircChannels[caseMapper.toLowerCase(channelName)] = ircChannel
-      live_ircChannels.onNext(_ircChannels)
-      super.addIrcChannel(channelName)
-      return ircChannel
-    } else {
-      return channel
     }
-  }
 
   fun ircChannel(channelName: String?) = _ircChannels[channelName?.let(caseMapper::toLowerCase)]
   fun liveIrcChannel(channelName: String?) = live_ircChannels.map {
diff --git a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt
index 23a6d7d5c..10c951642 100644
--- a/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt
+++ b/lib/src/main/java/de/kuschku/libquassel/quassel/syncables/interfaces/invokers/Invokers.kt
@@ -68,6 +68,6 @@ object Invokers {
 
   private fun <T> register(invoker: Invoker<T>?) {
     if (invoker != null)
-      registry.put(invoker.className, invoker)
+      registry[invoker.className] = invoker
   }
 }
diff --git a/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt b/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt
index bb83b858d..474d326d9 100644
--- a/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt
+++ b/lib/src/main/java/de/kuschku/libquassel/session/SignalProxy.kt
@@ -54,8 +54,8 @@ interface SignalProxy {
       override fun callRpc(slot: String, params: List<QVariant_>) = Unit
       override fun shouldSync(type: String, instance: String, slot: String) = false
       override fun shouldRpc(slot: String) = false
-      override fun network(id: NetworkId) = null
-      override fun identity(id: IdentityId) = null
+      override fun network(id: NetworkId): Network? = null
+      override fun identity(id: IdentityId): Identity? = null
       override fun renameObject(syncableObject: ISyncableObject, newName: String,
                                 oldName: String) = Unit
 
diff --git a/malheur/build.gradle.kts b/malheur/build.gradle.kts
index ae8c59536..f68dd89d1 100644
--- a/malheur/build.gradle.kts
+++ b/malheur/build.gradle.kts
@@ -9,7 +9,7 @@ android {
   buildToolsVersion("27.0.3")
 
   defaultConfig {
-    minSdkVersion(9)
+    minSdkVersion(14)
     targetSdkVersion(27)
 
     consumerProguardFiles("proguard-rules.pro")
diff --git a/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt b/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt
index a6720d1bb..2128357d7 100644
--- a/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt
+++ b/malheur/src/main/java/de/kuschku/malheur/collectors/Collector.kt
@@ -2,19 +2,14 @@ package de.kuschku.malheur.collectors
 
 import de.kuschku.malheur.CrashContext
 
-interface Collector<out DataType, ConfigType> {
+interface Collector<out DataType, in ConfigType> {
   fun collect(context: CrashContext, config: ConfigType): DataType?
 }
 
 inline fun <DataType, ConfigType> Collector<DataType, ConfigType>.collectIf(
   context: CrashContext,
   config: ConfigType?
-) = if (config != null)
-  collect(context, config)
-else
-  null
+) = if (config != null) collect(context, config) else null
 
-inline fun <DataType> collectIf(enabled: Boolean, closure: () -> DataType?) = if (enabled)
-  closure()
-else
-  null
+inline fun <DataType> collectIf(enabled: Boolean, closure: () -> DataType?) =
+  if (enabled) closure() else null
diff --git a/persistence/src/main/AndroidManifest.xml b/persistence/src/main/AndroidManifest.xml
index e20834273..96a12a1ab 100644
--- a/persistence/src/main/AndroidManifest.xml
+++ b/persistence/src/main/AndroidManifest.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest package="de.kuschku.quasseldroid.persistence"></manifest>
+<manifest package="de.kuschku.quasseldroid.persistence" />
diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt
index ee90f8462..056b8bc66 100644
--- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt
+++ b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt
@@ -207,39 +207,5 @@ FROM
     WHERE bufferId = ?
           AND type & ~? > 0
   ) t
-ORDER BY time, messageId DESC
-  """, arrayOf(bufferId, type, bufferId, bufferId, type)))
-
-fun QuasselDatabase.MessageDao.findByBufferIdWithDayChange(bufferId: Int, type: Int) =
-  this.findMessagesRaw(SimpleSQLiteQuery("""
-SELECT t.*
-FROM
-  (
-    SELECT
-      messageId,
-      time,
-      type,
-      flag,
-      bufferId,
-      sender,
-      senderPrefixes,
-      content
-    FROM message
-    WHERE bufferId = ?
-          AND type & ~? > 0
-    UNION ALL
-    SELECT DISTINCT
-      strftime('%s', date(datetime(time / 1000, 'unixepoch'))) * -1000 AS messageId,
-      strftime('%s', date(datetime(time / 1000, 'unixepoch'))) * 1000  AS time,
-      8192                                                             AS type,
-      0                                                                AS flag,
-      ?                                                                AS bufferId,
-      ''                                                               AS sender,
-      ''                                                               AS senderPrefixes,
-      ''                                                               AS content
-    FROM message
-    WHERE bufferId = ?
-          AND type & ~? > 0
-  ) t
-ORDER BY time, messageId DESC
+ORDER BY time DESC, messageId DESC
   """, arrayOf(bufferId, type, bufferId, bufferId, type)))
\ No newline at end of file
diff --git a/slidingpanel/src/main/AndroidManifest.xml b/slidingpanel/src/main/AndroidManifest.xml
index e8ac6fcc6..30c18586b 100644
--- a/slidingpanel/src/main/AndroidManifest.xml
+++ b/slidingpanel/src/main/AndroidManifest.xml
@@ -2,4 +2,4 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.sothree.slidinguppanel.library"
   android:versionCode="17"
-  android:versionName="3.4.0"></manifest>
+  android:versionName="3.4.0" />
diff --git a/slidingpanel/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java b/slidingpanel/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
index bc850c0f1..9feba814e 100644
--- a/slidingpanel/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
+++ b/slidingpanel/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
@@ -392,7 +392,6 @@ public class SlidingUpPanelLayout extends ViewGroup {
     if (getPanelState() == PanelState.COLLAPSED) {
       smoothToBottom();
       invalidate();
-      return;
     }
   }
 
@@ -495,7 +494,6 @@ public class SlidingUpPanelLayout extends ViewGroup {
           }
         }
       });
-      ;
     }
   }
 
@@ -733,12 +731,16 @@ public class SlidingUpPanelLayout extends ViewGroup {
       }
 
       int childWidthSpec;
-      if (lp.width == LayoutParams.WRAP_CONTENT) {
-        childWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST);
-      } else if (lp.width == LayoutParams.MATCH_PARENT) {
-        childWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
-      } else {
-        childWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
+      switch (lp.width) {
+        case LayoutParams.WRAP_CONTENT:
+          childWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST);
+          break;
+        case LayoutParams.MATCH_PARENT:
+          childWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
+          break;
+        default:
+          childWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
+          break;
       }
 
       int childHeightSpec;
@@ -1328,14 +1330,14 @@ public class SlidingUpPanelLayout extends ViewGroup {
      * @param panel       The child view that was moved
      * @param slideOffset The new offset of this sliding pane within its range, from 0-1
      */
-    public void onPanelSlide(View panel, float slideOffset);
+    void onPanelSlide(View panel, float slideOffset);
 
     /**
      * Called when a sliding panel state changes
      *
      * @param panel The child view that was slid to an collapsed position
      */
-    public void onPanelStateChanged(View panel, PanelState previousState, PanelState newState);
+    void onPanelStateChanged(View panel, PanelState previousState, PanelState newState);
   }
 
   /**
diff --git a/slidingpanel/src/main/res/drawable/above_shadow.xml b/slidingpanel/src/main/res/drawable/above_shadow.xml
index b51564520..7d0cbe926 100644
--- a/slidingpanel/src/main/res/drawable/above_shadow.xml
+++ b/slidingpanel/src/main/res/drawable/above_shadow.xml
@@ -3,5 +3,5 @@
   <gradient
     android:angle="90"
     android:endColor="@android:color/transparent"
-    android:startColor="#20000000"></gradient>
+    android:startColor="#20000000" />
 </shape>
\ No newline at end of file
diff --git a/slidingpanel/src/main/res/drawable/below_shadow.xml b/slidingpanel/src/main/res/drawable/below_shadow.xml
index fc63fea99..6af78fe1f 100644
--- a/slidingpanel/src/main/res/drawable/below_shadow.xml
+++ b/slidingpanel/src/main/res/drawable/below_shadow.xml
@@ -3,5 +3,5 @@
   <gradient
     android:angle="270"
     android:endColor="@android:color/transparent"
-    android:startColor="#20000000"></gradient>
+    android:startColor="#20000000" />
 </shape>
\ No newline at end of file
-- 
GitLab