From 65a763bebc6d8d9e103810d4f775057758c9821a Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Sat, 7 Apr 2018 00:11:34 +0200
Subject: [PATCH] Minor fixes, updated dependencies

---
 app/build.gradle.kts                          |  6 +--
 .../quasseldroid/settings/MessageSettings.kt  |  5 +-
 .../kuschku/quasseldroid/settings/Settings.kt | 10 ++--
 .../chat/messages/QuasselMessageRenderer.kt   | 51 ++++++++++++++-----
 .../res/values-de/strings_preferences.xml     |  9 ++--
 .../main/res/values/strings_preferences.xml   | 12 +++--
 app/src/main/res/xml/preferences.xml          | 11 ++++
 lib/build.gradle.kts                          |  4 +-
 persistence/build.gradle.kts                  |  8 +--
 slidingpanel/build.gradle.kts                 |  2 +-
 viewmodel/build.gradle.kts                    |  2 +-
 11 files changed, 83 insertions(+), 37 deletions(-)

diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 3ccaf518a..a24943e43 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -92,7 +92,7 @@ dependencies {
   implementation(kotlin("stdlib", "1.2.31"))
 
   // App Compat
-  withVersion("27.1.0") {
+  withVersion("27.1.1") {
     implementation("com.android.support", "appcompat-v7", version)
     implementation("com.android.support", "design", version)
     implementation("com.android.support", "customtabs", version)
@@ -111,7 +111,7 @@ dependencies {
   }
 
   // App Arch Persistence
-  withVersion("1.1.0-beta1") {
+  withVersion("1.1.0-beta2") {
     implementation("android.arch.persistence.room", "runtime", version)
     implementation("android.arch.persistence.room", "rxjava2", version)
     kapt("android.arch.persistence.room", "compiler", version)
@@ -119,7 +119,7 @@ dependencies {
   }
 
   // App Arch Paging
-  implementation("android.arch.paging", "runtime", "1.0.0-alpha7") {
+  implementation("android.arch.paging", "runtime", "1.0.0-beta1") {
     exclude(group = "junit", module = "junit")
   }
 
diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt
index 901c213be..708fbbce8 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt
@@ -8,7 +8,8 @@ data class MessageSettings(
   val textSize: Int = 14,
   val showSeconds: Boolean = false,
   val use24hClock: Boolean = true,
-  val showHostmask: Boolean = false,
+  val showHostmaskActions: Boolean = false,
+  val showHostmaskPlain: Boolean = false,
   val nicksOnNewLine: Boolean = false,
   val timeAtEnd: Boolean = false,
   val showAvatars: Boolean = false
@@ -39,4 +40,4 @@ data class MessageSettings(
   companion object {
     val DEFAULT = MessageSettings()
   }
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt
index 81f11bc05..1ced8c036 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt
@@ -62,9 +62,13 @@ object Settings {
         context.getString(R.string.preference_colorize_mirc_key),
         MessageSettings.DEFAULT.colorizeMirc
       ),
-      showHostmask = getBoolean(
-        context.getString(R.string.preference_hostmask_key),
-        MessageSettings.DEFAULT.showHostmask
+      showHostmaskActions = getBoolean(
+        context.getString(R.string.preference_hostmask_actions_key),
+        MessageSettings.DEFAULT.showHostmaskActions
+      ),
+      showHostmaskPlain = getBoolean(
+        context.getString(R.string.preference_hostmask_plain_key),
+        MessageSettings.DEFAULT.showHostmaskPlain
       ),
       nicksOnNewLine = getBoolean(
         context.getString(R.string.preference_nicks_on_new_line_key),
diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt
index 94aa660bb..0e585f94f 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/QuasselMessageRenderer.kt
@@ -144,7 +144,12 @@ class QuasselMessageRenderer @Inject constructor(
         val nick = SpanFormatter.format(
           "%s%s",
           formatPrefix(message.content.senderPrefixes, highlight),
-          formatNick(message.content.sender, self, highlight, false)
+          formatNick(
+            message.content.sender,
+            self,
+            highlight,
+            messageSettings.showHostmaskPlain && messageSettings.nicksOnNewLine
+          )
         )
         val content = contentFormatter.format(context, message.content.content, highlight)
         val nickName = HostmaskHelper.nick(message.content.sender)
@@ -240,7 +245,7 @@ class QuasselMessageRenderer @Inject constructor(
         combined = SpanFormatter.format(
           context.getString(R.string.message_format_join),
           formatPrefix(message.content.senderPrefixes, highlight),
-          formatNick(message.content.sender, self, highlight, true),
+          formatNick(message.content.sender, self, highlight, messageSettings.showHostmaskActions),
           message.content.content
         ),
         isMarkerLine = message.isMarkerLine,
@@ -254,13 +259,16 @@ class QuasselMessageRenderer @Inject constructor(
           SpanFormatter.format(
             context.getString(R.string.message_format_part_1),
             formatPrefix(message.content.senderPrefixes, highlight),
-            formatNick(message.content.sender, self, highlight, true)
+            formatNick(message.content.sender, self, highlight, messageSettings.showHostmaskActions)
           )
         } else {
           SpanFormatter.format(
             context.getString(R.string.message_format_part_2),
             formatPrefix(message.content.senderPrefixes, highlight),
-            formatNick(message.content.sender, self, highlight, true),
+            formatNick(message.content.sender,
+                       self,
+                       highlight,
+                       messageSettings.showHostmaskActions),
             contentFormatter.format(context, message.content.content, highlight)
           )
         },
@@ -275,13 +283,16 @@ class QuasselMessageRenderer @Inject constructor(
           SpanFormatter.format(
             context.getString(R.string.message_format_quit_1),
             formatPrefix(message.content.senderPrefixes, highlight),
-            formatNick(message.content.sender, self, highlight, true)
+            formatNick(message.content.sender, self, highlight, messageSettings.showHostmaskActions)
           )
         } else {
           SpanFormatter.format(
             context.getString(R.string.message_format_quit_2),
             formatPrefix(message.content.senderPrefixes, highlight),
-            formatNick(message.content.sender, self, highlight, true),
+            formatNick(message.content.sender,
+                       self,
+                       highlight,
+                       messageSettings.showHostmaskActions),
             contentFormatter.format(context, message.content.content, highlight)
           )
         },
@@ -299,14 +310,20 @@ class QuasselMessageRenderer @Inject constructor(
               context.getString(R.string.message_format_kick_1),
               formatNick(user, false, highlight, false),
               formatPrefix(message.content.senderPrefixes, highlight),
-              formatNick(message.content.sender, self, highlight, true)
+              formatNick(message.content.sender,
+                         self,
+                         highlight,
+                         messageSettings.showHostmaskActions)
             )
           } else {
             SpanFormatter.format(
               context.getString(R.string.message_format_kick_2),
               formatNick(user, false, highlight, false),
               formatPrefix(message.content.senderPrefixes, highlight),
-              formatNick(message.content.sender, self, highlight, true),
+              formatNick(message.content.sender,
+                         self,
+                         highlight,
+                         messageSettings.showHostmaskActions),
               contentFormatter.format(context, reason, highlight)
             )
           },
@@ -325,14 +342,20 @@ class QuasselMessageRenderer @Inject constructor(
               context.getString(R.string.message_format_kill_1),
               formatNick(user, false, highlight, false),
               formatPrefix(message.content.senderPrefixes, highlight),
-              formatNick(message.content.sender, self, highlight, true)
+              formatNick(message.content.sender,
+                         self,
+                         highlight,
+                         messageSettings.showHostmaskActions)
             )
           } else {
             SpanFormatter.format(
               context.getString(R.string.message_format_kill_2),
               formatNick(user, false, highlight, false),
               formatPrefix(message.content.senderPrefixes, highlight),
-              formatNick(message.content.sender, self, highlight, true),
+              formatNick(message.content.sender,
+                         self,
+                         highlight,
+                         messageSettings.showHostmaskActions),
               contentFormatter.format(context, reason, highlight)
             )
           },
@@ -406,7 +429,7 @@ class QuasselMessageRenderer @Inject constructor(
           "[%d] %s%s: %s",
           message.content.type,
           formatPrefix(message.content.senderPrefixes, highlight),
-          formatNick(message.content.sender, self, highlight, true),
+          formatNick(message.content.sender, self, highlight, messageSettings.showHostmaskActions),
           message.content.content
         ),
         isMarkerLine = message.isMarkerLine,
@@ -452,11 +475,11 @@ class QuasselMessageRenderer @Inject constructor(
                          highlight: Boolean, showHostmask: Boolean) =
     when (messageSettings.colorizeNicknames) {
       ColorizeNicknamesMode.ALL          ->
-        formatNickImpl(sender, !highlight, messageSettings.showHostmask && showHostmask)
+        formatNickImpl(sender, !highlight, showHostmask)
       ColorizeNicknamesMode.ALL_BUT_MINE ->
-        formatNickImpl(sender, !self && !highlight, messageSettings.showHostmask && showHostmask)
+        formatNickImpl(sender, !self && !highlight, showHostmask)
       ColorizeNicknamesMode.NONE         ->
-        formatNickImpl(sender, false, messageSettings.showHostmask && showHostmask)
+        formatNickImpl(sender, false, showHostmask)
     }
 
   private fun formatPrefix(prefix: String,
diff --git a/app/src/main/res/values-de/strings_preferences.xml b/app/src/main/res/values-de/strings_preferences.xml
index 2f8c6fac9..48b0262f4 100644
--- a/app/src/main/res/values-de/strings_preferences.xml
+++ b/app/src/main/res/values-de/strings_preferences.xml
@@ -43,8 +43,11 @@
   <string name="preference_show_prefix_entry_highest">Höchsten Modus</string>
   <string name="preference_show_prefix_entry_none">Keine</string>
 
-  <string name="preference_hostmask_title">Hostmaske</string>
-  <string name="preference_hostmask_summary">Zeigt die gesame Spitzname!Ident@Host Information an</string>
+  <string name="preference_hostmask_actions_title">Hostmaske</string>
+  <string name="preference_hostmask_actions_summary">Zeigt Ident und Host in Betreten/Verlassen-Nachrichten</string>
+
+  <string name="preference_hostmask_plain_title">Hostmaske</string>
+  <string name="preference_hostmask_plain_summary">Zeigt Ident und Host in normalen Nachrichten</string>
 
   <string name="preference_nicks_on_new_line_title">Separate Spitznamen</string>
   <string name="preference_nicks_on_new_line_summary">Zeigt Spitznamen in einer eigenen Zeile an</string>
@@ -83,4 +86,4 @@
 
   <string name="preference_show_notification_title">Benachrichtigung anzeigen</string>
   <string name="preference_show_notification_summary">Zeigt eine permanente Benachrichtigung an, damit QuasselDroid durchgehend verbunden bleiben kann</string>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/app/src/main/res/values/strings_preferences.xml b/app/src/main/res/values/strings_preferences.xml
index 66e4ee509..43ba210dd 100644
--- a/app/src/main/res/values/strings_preferences.xml
+++ b/app/src/main/res/values/strings_preferences.xml
@@ -99,9 +99,13 @@
     <item>NONE</item>
   </string-array>
 
-  <string name="preference_hostmask_key" translatable="false">hostmask</string>
-  <string name="preference_hostmask_title">Show Hostmask</string>
-  <string name="preference_hostmask_summary">Display the full nick!ident@host in messages</string>
+  <string name="preference_hostmask_actions_key" translatable="false">hostmaskactions_</string>
+  <string name="preference_hostmask_actions_title">Show Hostmask</string>
+  <string name="preference_hostmask_actions_summary">Display the full nick!ident@host in join/part/quit messages</string>
+
+  <string name="preference_hostmask_plain_key" translatable="false">hostmask_plain</string>
+  <string name="preference_hostmask_plain_title">Show Hostmask</string>
+  <string name="preference_hostmask_plain_summary">Display the full nick!ident@host in normal messages</string>
 
   <string name="preference_nicks_on_new_line_key" translatable="false">nicks_on_new_line</string>
   <string name="preference_nicks_on_new_line_title">Separate Nicknames</string>
@@ -151,4 +155,4 @@
   <string name="preference_show_notification_summary">Keeps QuasselDroid always connected by showing a persistent notification</string>
 
   <string name="preference_notification_id_key" translatable="false">notification_id</string>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index f8a241618..be8c74d5f 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -80,6 +80,17 @@
       android:key="@string/preference_show_avatars_key"
       android:title="@string/preference_show_avatars_title" />
 
+    <SwitchPreference
+      android:defaultValue="false"
+      android:dependency="@string/preference_nicks_on_new_line_key"
+      android:key="@string/preference_hostmask_plain_key"
+      android:title="@string/preference_hostmask_plain_title" />
+
+    <SwitchPreference
+      android:defaultValue="false"
+      android:key="@string/preference_hostmask_actions_key"
+      android:title="@string/preference_hostmask_actions_title" />
+
     <SwitchPreference
       android:defaultValue="false"
       android:key="@string/preference_time_at_end_key"
diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts
index 6216e7698..2b649c459 100644
--- a/lib/build.gradle.kts
+++ b/lib/build.gradle.kts
@@ -12,7 +12,7 @@ plugins {
 dependencies {
   implementation(kotlin("stdlib", "1.2.31"))
 
-  withVersion("27.1.0") {
+  withVersion("27.1.1") {
     implementation("com.android.support", "support-annotations", version)
   }
 
@@ -23,4 +23,4 @@ dependencies {
   kapt(project(":invokergenerator"))
 
   testImplementation("junit", "junit", "4.12")
-}
\ No newline at end of file
+}
diff --git a/persistence/build.gradle.kts b/persistence/build.gradle.kts
index 9674a5c20..bb2d425a2 100644
--- a/persistence/build.gradle.kts
+++ b/persistence/build.gradle.kts
@@ -26,12 +26,12 @@ dependencies {
   implementation(kotlin("stdlib", "1.2.31"))
 
   // App Compat
-  withVersion("27.1.0") {
+  withVersion("27.1.1") {
     implementation("com.android.support", "appcompat-v7", version)
   }
 
   // App Arch Persistence
-  withVersion("1.1.0-beta1") {
+  withVersion("1.1.0-beta2") {
     implementation("android.arch.persistence.room", "runtime", version)
     implementation("android.arch.persistence.room", "rxjava2", version)
     kapt("android.arch.persistence.room", "compiler", version)
@@ -39,7 +39,7 @@ dependencies {
   }
 
   // App Arch Paging
-  implementation("android.arch.paging", "runtime", "1.0.0-alpha7") {
+  implementation("android.arch.paging", "runtime", "1.0.0-beta1") {
     exclude(group = "junit", module = "junit")
   }
 
@@ -51,4 +51,4 @@ dependencies {
   implementation(project(":lib")) {
     exclude(group = "org.threeten", module = "threetenbp")
   }
-}
\ No newline at end of file
+}
diff --git a/slidingpanel/build.gradle.kts b/slidingpanel/build.gradle.kts
index 87b8a6972..5ae8da0ff 100644
--- a/slidingpanel/build.gradle.kts
+++ b/slidingpanel/build.gradle.kts
@@ -14,7 +14,7 @@ android {
 
 dependencies {
   // App Compat
-  withVersion("27.1.0") {
+  withVersion("27.1.1") {
     implementation("com.android.support", "support-v4", version)
     implementation("com.android.support", "support-annotations", version)
     implementation("com.android.support", "recyclerview-v7", version)
diff --git a/viewmodel/build.gradle.kts b/viewmodel/build.gradle.kts
index ebb3b5aa6..e3cca5922 100644
--- a/viewmodel/build.gradle.kts
+++ b/viewmodel/build.gradle.kts
@@ -20,7 +20,7 @@ dependencies {
   implementation(kotlin("stdlib", "1.2.31"))
 
   // App Compat
-  withVersion("27.1.0") {
+  withVersion("27.1.1") {
     implementation("com.android.support", "appcompat-v7", version)
   }
 
-- 
GitLab