diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a0d68a412b1dc6092aebc4a3bbf553191f607097..57119ef94983e12cbfa9c24626bd7705ee1abfd2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -146,8 +146,8 @@ dependencies { implementation("com.afollestad.material-dialogs", "core", version) implementation("com.afollestad.material-dialogs", "commons", version) } + implementation("com.mikhaellopez", "circularimageview", "3.0.2") implementation("me.saket", "better-link-movement-method", "2.1.0") - implementation("com.nex3z", "flow-layout", "1.2.2") implementation(project(":slidingpanel")) // Quality Assurance diff --git a/app/sampledata/messages.json b/app/sampledata/messages.json index 6e33c474692c438796bf36b774170de7d323aa6a..f11e6a9bde23ea634c93dc0acc5512916fe517ea 100644 --- a/app/sampledata/messages.json +++ b/app/sampledata/messages.json @@ -5,252 +5,352 @@ { "id": 35465155, "time": "02:51", - "message": "justJanne: https://s3.kuschku.de/releases/quasseldroid-ng/QuasselDroidNG-v0.3.0-197-g8f556b6-release.apk" + "message": "justJanne: https://s3.kuschku.de/releases/quasseldroid-ng/QuasselDroidNG-v0.3.0-197-g8f556b6-release.apk", + "sender": "justJanne", + "content": "https://s3.kuschku.de/releases/quasseldroid-ng/QuasselDroidNG-v0.3.0-197-g8f556b6-release.apk" }, { "id": 35465242, "time": "02:53", - "message": "justJanne: personally, I always use solarized light during the day, and solarized dark during the night" + "message": "justJanne: personally, I always use solarized light during the day, and solarized dark during the night", + "sender": "justJanne", + "content": "personally, I always use solarized light during the day, and solarized dark during the night" }, { "id": 35465311, "time": "02:55", - "message": "captainepoch: are colours being customizable? :S" + "message": "captainepoch: are colours being customizable? :S", + "sender": "captainepoch", + "content": "are colours being customizable? :S" }, { "id": 35465417, "time": "02:57", - "message": "Exterminador: maybe ™" + "message": "Exterminador: maybe ™", + "sender": "Exterminador", + "content": "maybe ™" }, { "id": 35465419, "time": "02:57", - "message": "Exterminador: lol" + "message": "Exterminador: lol", + "sender": "Exterminador", + "content": "lol" }, { "id": 35465428, "time": "02:57", - "message": "justJanne: captainepoch: I tried that in -NG, it’s basically impossible in Android" + "message": "justJanne: captainepoch: I tried that in -NG, it’s basically impossible in Android", + "sender": "justJanne", + "content": "captainepoch: I tried that in -NG, it’s basically impossible in Android" }, { "id": 35465436, "time": "02:57", - "message": "justJanne: if you suggest a theme, I’ll add it, though" + "message": "justJanne: if you suggest a theme, I’ll add it, though", + "sender": "justJanne", + "content": "if you suggest a theme, I’ll add it, though" }, { "id": 35465475, "time": "02:58", - "message": "romibi: good thing then that you can do the impossible :D … (at least it appears like it sometimes)" + "message": "romibi: good thing then that you can do the impossible :D … (at least it appears like it sometimes)", + "sender": "romibi", + "content": "good thing then that you can do the impossible :D … (at least it appears like it sometimes)" }, { "id": 35465477, "time": "02:58", - "message": "romibi: :P" + "message": "romibi: :P", + "sender": "romibi", + "content": ":P" }, { "id": 35465481, "time": "02:58", - "message": "captainepoch: It's not that I appreciate the effort, but I never liked the solarized theme... I could work in one, maybe" + "message": "captainepoch: It's not that I appreciate the effort, but I never liked the solarized theme... I could work in one, maybe", + "sender": "captainepoch", + "content": "It's not that I appreciate the effort, but I never liked the solarized theme... I could work in one, maybe" }, { "id": 35465487, "time": "02:58", - "message": "captainepoch: I use the dark theme in the actual quasseldroid f-droid's build" + "message": "captainepoch: I use the dark theme in the actual quasseldroid f-droid's build", + "sender": "captainepoch", + "content": "I use the dark theme in the actual quasseldroid f-droid's build" }, { "id": 35465490, "time": "02:58", - "message": "captainepoch: I like it" + "message": "captainepoch: I like it", + "sender": "captainepoch", + "content": "I like it" }, { "id": 35465509, "time": "02:58", - "message": "justJanne: captainepoch: look at https://quasseldroid.info/#make_it_yours" + "message": "justJanne: captainepoch: look at https://quasseldroid.info/#make_it_yours", + "sender": "justJanne", + "content": "captainepoch: look at https://quasseldroid.info/#make_it_yours" }, { "id": 35465513, "time": "02:59", - "message": "justJanne: it has more than just one theme already" + "message": "justJanne: it has more than just one theme already", + "sender": "justJanne", + "content": "it has more than just one theme already" }, { "id": 35465563, "time": "03:00", - "message": "captainepoch: the second or the last one are of my liking :)" + "message": "captainepoch: the second or the last one are of my liking :)", + "sender": "captainepoch", + "content": "the second or the last one are of my liking :)" }, { "id": 35465716, "time": "03:03", - "message": "romibi: oh … those are quite new screenshots" + "message": "romibi: oh … those are quite new screenshots", + "sender": "romibi", + "content": "oh … those are quite new screenshots" }, { "id": 35465798, "time": "03:05", - "message": "captainepoch: I installed the new client" + "message": "captainepoch: I installed the new client", + "sender": "captainepoch", + "content": "I installed the new client" }, { "id": 35465800, "time": "03:05", - "message": "captainepoch: Pretty awesome" + "message": "captainepoch: Pretty awesome", + "sender": "captainepoch", + "content": "Pretty awesome" }, { "id": 35466133, "time": "03:13", - "message": "amiconn: justJanne: Late4st build is still showing an empty list...?" + "message": "amiconn: justJanne: Late4st build is still showing an empty list...?", + "sender": "amiconn", + "content": "justJanne: Late4st build is still showing an empty list...?" }, { "id": 35466403, "time": "03:21", - "message": "Exterminador: uninstall and reinstall" + "message": "Exterminador: uninstall and reinstall", + "sender": "Exterminador", + "content": "uninstall and reinstall" }, { "id": 35466407, "time": "03:21", - "message": "Exterminador: I had to do that" + "message": "Exterminador: I had to do that", + "sender": "Exterminador", + "content": "I had to do that" }, { "id": 35466414, "time": "03:21", - "message": "amiconn: eek" + "message": "amiconn: eek", + "sender": "amiconn", + "content": "eek" }, { "id": 35466439, "time": "03:22", - "message": "Exterminador: like justJanne said, it's a test product, don't have migrations in place yet" + "message": "Exterminador: like justJanne said, it's a test product, don't have migrations in place yet", + "sender": "Exterminador", + "content": "like justJanne said, it's a test product, don't have migrations in place yet" }, { "id": 35466544, "time": "03:25", - "message": "amiconn: Deleting data was sufficient." + "message": "amiconn: Deleting data was sufficient.", + "sender": "amiconn", + "content": "Deleting data was sufficient." }, { "id": 35466578, "time": "03:26", - "message": "amiconn: Enter seems to work properly now, thanks :)" + "message": "amiconn: Enter seems to work properly now, thanks :)", + "sender": "amiconn", + "content": "Enter seems to work properly now, thanks :)" }, { "id": 35466616, "time": "03:27", - "message": "amiconn: Unfortunately there's a new bug: in the input box, the top part of full-height letters is cut of" + "message": "amiconn: Unfortunately there's a new bug: in the input box, the top part of full-height letters is cut of", + "sender": "amiconn", + "content": "Unfortunately there's a new bug: in the input box, the top part of full-height letters is cut of" }, { "id": 35466767, "time": "03:34", - "message": "Exterminador: in my soft keyboard, I have the emoji button" + "message": "Exterminador: in my soft keyboard, I have the emoji button", + "sender": "Exterminador", + "content": "in my soft keyboard, I have the emoji button" }, { "id": 35466770, "time": "03:34", - "message": "Exterminador: I have to use the on screen send button" + "message": "Exterminador: I have to use the on screen send button", + "sender": "Exterminador", + "content": "I have to use the on screen send button" }, { "id": 35467009, "time": "03:43", - "message": "Exterminador: justJanne, no pressure on this tho. but can the netsplit message be improved to display the users that have quitted due to the netsplit?" + "message": "Exterminador: justJanne, no pressure on this tho. but can the netsplit message be improved to display the users that have quitted due to the netsplit?", + "sender": "Exterminador", + "content": "justJanne, no pressure on this tho. but can the netsplit message be improved to display the users that have quitted due to the netsplit?" }, { "id": 35467031, "time": "03:43", - "message": "Exterminador: right now we now how many users have splitted but not which" + "message": "Exterminador: right now we now how many users have splitted but not which", + "sender": "Exterminador", + "content": "right now we now how many users have splitted but not which" }, { "id": 35467158, "time": "03:48", - "message": "justJanne: Exterminador: It'll soon have a button to expand the message, at which time it will show all users. Soon." + "message": "justJanne: Exterminador: It'll soon have a button to expand the message, at which time it will show all users. Soon.", + "sender": "justJanne", + "content": "Exterminador: It'll soon have a button to expand the message, at which time it will show all users. Soon." }, { "id": 35467183, "time": "03:49", - "message": "Exterminador: alright!" + "message": "Exterminador: alright!", + "sender": "Exterminador", + "content": "alright!" }, { "id": 35467237, "time": "03:52", - "message": "Exterminador: justJanne: (big) bug. there's one person that have pmed me and isn't appearing in the list. although it appears in other chat app when I connect to the znc" + "message": "Exterminador: justJanne: (big) bug. there's one person that have pmed me and isn't appearing in the list. although it appears in other chat app when I connect to the znc", + "sender": "Exterminador", + "content": "justJanne: (big) bug. there's one person that have pmed me and isn't appearing in the list. although it appears in other chat app when I connect to the znc" }, { "id": 35467394, "time": "03:55", - "message": "Exterminador: wait.." + "message": "Exterminador: wait..", + "sender": "Exterminador", + "content": "wait.." }, { "id": 35467429, "time": "03:56", - "message": "Exterminador: my bad. sorry. :x" + "message": "Exterminador: my bad. sorry. :x", + "sender": "Exterminador", + "content": "my bad. sorry. :x" }, { "id": 35467442, "time": "03:56", - "message": "Exterminador: I was looking in the wrong network" + "message": "Exterminador: I was looking in the wrong network", + "sender": "Exterminador", + "content": "I was looking in the wrong network" }, { "id": 35468622, "time": "04:25", - "message": "justJanne: New version! https://s3.kuschku.de/releases/quasseldroid-ng/QuasselDroidNG-v0.3.0-199-gac691ac-release.apk" + "message": "justJanne: New version! https://s3.kuschku.de/releases/quasseldroid-ng/QuasselDroidNG-v0.3.0-199-gac691ac-release.apk", + "sender": "justJanne", + "content": "New version! https://s3.kuschku.de/releases/quasseldroid-ng/QuasselDroidNG-v0.3.0-199-gac691ac-release.apk" }, { "id": 35468623, "time": "04:25", - "message": "justJanne: New themes! https://quasseldroid.info/#make_it_yours" + "message": "justJanne: New themes! https://quasseldroid.info/#make_it_yours", + "sender": "justJanne", + "content": "New themes! https://quasseldroid.info/#make_it_yours" }, { "id": 35468635, "time": "04:26", - "message": "captainepoch: another release?" + "message": "captainepoch: another release?", + "sender": "captainepoch", + "content": "another release?" }, { "id": 35468637, "time": "04:26", - "message": "captainepoch: leul" + "message": "captainepoch: leul", + "sender": "captainepoch", + "content": "leul" }, { "id": 35468645, "time": "04:26", - "message": "captainepoch: what is the changelog? :|" + "message": "captainepoch: what is the changelog? :|", + "sender": "captainepoch", + "content": "what is the changelog? :|" }, { "id": 35468682, "time": "04:28", - "message": "justJanne: captainepoch: there’s new themes" + "message": "justJanne: captainepoch: there’s new themes", + "sender": "justJanne", + "content": "captainepoch: there’s new themes" }, { "id": 35468684, "time": "04:28", - "message": "justJanne: and some minor bugfixes" + "message": "justJanne: and some minor bugfixes", + "sender": "justJanne", + "content": "and some minor bugfixes" }, { "id": 35468701, "time": "04:28", - "message": "justJanne: captainepoch: this is an alpha – new versions are published every few hours" + "message": "justJanne: captainepoch: this is an alpha – new versions are published every few hours", + "sender": "justJanne", + "content": "captainepoch: this is an alpha – new versions are published every few hours" }, { "id": 35468702, "time": "04:28", - "message": "captainepoch: wou" + "message": "captainepoch: wou", + "sender": "captainepoch", + "content": "wou" }, { "id": 35468705, "time": "04:28", - "message": "justJanne: every time with new features, new bugfixes, and new bugs" + "message": "justJanne: every time with new features, new bugfixes, and new bugs", + "sender": "justJanne", + "content": "every time with new features, new bugfixes, and new bugs" }, { "id": 35468722, "time": "04:28", - "message": "captainepoch: I'd love to contribute to the project but I don't have enough time :(" + "message": "captainepoch: I'd love to contribute to the project but I don't have enough time :(", + "sender": "captainepoch", + "content": "I'd love to contribute to the project but I don't have enough time :(" }, { "id": 35469529, "time": "04:46", - "message": "Exterminador: great! monospace font!" + "message": "Exterminador: great! monospace font!", + "sender": "Exterminador", + "content": "great! monospace font!" }, { "id": 35469533, "time": "04:46", - "message": "Exterminador: xD" + "message": "Exterminador: xD", + "sender": "Exterminador", + "content": "xD" }, { "id": 35469623, "time": "04:49", - "message": "Exterminador: justJanne, auto completion button next! :P" + "message": "Exterminador: justJanne, auto completion button next! :P", + "sender": "Exterminador", + "content": "justJanne, auto completion button next! :P" } ] ] diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt index ac9e48fee5d727a58d71c3caa9bd28d9e870c3b5..7fe62188d295505e5454b862209efa323dbaceaf 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt @@ -10,6 +10,9 @@ class SettingsModule { @Provides fun provideAppearanceSettings(context: Context) = Settings.appearance(context) + @Provides + fun provideMessageSettings(context: Context) = Settings.message(context) + @Provides fun provideAutoCompleteSettings(context: Context) = Settings.autoComplete(context) diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt index 4589a3a95267c4f65bb25b685da48032870af3dc..d259472bca2a58880f437a9e28662760fee3105e 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/settings/AppearanceSettings.kt @@ -4,29 +4,10 @@ import android.support.annotation.StyleRes import de.kuschku.quasseldroid.R data class AppearanceSettings( - val showPrefix: ShowPrefixMode = ShowPrefixMode.HIGHEST, - val colorizeNicknames: ColorizeNicknamesMode = ColorizeNicknamesMode.ALL_BUT_MINE, val inputEnter: InputEnterMode = InputEnterMode.EMOJI, - val colorizeMirc: Boolean = true, - val useMonospace: Boolean = false, - val textSize: Int = 14, - val showSeconds: Boolean = false, - val use24hClock: Boolean = true, - val showHostmask: Boolean = false, val showLag: Boolean = true, val theme: Theme = Theme.QUASSEL_LIGHT ) { - enum class ColorizeNicknamesMode { - ALL, - ALL_BUT_MINE, - NONE; - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - enum class InputEnterMode { EMOJI, SEND; @@ -37,17 +18,6 @@ data class AppearanceSettings( } } - enum class ShowPrefixMode { - ALL, - HIGHEST, - NONE; - - companion object { - private val map = values().associateBy { it.name } - fun of(name: String) = map[name] - } - } - enum class Theme(@StyleRes val style: Int) { QUASSEL_LIGHT(R.style.Theme_ChatTheme_Quassel_Light), QUASSEL_DARK(R.style.Theme_ChatTheme_Quassel_Dark), diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt new file mode 100644 index 0000000000000000000000000000000000000000..901c213bed45fe24d06ae9e02c6f040f6347ca59 --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/settings/MessageSettings.kt @@ -0,0 +1,42 @@ +package de.kuschku.quasseldroid.settings + +data class MessageSettings( + val showPrefix: ShowPrefixMode = ShowPrefixMode.HIGHEST, + val colorizeNicknames: ColorizeNicknamesMode = ColorizeNicknamesMode.ALL_BUT_MINE, + val colorizeMirc: Boolean = true, + val useMonospace: Boolean = false, + val textSize: Int = 14, + val showSeconds: Boolean = false, + val use24hClock: Boolean = true, + val showHostmask: Boolean = false, + val nicksOnNewLine: Boolean = false, + val timeAtEnd: Boolean = false, + val showAvatars: Boolean = false +) { + + enum class ColorizeNicknamesMode { + ALL, + ALL_BUT_MINE, + NONE; + + companion object { + private val map = values().associateBy { it.name } + fun of(name: String) = map[name] + } + } + + enum class ShowPrefixMode { + ALL, + HIGHEST, + NONE; + + companion object { + private val map = values().associateBy { it.name } + fun of(name: String) = map[name] + } + } + + 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 059386303b32df795dcd78f0ec4ad73d9f91c4b3..ad45e290a84545739bd0022fa1828053f2c8bd9f 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt @@ -2,7 +2,8 @@ package de.kuschku.quasseldroid.settings import android.content.Context import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings.* +import de.kuschku.quasseldroid.settings.AppearanceSettings.InputEnterMode +import de.kuschku.quasseldroid.settings.AppearanceSettings.Theme import de.kuschku.quasseldroid.util.helper.sharedPreferences object Settings { @@ -14,51 +15,68 @@ object Settings { "" ) ) ?: AppearanceSettings.DEFAULT.theme, + inputEnter = InputEnterMode.of( + getString( + context.getString(R.string.preference_input_enter_key), + "" + ) + ) ?: AppearanceSettings.DEFAULT.inputEnter, + showLag = getBoolean( + context.getString(R.string.preference_show_lag_key), + AppearanceSettings.DEFAULT.showLag + ) + ) + } + + fun message(context: Context) = context.sharedPreferences { + MessageSettings( useMonospace = getBoolean( context.getString(R.string.preference_monospace_key), - AppearanceSettings.DEFAULT.useMonospace + MessageSettings.DEFAULT.useMonospace ), textSize = getInt( context.getString(R.string.preference_textsize_key), - AppearanceSettings.DEFAULT.textSize + MessageSettings.DEFAULT.textSize ), showSeconds = getBoolean( context.getString(R.string.preference_show_seconds_key), - AppearanceSettings.DEFAULT.showSeconds + MessageSettings.DEFAULT.showSeconds ), use24hClock = getBoolean( context.getString(R.string.preference_use_24h_clock_key), - AppearanceSettings.DEFAULT.use24hClock + MessageSettings.DEFAULT.use24hClock ), - showPrefix = ShowPrefixMode.of( + showPrefix = MessageSettings.ShowPrefixMode.of( getString( context.getString(R.string.preference_show_prefix_key), "" ) - ) ?: AppearanceSettings.DEFAULT.showPrefix, - colorizeNicknames = ColorizeNicknamesMode.of( + ) ?: MessageSettings.DEFAULT.showPrefix, + colorizeNicknames = MessageSettings.ColorizeNicknamesMode.of( getString( context.getString(R.string.preference_colorize_nicknames_key), "" ) - ) ?: AppearanceSettings.DEFAULT.colorizeNicknames, - inputEnter = InputEnterMode.of( - getString( - context.getString(R.string.preference_input_enter_key), - "" - ) - ) ?: AppearanceSettings.DEFAULT.inputEnter, + ) ?: MessageSettings.DEFAULT.colorizeNicknames, colorizeMirc = getBoolean( context.getString(R.string.preference_colorize_mirc_key), - AppearanceSettings.DEFAULT.colorizeMirc + MessageSettings.DEFAULT.colorizeMirc ), showHostmask = getBoolean( context.getString(R.string.preference_hostmask_key), - AppearanceSettings.DEFAULT.showHostmask + MessageSettings.DEFAULT.showHostmask ), - showLag = getBoolean( - context.getString(R.string.preference_show_lag_key), - AppearanceSettings.DEFAULT.showLag + nicksOnNewLine = getBoolean( + context.getString(R.string.preference_nicks_on_new_line_key), + MessageSettings.DEFAULT.nicksOnNewLine + ), + timeAtEnd = getBoolean( + context.getString(R.string.preference_time_at_end_key), + MessageSettings.DEFAULT.timeAtEnd + ), + showAvatars = getBoolean( + context.getString(R.string.preference_show_avatars_key), + MessageSettings.DEFAULT.showAvatars ) ) } diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt index 6a74f3d744941991e3329d5d37302fb280486342..ceb44aee9782475983ddb86f5c593ebd5520efe7 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt @@ -32,6 +32,7 @@ import de.kuschku.quasseldroid.Keys import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.persistence.AccountDatabase import de.kuschku.quasseldroid.persistence.QuasselDatabase +import de.kuschku.quasseldroid.settings.MessageSettings import de.kuschku.quasseldroid.settings.Settings import de.kuschku.quasseldroid.ui.chat.input.Editor import de.kuschku.quasseldroid.ui.chat.input.MessageHistoryAdapter @@ -72,6 +73,9 @@ class ChatActivity : ServiceBoundActivity(), SharedPreferences.OnSharedPreferenc @Inject lateinit var accountDatabase: AccountDatabase + @Inject + lateinit var messageSettings: MessageSettings + private lateinit var editor: Editor private val panelSlideListener: SlidingUpPanelLayout.PanelSlideListener = object : @@ -289,6 +293,9 @@ class ChatActivity : ServiceBoundActivity(), SharedPreferences.OnSharedPreferenc if (Settings.autoComplete(this) != autoCompleteSettings) { recreate() } + if (Settings.message(this) != messageSettings) { + recreate() + } super.onStart() editor.onStart() } 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 02770ad6df1c4544a36ad4fc73ae5e2dc0459230..6c205aea3ff7980520a38d18def36be1934ea705 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 @@ -15,6 +15,7 @@ import de.kuschku.libquassel.util.hasFlag import de.kuschku.libquassel.util.helpers.value import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.settings.AppearanceSettings +import de.kuschku.quasseldroid.settings.MessageSettings import de.kuschku.quasseldroid.ui.chat.info.InfoActivity import de.kuschku.quasseldroid.ui.chat.info.InfoDescriptor import de.kuschku.quasseldroid.ui.chat.info.InfoType @@ -42,6 +43,9 @@ class ToolbarFragment : ServiceBoundFragment() { @Inject lateinit var appearanceSettings: AppearanceSettings + @Inject + lateinit var messageSettings: MessageSettings + var title: CharSequence? get() = toolbarTitle.text set(value) { @@ -123,6 +127,6 @@ class ToolbarFragment : ServiceBoundFragment() { } private fun colorizeDescription(description: String?) = ircFormatDeserializer.formatString( - requireContext(), description, appearanceSettings.colorizeMirc + requireContext(), description, messageSettings.colorizeMirc ) } \ No newline at end of file diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt index a7a83efbdb2f829c708928930af672b910dc4bd2..857ca41fb3ae0285a9e9c3ce39b6734793a1976b 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/buffers/BufferViewConfigFragment.kt @@ -19,6 +19,7 @@ import de.kuschku.libquassel.util.minus import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.persistence.QuasselDatabase import de.kuschku.quasseldroid.settings.AppearanceSettings +import de.kuschku.quasseldroid.settings.MessageSettings import de.kuschku.quasseldroid.util.helper.map import de.kuschku.quasseldroid.util.helper.toLiveData import de.kuschku.quasseldroid.util.helper.zip @@ -40,6 +41,9 @@ class BufferViewConfigFragment : ServiceBoundFragment() { @Inject lateinit var appearanceSettings: AppearanceSettings + @Inject + lateinit var messageSettings: MessageSettings + @Inject lateinit var database: QuasselDatabase @@ -189,7 +193,7 @@ class BufferViewConfigFragment : ServiceBoundFragment() { val activity = it.activity - (activities[it.info.bufferId] ?: 0) it.copy( description = ircFormatDeserializer.formatString( - requireContext(), it.description.toString(), appearanceSettings.colorizeMirc + requireContext(), it.description.toString(), messageSettings.colorizeMirc ), activity = activity, bufferActivity = Buffer_Activity.of( diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt index 4e84989f2d3faf5a3405f9df33224bee705aa789..9ed9d1799ff592962804b3477fcb0f52ee1ad0ad 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageAdapter.kt @@ -7,6 +7,7 @@ import android.util.LruCache import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.ImageView import android.widget.TextView import butterknife.BindView import butterknife.ButterKnife @@ -103,12 +104,29 @@ class MessageAdapter( selectionListener: ((FormattedMessage) -> Unit)? = null, expansionListener: ((QuasselDatabase.DatabaseMessage) -> Unit)? = null ) : RecyclerView.ViewHolder(itemView) { - @BindView(R.id.time) + @BindView(R.id.timeLeft) @JvmField - var time: TextView? = null + var timeLeft: TextView? = null + + @BindView(R.id.timeRight) + @JvmField + var timeRight: TextView? = null + + @BindView(R.id.avatar) + @JvmField + var avatar: ImageView? = null + + @BindView(R.id.name) + @JvmField + var name: TextView? = null @BindView(R.id.content) - lateinit var content: TextView + @JvmField + var content: TextView? = null + + @BindView(R.id.combined) + @JvmField + var combined: TextView? = null @BindView(R.id.markerline) @JvmField @@ -138,7 +156,8 @@ class MessageAdapter( init { ButterKnife.bind(this, itemView) - content.movementMethod = BetterLinkMovementMethod.getInstance() + content?.movementMethod = BetterLinkMovementMethod.getInstance() + combined?.movementMethod = BetterLinkMovementMethod.getInstance() itemView.setOnClickListener(localClickListener) itemView.setOnLongClickListener(localLongClickListener) @@ -149,8 +168,11 @@ class MessageAdapter( this.selectable = selectable this.clickable = clickable - time?.text = message.time - content.text = message.content + timeLeft?.text = message.time + timeRight?.text = message.time + name?.text = message.name + content?.text = message.content + combined?.text = message.combined markerline?.visibleIf(message.isMarkerLine) this.itemView.isSelected = message.isSelected diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt index 41cfe09b64fbb2fd8957231ac4f409212988607d..eafe08b53c2421d58728ead11a295dfe15e73e2c 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/messages/MessageListFragment.kt @@ -24,7 +24,10 @@ import de.kuschku.quasseldroid.persistence.QuasselDatabase import de.kuschku.quasseldroid.persistence.findByBufferIdPagedWithDayChange import de.kuschku.quasseldroid.settings.AppearanceSettings import de.kuschku.quasseldroid.settings.BacklogSettings +import de.kuschku.quasseldroid.settings.MessageSettings +import de.kuschku.quasseldroid.settings.Settings import de.kuschku.quasseldroid.util.helper.* +import de.kuschku.quasseldroid.util.irc.format.ContentFormatter import de.kuschku.quasseldroid.util.service.ServiceBoundFragment import de.kuschku.quasseldroid.util.ui.SpanFormatter import io.reactivex.BackpressureStrategy @@ -47,6 +50,9 @@ class MessageListFragment : ServiceBoundFragment() { @Inject lateinit var backlogSettings: BacklogSettings + @Inject + lateinit var messageSettings: MessageSettings + @Inject lateinit var database: QuasselDatabase 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 94eee1f6917c72503a0d2a6312ab34372cc8b374..cccaa521a6eb68ae97f7f4ca7bdcabf2ee01c1ff 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 @@ -14,10 +14,11 @@ import de.kuschku.libquassel.protocol.Message_Type import de.kuschku.libquassel.util.hasFlag import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.persistence.QuasselDatabase -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.AppearanceSettings.ColorizeNicknamesMode -import de.kuschku.quasseldroid.settings.AppearanceSettings.ShowPrefixMode +import de.kuschku.quasseldroid.settings.MessageSettings +import de.kuschku.quasseldroid.settings.MessageSettings.ColorizeNicknamesMode +import de.kuschku.quasseldroid.settings.MessageSettings.ShowPrefixMode import de.kuschku.quasseldroid.util.helper.styledAttributes +import de.kuschku.quasseldroid.util.helper.visibleIf import de.kuschku.quasseldroid.util.irc.format.ContentFormatter import de.kuschku.quasseldroid.util.quassel.IrcUserUtils import de.kuschku.quasseldroid.util.ui.SpanFormatter @@ -28,11 +29,11 @@ import org.threeten.bp.format.FormatStyle import javax.inject.Inject class QuasselMessageRenderer @Inject constructor( - private val appearanceSettings: AppearanceSettings, + private val messageSettings: MessageSettings, private val contentFormatter: ContentFormatter ) : MessageRenderer { private val timeFormatter = DateTimeFormatter.ofPattern( - timePattern(appearanceSettings.showSeconds, appearanceSettings.use24hClock) + timePattern(messageSettings.showSeconds, messageSettings.use24hClock) ) private val dateFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM) @@ -72,8 +73,11 @@ class QuasselMessageRenderer @Inject constructor( R.attr.colorForegroundHighlight, R.attr.colorBackgroundHighlight, R.attr.backgroundMenuItem ) { - viewHolder.time?.setTextColor(getColor(0, 0)) - viewHolder.content.setTextColor(getColor(0, 0)) + viewHolder.timeLeft?.setTextColor(getColor(0, 0)) + viewHolder.timeRight?.setTextColor(getColor(0, 0)) + viewHolder.name?.setTextColor(getColor(0, 0)) + viewHolder.combined?.setTextColor(getColor(0, 0)) + viewHolder.content?.setTextColor(getColor(0, 0)) viewHolder.itemView.background = LayerDrawable( arrayOf( ColorDrawable(getColor(1, 0)), @@ -82,17 +86,27 @@ class QuasselMessageRenderer @Inject constructor( ) } } - if (appearanceSettings.useMonospace) { - val old = viewHolder.content.typeface - if (old.isItalic) { - viewHolder.content.typeface = monospaceItalic - } else { - viewHolder.content.typeface = Typeface.MONOSPACE - } + + if (messageSettings.useMonospace) { + viewHolder.content?.typeface = if (viewHolder.content?.typeface?.isItalic == true) monospaceItalic else Typeface.MONOSPACE + viewHolder.combined?.typeface = if (viewHolder.combined?.typeface?.isItalic == true) monospaceItalic else Typeface.MONOSPACE } - val textSize = appearanceSettings.textSize.toFloat() - viewHolder.time?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) - viewHolder.content.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) + + viewHolder.avatar?.visibleIf(messageSettings.showAvatars) + val separateLine = viewHolder.content != null && viewHolder.name != null && messageSettings.nicksOnNewLine + viewHolder.name?.visibleIf(separateLine) + viewHolder.content?.visibleIf(separateLine) + viewHolder.combined?.visibleIf(!separateLine) + + viewHolder.timeLeft?.visibleIf(!messageSettings.timeAtEnd) + viewHolder.timeRight?.visibleIf(messageSettings.timeAtEnd) + + val textSize = messageSettings.textSize.toFloat() + viewHolder.timeLeft?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) + viewHolder.timeRight?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) + viewHolder.content?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) + viewHolder.combined?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) + viewHolder.name?.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize) } override fun bind(holder: MessageAdapter.QuasselMessageViewHolder, message: FormattedMessage, @@ -117,23 +131,28 @@ class QuasselMessageRenderer @Inject constructor( val self = Message_Flag.of(message.content.flag).hasFlag(Message_Flag.Self) val highlight = Message_Flag.of(message.content.flag).hasFlag(Message_Flag.Highlight) return when (Message_Type.of(message.content.type).enabledValues().firstOrNull()) { - Message_Type.Plain -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - SpanFormatter.format( - context.getString(R.string.message_format_plain), + Message_Type.Plain -> { + val nick = SpanFormatter.format( + "%s%s", formatPrefix(message.content.senderPrefixes, highlight), - formatNick(message.content.sender, self, highlight, false), - contentFormatter.format(context, message.content.content, highlight) - ), - isMarkerLine = message.isMarkerLine, - isExpanded = message.isExpanded, - isSelected = message.isSelected - ) + formatNick(message.content.sender, self, highlight, false) + ) + val content = contentFormatter.format(context, message.content.content, highlight) + FormattedMessage( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + name = nick, + content = content, + combined = SpanFormatter.format("%s: %s", nick, content), + isMarkerLine = message.isMarkerLine, + isExpanded = message.isExpanded, + isSelected = message.isSelected + ) + } Message_Type.Action -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - SpanFormatter.format( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = SpanFormatter.format( context.getString(R.string.message_format_action), formatPrefix(message.content.senderPrefixes, highlight), formatNick(message.content.sender, self, highlight, false), @@ -144,9 +163,9 @@ class QuasselMessageRenderer @Inject constructor( isSelected = message.isSelected ) Message_Type.Notice -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - SpanFormatter.format( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = SpanFormatter.format( context.getString(R.string.message_format_notice), formatPrefix(message.content.senderPrefixes, highlight), formatNick(message.content.sender, self, highlight, false), @@ -159,9 +178,9 @@ class QuasselMessageRenderer @Inject constructor( Message_Type.Nick -> { val nickSelf = message.content.sender == message.content.content || self FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - if (nickSelf) { + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = if (nickSelf) { SpanFormatter.format( context.getString(R.string.message_format_nick_self), formatPrefix(message.content.senderPrefixes, highlight), @@ -182,9 +201,9 @@ class QuasselMessageRenderer @Inject constructor( ) } Message_Type.Mode -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - SpanFormatter.format( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = SpanFormatter.format( context.getString(R.string.message_format_mode), message.content.content, formatPrefix(message.content.senderPrefixes, highlight), @@ -195,9 +214,9 @@ class QuasselMessageRenderer @Inject constructor( isSelected = message.isSelected ) Message_Type.Join -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - SpanFormatter.format( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = SpanFormatter.format( context.getString(R.string.message_format_join), formatPrefix(message.content.senderPrefixes, highlight), formatNick(message.content.sender, self, highlight, true), @@ -208,9 +227,9 @@ class QuasselMessageRenderer @Inject constructor( isSelected = message.isSelected ) Message_Type.Part -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - if (message.content.content.isBlank()) { + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = if (message.content.content.isBlank()) { SpanFormatter.format( context.getString(R.string.message_format_part_1), formatPrefix(message.content.senderPrefixes, highlight), @@ -229,9 +248,9 @@ class QuasselMessageRenderer @Inject constructor( isSelected = message.isSelected ) Message_Type.Quit -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - if (message.content.content.isBlank()) { + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = if (message.content.content.isBlank()) { SpanFormatter.format( context.getString(R.string.message_format_quit_1), formatPrefix(message.content.senderPrefixes, highlight), @@ -252,9 +271,9 @@ class QuasselMessageRenderer @Inject constructor( Message_Type.Kick -> { val (user, reason) = message.content.content.split(' ', limit = 2) + listOf("", "") FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - if (reason.isBlank()) { + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = if (reason.isBlank()) { SpanFormatter.format( context.getString(R.string.message_format_kick_1), formatNick(user, false, highlight, false), @@ -278,9 +297,9 @@ class QuasselMessageRenderer @Inject constructor( Message_Type.Kill -> { val (user, reason) = message.content.content.split(' ', limit = 2) + listOf("", "") FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - if (reason.isBlank()) { + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = if (reason.isBlank()) { SpanFormatter.format( context.getString(R.string.message_format_kill_1), formatNick(user, false, highlight, false), @@ -306,9 +325,9 @@ class QuasselMessageRenderer @Inject constructor( val (server1, server2) = split.last().split(' ') val usersAffected = split.size - 1 FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - context.resources.getQuantityString( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = context.resources.getQuantityString( R.plurals.message_netsplit_join, usersAffected, server1, server2, usersAffected ), isMarkerLine = message.isMarkerLine, @@ -321,9 +340,9 @@ class QuasselMessageRenderer @Inject constructor( val (server1, server2) = split.last().split(' ') val usersAffected = split.size - 1 FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - context.resources.getQuantityString( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = context.resources.getQuantityString( R.plurals.message_netsplit_quit, usersAffected, server1, server2, usersAffected ), isMarkerLine = message.isMarkerLine, @@ -334,33 +353,33 @@ class QuasselMessageRenderer @Inject constructor( Message_Type.Server, Message_Type.Info, Message_Type.Error -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - contentFormatter.format(context, message.content.content, highlight), + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = contentFormatter.format(context, message.content.content, highlight), isMarkerLine = message.isMarkerLine, isExpanded = message.isExpanded, isSelected = message.isSelected ) Message_Type.Topic -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - contentFormatter.format(context, message.content.content, highlight), + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = contentFormatter.format(context, message.content.content, highlight), isMarkerLine = message.isMarkerLine, isExpanded = message.isExpanded, isSelected = message.isSelected ) - DayChange -> FormattedMessage( - message.content.messageId, - "", - dateFormatter.format(message.content.time.atZone(zoneId)), + Message_Type.DayChange -> FormattedMessage( + id = message.content.messageId, + time = "", + combined = dateFormatter.format(message.content.time.atZone(zoneId)), isMarkerLine = false, isExpanded = false, isSelected = false ) else -> FormattedMessage( - message.content.messageId, - timeFormatter.format(message.content.time.atZone(zoneId)), - SpanFormatter.format( + id = message.content.messageId, + time = timeFormatter.format(message.content.time.atZone(zoneId)), + combined = SpanFormatter.format( "[%d] %s%s: %s", message.content.type, formatPrefix(message.content.senderPrefixes, highlight), @@ -408,17 +427,17 @@ class QuasselMessageRenderer @Inject constructor( private fun formatNick(sender: String, self: Boolean, highlight: Boolean, showHostmask: Boolean) = - when (appearanceSettings.colorizeNicknames) { + when (messageSettings.colorizeNicknames) { ColorizeNicknamesMode.ALL -> - formatNickImpl(sender, !highlight, appearanceSettings.showHostmask && showHostmask) + formatNickImpl(sender, !highlight, messageSettings.showHostmask && showHostmask) ColorizeNicknamesMode.ALL_BUT_MINE -> - formatNickImpl(sender, !self && !highlight, appearanceSettings.showHostmask && showHostmask) + formatNickImpl(sender, !self && !highlight, messageSettings.showHostmask && showHostmask) ColorizeNicknamesMode.NONE -> - formatNickImpl(sender, false, appearanceSettings.showHostmask && showHostmask) + formatNickImpl(sender, false, messageSettings.showHostmask && showHostmask) } private fun formatPrefix(prefix: String, - highlight: Boolean) = when (appearanceSettings.showPrefix) { + highlight: Boolean) = when (messageSettings.showPrefix) { ShowPrefixMode.ALL -> prefix ShowPrefixMode.HIGHEST -> prefix.substring(0, Math.min(prefix.length, 1)) ShowPrefixMode.NONE -> "" diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt index fd7b6b274bce6fc087f924ed06a6241e6b30879f..bcbef6f3986fc551c6f0c574c34cf9d009b3156d 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/nicks/NickListFragment.kt @@ -16,6 +16,7 @@ import de.kuschku.libquassel.util.helpers.value import de.kuschku.libquassel.util.irc.IrcCaseMappers import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.settings.AppearanceSettings +import de.kuschku.quasseldroid.settings.MessageSettings import de.kuschku.quasseldroid.ui.chat.info.InfoActivity import de.kuschku.quasseldroid.ui.chat.info.InfoDescriptor import de.kuschku.quasseldroid.ui.chat.info.InfoType @@ -31,6 +32,9 @@ class NickListFragment : ServiceBoundFragment() { @Inject lateinit var appearanceSettings: AppearanceSettings + @Inject + lateinit var messageSettings: MessageSettings + @Inject lateinit var ircFormatDeserializer: IrcFormatDeserializer @@ -48,14 +52,14 @@ class NickListFragment : ServiceBoundFragment() { viewModel.nickData.map { it.map { it.copy( - modes = when (appearanceSettings.showPrefix) { - AppearanceSettings.ShowPrefixMode.ALL -> + modes = when (messageSettings.showPrefix) { + MessageSettings.ShowPrefixMode.ALL -> it.modes - else -> + else -> it.modes.substring(0, Math.min(it.modes.length, 1)) }, realname = ircFormatDeserializer.formatString( - requireContext(), it.realname.toString(), appearanceSettings.colorizeMirc + requireContext(), it.realname.toString(), messageSettings.colorizeMirc ) ) }.sortedBy { diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt index 1f558e7825bd50e87ea4946314baa9250243b5eb..7c68c06c61c2f4eff419e48d4bd45095a5f70fb5 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/ContentFormatter.kt @@ -5,13 +5,13 @@ import android.text.SpannableString import android.text.Spanned import android.text.TextPaint import android.text.style.URLSpan -import de.kuschku.quasseldroid.settings.AppearanceSettings +import de.kuschku.quasseldroid.settings.MessageSettings import org.intellij.lang.annotations.Language import javax.inject.Inject class ContentFormatter @Inject constructor( private val ircFormatDeserializer: IrcFormatDeserializer, - private val appearanceSettings: AppearanceSettings + private val messageSettings: MessageSettings ) { @Language("RegExp") private val scheme = "(?:(?:mailto:|magnet:|(?:[+.-]?\\w)+://)|www(?=\\.\\S+\\.))" @@ -44,7 +44,7 @@ class ContentFormatter @Inject constructor( fun format(context: Context, content: String, highlight: Boolean = false): CharSequence { val formattedText = ircFormatDeserializer.formatString( - context, content, appearanceSettings.colorizeMirc + context, content, messageSettings.colorizeMirc ) val text = SpannableString(formattedText) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt index a98089d8892b393997f5c9dd4fcd13da4b408aa2..bccc403ae2ea96ef7977b045630d660c2dc4dff2 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/util/service/ServiceBoundActivity.kt @@ -19,10 +19,7 @@ import de.kuschku.libquassel.session.Backend import de.kuschku.libquassel.util.Optional import de.kuschku.quasseldroid.Keys import de.kuschku.quasseldroid.R -import de.kuschku.quasseldroid.settings.AppearanceSettings -import de.kuschku.quasseldroid.settings.AutoCompleteSettings -import de.kuschku.quasseldroid.settings.ConnectionSettings -import de.kuschku.quasseldroid.settings.Settings +import de.kuschku.quasseldroid.settings.* import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActivity import de.kuschku.quasseldroid.util.helper.sharedPreferences import de.kuschku.quasseldroid.util.helper.updateRecentsHeaderIfExisting diff --git a/app/src/main/res/drawable-nodpi/profile.png b/app/src/main/res/drawable-nodpi/profile.png new file mode 100644 index 0000000000000000000000000000000000000000..b7e0cba479f31c191d63e03e18dcc4f8c8adc699 Binary files /dev/null and b/app/src/main/res/drawable-nodpi/profile.png differ diff --git a/app/src/main/res/layout/widget_chatmessage_action.xml b/app/src/main/res/layout/widget_chatmessage_action.xml index ae14d6500c73f4399116a3169dd9fd8d52732fad..9094dadffc8a7c438280cd7bd95c514391030910 100644 --- a/app/src/main/res/layout/widget_chatmessage_action.xml +++ b/app/src/main/res/layout/widget_chatmessage_action.xml @@ -19,23 +19,46 @@ android:paddingTop="@dimen/message_vertical"> <TextView - android:id="@+id/time" + android:id="@+id/timeLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_gravity="top" android:layout_marginEnd="@dimen/message_horizontal" android:layout_marginRight="@dimen/message_horizontal" android:textColor="?attr/colorForegroundSecondary" android:typeface="monospace" tools:text="@sample/messages.json/data/time" /> + <ImageView + android:id="@+id/avatar" + android:layout_width="40dp" + android:layout_height="match_parent" + android:layout_marginBottom="@dimen/message_vertical" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginTop="@dimen/message_vertical" + android:visibility="gone" /> + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView - android:id="@+id/content" + android:id="@+id/combined" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="?attr/colorForegroundAction" android:textStyle="italic" tools:text="@sample/messages.json/data/message" /> + + <TextView + android:id="@+id/timeRight" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/message_horizontal" + android:layout_marginStart="@dimen/message_horizontal" + android:textColor="?attr/colorForegroundSecondary" + android:typeface="monospace" + android:visibility="gone" + tools:text="@sample/messages.json/data/time" /> </LinearLayout> <View diff --git a/app/src/main/res/layout/widget_chatmessage_daychange.xml b/app/src/main/res/layout/widget_chatmessage_daychange.xml index 03f99f78d9d23064d57ab6881d2e11bb5184afa8..79659a08b329c6451f857aff51b928b3ad1e1033 100644 --- a/app/src/main/res/layout/widget_chatmessage_daychange.xml +++ b/app/src/main/res/layout/widget_chatmessage_daychange.xml @@ -16,12 +16,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:paddingBottom="@dimen/message_vertical" + android:paddingBottom="@dimen/message_vertical_daychange" android:paddingEnd="@dimen/message_horizontal" android:paddingLeft="@dimen/message_horizontal" android:paddingRight="@dimen/message_horizontal" android:paddingStart="@dimen/message_horizontal" - android:paddingTop="@dimen/message_vertical"> + android:paddingTop="@dimen/message_vertical_daychange"> <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView android:id="@+id/content" diff --git a/app/src/main/res/layout/widget_chatmessage_error.xml b/app/src/main/res/layout/widget_chatmessage_error.xml index 2e84f028b3d5736c95ea623d39793ec349967067..144ef1cd0e1af908dfa31ec90ea3f9fa620934c5 100644 --- a/app/src/main/res/layout/widget_chatmessage_error.xml +++ b/app/src/main/res/layout/widget_chatmessage_error.xml @@ -19,7 +19,7 @@ android:paddingTop="@dimen/message_vertical"> <TextView - android:id="@+id/time" + android:id="@+id/timeLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/message_horizontal" @@ -28,13 +28,35 @@ android:typeface="monospace" tools:text="@sample/messages.json/data/time" /> + <ImageView + android:id="@+id/avatar" + android:layout_width="40dp" + android:layout_height="match_parent" + android:layout_marginBottom="@dimen/message_vertical" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginTop="@dimen/message_vertical" + android:visibility="gone" /> + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView - android:id="@+id/content" + android:id="@+id/combined" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="?attr/colorForegroundError" tools:text="@sample/messages.json/data/message" /> + + <TextView + android:id="@+id/timeRight" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/message_horizontal" + android:layout_marginStart="@dimen/message_horizontal" + android:textColor="?attr/colorForegroundSecondary" + android:typeface="monospace" + android:visibility="gone" + tools:text="@sample/messages.json/data/time" /> </LinearLayout> <View diff --git a/app/src/main/res/layout/widget_chatmessage_info.xml b/app/src/main/res/layout/widget_chatmessage_info.xml index 37e93194d5f9eed20ab969304221fa67e4acb024..0130f18519b609b0b2bb8abda41e1cfd96ca5c9c 100644 --- a/app/src/main/res/layout/widget_chatmessage_info.xml +++ b/app/src/main/res/layout/widget_chatmessage_info.xml @@ -19,7 +19,7 @@ android:paddingTop="@dimen/message_vertical"> <TextView - android:id="@+id/time" + android:id="@+id/timeLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/message_horizontal" @@ -28,14 +28,36 @@ android:textColor="?attr/colorForegroundSecondary" tools:text="@sample/messages.json/data/time" /> + <ImageView + android:id="@+id/avatar" + android:layout_width="40dp" + android:layout_height="match_parent" + android:layout_marginBottom="@dimen/message_vertical" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginTop="@dimen/message_vertical" + android:visibility="gone" /> + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView - android:id="@+id/content" + android:id="@+id/combined" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="?attr/colorForegroundSecondary" android:textStyle="italic" tools:text="@sample/messages.json/data/message" /> + + <TextView + android:id="@+id/timeRight" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/message_horizontal" + android:layout_marginStart="@dimen/message_horizontal" + android:textColor="?attr/colorForegroundSecondary" + android:typeface="monospace" + android:visibility="gone" + tools:text="@sample/messages.json/data/time" /> </LinearLayout> <View diff --git a/app/src/main/res/layout/widget_chatmessage_notice.xml b/app/src/main/res/layout/widget_chatmessage_notice.xml index cc958e5342d7544cc80b673e2a35203c82250360..4b202600ce76101d5736f5321e593032274b9c59 100644 --- a/app/src/main/res/layout/widget_chatmessage_notice.xml +++ b/app/src/main/res/layout/widget_chatmessage_notice.xml @@ -19,7 +19,7 @@ android:paddingTop="@dimen/message_vertical"> <TextView - android:id="@+id/time" + android:id="@+id/timeLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/message_horizontal" @@ -28,13 +28,35 @@ android:textColor="?attr/colorForegroundNotice" tools:text="@sample/messages.json/data/time" /> + <ImageView + android:id="@+id/avatar" + android:layout_width="40dp" + android:layout_height="match_parent" + android:layout_marginBottom="@dimen/message_vertical" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginTop="@dimen/message_vertical" + android:visibility="gone" /> + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView - android:id="@+id/content" + android:id="@+id/combined" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="?attr/colorForegroundNotice" tools:text="@sample/messages.json/data/message" /> + + <TextView + android:id="@+id/timeRight" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/message_horizontal" + android:layout_marginStart="@dimen/message_horizontal" + android:textColor="?attr/colorForegroundSecondary" + android:typeface="monospace" + android:visibility="gone" + tools:text="@sample/messages.json/data/time" /> </LinearLayout> <View diff --git a/app/src/main/res/layout/widget_chatmessage_placeholder.xml b/app/src/main/res/layout/widget_chatmessage_placeholder.xml index bb9e5c8eb5c2f7713a24fea296ca64afe822f3b2..5e30fed430f0a9b61cd03eac186eddaf8afa2aec 100644 --- a/app/src/main/res/layout/widget_chatmessage_placeholder.xml +++ b/app/src/main/res/layout/widget_chatmessage_placeholder.xml @@ -1,23 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<View xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="48dp"> - - <TextView - android:id="@+id/time" - android:layout_width="0dip" - android:layout_height="0dip" - android:visibility="gone" /> - - <TextView - android:id="@+id/content" - android:layout_width="0dip" - android:layout_height="0dip" - android:visibility="gone" /> - - <View - android:id="@+id/markerline" - android:layout_width="0dip" - android:layout_height="0dip" - android:visibility="gone" /> -</LinearLayout> \ No newline at end of file + android:layout_height="48dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/widget_chatmessage_plain.xml b/app/src/main/res/layout/widget_chatmessage_plain.xml index 2c38ff54c9e965b8f32fb8af6a5ae1aff6051711..384606afd7fc411116f5ca74e0c4e52451dfb855 100644 --- a/app/src/main/res/layout/widget_chatmessage_plain.xml +++ b/app/src/main/res/layout/widget_chatmessage_plain.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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:layout_width="match_parent" android:layout_height="wrap_content" @@ -19,22 +20,72 @@ android:paddingTop="@dimen/message_vertical"> <TextView - android:id="@+id/time" + android:id="@+id/timeLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_gravity="top" android:layout_marginEnd="@dimen/message_horizontal" android:layout_marginRight="@dimen/message_horizontal" android:textColor="?attr/colorForegroundSecondary" android:typeface="monospace" tools:text="@sample/messages.json/data/time" /> - <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView - android:id="@+id/content" + <com.mikhaellopez.circularimageview.CircularImageView + android:id="@+id/avatar" + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_marginBottom="@dimen/message_vertical" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginTop="@dimen/message_vertical" + android:src="@drawable/profile" + android:visibility="gone" + app:civ_border_width="0dip" /> + + <LinearLayout android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" - android:textColor="?attr/colorForeground" - tools:text="@sample/messages.json/data/message" /> + android:orientation="vertical"> + + <TextView + android:id="@+id/name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginTop="@dimen/message_vertical" + android:textColor="?attr/colorForegroundSecondary" + android:visibility="gone" + tools:text="@sample/messages.json/data/sender" /> + + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/message_vertical" + android:textColor="?attr/colorForeground" + android:visibility="gone" + tools:text="@sample/messages.json/data/message" /> + + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView + android:id="@+id/combined" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="?attr/colorForeground" + tools:text="@sample/messages.json/data/message" /> + </LinearLayout> + + <TextView + android:id="@+id/timeRight" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginLeft="@dimen/message_horizontal" + android:layout_marginStart="@dimen/message_horizontal" + android:textColor="?attr/colorForegroundSecondary" + android:typeface="monospace" + android:visibility="gone" + tools:text="@sample/messages.json/data/time" /> </LinearLayout> <View diff --git a/app/src/main/res/layout/widget_chatmessage_server.xml b/app/src/main/res/layout/widget_chatmessage_server.xml index 6f83feb9773fb599f4a9398d507bcf22561c6fba..f03e1a0a850de8350760b9eadee9eb5d6a2bb650 100644 --- a/app/src/main/res/layout/widget_chatmessage_server.xml +++ b/app/src/main/res/layout/widget_chatmessage_server.xml @@ -19,22 +19,44 @@ android:paddingTop="@dimen/message_vertical"> <TextView - android:id="@+id/time" + android:id="@+id/timeLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/message_horizontal" - android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginLeft="@dimen/message_horizontal" + android:layout_marginStart="@dimen/message_horizontal" android:textColor="?attr/colorForegroundSecondary" android:typeface="monospace" tools:text="@sample/messages.json/data/time" /> + <ImageView + android:id="@+id/avatar" + android:layout_width="40dp" + android:layout_height="match_parent" + android:layout_marginBottom="@dimen/message_vertical" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:layout_marginTop="@dimen/message_vertical" + android:visibility="gone" /> + <de.kuschku.quasseldroid.ui.chat.messages.RipplePassthroughTextView - android:id="@+id/content" + android:id="@+id/combined" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="?attr/colorForegroundSecondary" tools:text="@sample/messages.json/data/message" /> + + <TextView + android:id="@+id/timeRight" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginEnd="@dimen/message_horizontal" + android:layout_marginRight="@dimen/message_horizontal" + android:textColor="?attr/colorForegroundSecondary" + android:typeface="monospace" + android:visibility="gone" + tools:text="@sample/messages.json/data/time" /> </LinearLayout> <View diff --git a/app/src/main/res/values-de/strings_messages.xml b/app/src/main/res/values-de/strings_messages.xml index d18185b5f76c4dbc07b46cfd7320c0202bbd4c5e..a5d25ede6faec1e74a0a598eaf98ec2bfc84ef3a 100644 --- a/app/src/main/res/values-de/strings_messages.xml +++ b/app/src/main/res/values-de/strings_messages.xml @@ -10,7 +10,7 @@ <string name="message_format_copy">[%1$s] %2$s</string> <string name="message_format_plain">%1$s%2$s: %3$s</string> - <string name="message_format_action">* %1$s%2$s %3$s</string> + <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 %1$s%2$s</string> diff --git a/app/src/main/res/values-de/strings_preferences.xml b/app/src/main/res/values-de/strings_preferences.xml index 18dcf1f24f14fed5d6dfbb491e9f2cdf402f4f02..fffdaaaf2c0dd030aace93af919075d4ee09ab9d 100644 --- a/app/src/main/res/values-de/strings_preferences.xml +++ b/app/src/main/res/values-de/strings_preferences.xml @@ -11,6 +11,16 @@ <string name="preference_theme_entry_gruvbox_light">Gruvbox (Hell)</string> <string name="preference_theme_entry_gruvbox_dark">Gruvbox (Dunkel)</string> + <string name="preference_input_enter_title">Eingabetaste auf Tastatur</string> + <string name="preference_input_enter_entry_emoji">Emoji-Auswahl</string> + <string name="preference_input_enter_entry_send">Senden</string> + + <string name="preference_show_lag_title">Latenz anzeigen</string> + <string name="preference_show_lag_summary">Zeigt die Gerät-Core-Latenz in der Statusleiste</string> + + + <string name="preference_messages_title">Nachrichten</string> + <string name="preference_monospace_title">Monospace-Schrift verwenden</string> <string name="preference_textsize_title">Schriftgröße</string> @@ -33,9 +43,17 @@ <string name="preference_show_prefix_entry_highest">Höchsten Modus</string> <string name="preference_show_prefix_entry_none">Keine</string> - <string name="preference_input_enter_title">Eingabetaste auf Tastatur</string> - <string name="preference_input_enter_entry_emoji">Emoji-Auswahl</string> - <string name="preference_input_enter_entry_send">Senden</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_nicks_on_new_line_title">Separate Spitznamen</string> + <string name="preference_nicks_on_new_line_summary">Zeigt Spitznamen in einer eigenen Zeile an</string> + + <string name="preference_time_at_end_title">Rechts-Ausgerichtete Zeit</string> + <string name="preference_time_at_end_summary">Zeigt die Zeit rechts in Nachrichten an</string> + + <string name="preference_show_avatars_title">Benutzerbilder anzeigen</string> + <string name="preference_autocomplete_title">Autovervollständigung</string> @@ -51,12 +69,6 @@ <string name="preference_autocomplete_prefix_title">Nach Präfix anzeigen</string> <string name="preference_autocomplete_prefix_summary">Vervollständigt Namen und Chats automatisch nach einem @ oder #</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_show_lag_title">Latenz anzeigen</string> - <string name="preference_show_lag_summary">Zeigt die Gerät-Core-Latenz in der Statusleiste</string> - <string name="preference_backlog_title">Verlauf</string> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 5535c2b7c4e90dbd937085a961777518ccd1520e..1d94a3e670bf1b3493a4603475000e55670df39c 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -3,6 +3,7 @@ <dimen name="message_horizontal">8dp</dimen> <dimen name="message_vertical">2dp</dimen> + <dimen name="message_vertical_daychange">8dp</dimen> <dimen name="autocomplete_max_height">96dp</dimen> diff --git a/app/src/main/res/values/strings_messages.xml b/app/src/main/res/values/strings_messages.xml index e32ff0ed4d93480ef1692cd205dbe83e4866e6fa..ede83a7f7e7009b3adc0bc5c1afcd70b4ce299f3 100644 --- a/app/src/main/res/values/strings_messages.xml +++ b/app/src/main/res/values/strings_messages.xml @@ -18,7 +18,7 @@ <string name="message_format_copy">[%1$s] %2$s</string> <string name="message_format_plain">%1$s%2$s: %3$s</string> - <string name="message_format_action">* %1$s%2$s %3$s</string> + <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 is now known as %3$s%4$s</string> <string name="message_format_nick_self">You are now known as %1$s%2$s</string> diff --git a/app/src/main/res/values/strings_preferences.xml b/app/src/main/res/values/strings_preferences.xml index 66e6c5b1eda65a4a47324db79ced2960d6f2247d..ddcf32373da6e7e8b70ecd846c23d7146b998346 100644 --- a/app/src/main/res/values/strings_preferences.xml +++ b/app/src/main/res/values/strings_preferences.xml @@ -30,6 +30,26 @@ <item>GRUVBOX_DARK</item> </string-array> + <string name="preference_input_enter_key" translatable="false">input_enter</string> + <string name="preference_input_enter_title">Enter key on keyboard</string> + <string name="preference_input_enter_entry_emoji">Emoji</string> + <string name="preference_input_enter_entry_send">Send</string> + <string-array name="preference_input_enter_entries"> + <item>@string/preference_input_enter_entry_emoji</item> + <item>@string/preference_input_enter_entry_send</item> + </string-array> + <string-array name="preference_input_enter_entryvalues" translatable="false"> + <item>EMOJI</item> + <item>SEND</item> + </string-array> + + <string name="preference_show_lag_key" translatable="false">show_lag</string> + <string name="preference_show_lag_title">Show lag</string> + <string name="preference_show_lag_summary">Displays the lag between client and core in the action bar</string> + + + <string name="preference_messages_title">Messages</string> + <string name="preference_monospace_key" translatable="false">monospace</string> <string name="preference_monospace_title">Use Monospace Font</string> @@ -79,18 +99,20 @@ <item>NONE</item> </string-array> - <string name="preference_input_enter_key" translatable="false">input_enter</string> - <string name="preference_input_enter_title">Enter key on keyboard</string> - <string name="preference_input_enter_entry_emoji">Emoji</string> - <string name="preference_input_enter_entry_send">Send</string> - <string-array name="preference_input_enter_entries"> - <item>@string/preference_input_enter_entry_emoji</item> - <item>@string/preference_input_enter_entry_send</item> - </string-array> - <string-array name="preference_input_enter_entryvalues" translatable="false"> - <item>EMOJI</item> - <item>SEND</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_nicks_on_new_line_key" translatable="false">nicks_on_new_line</string> + <string name="preference_nicks_on_new_line_title">Separate Nicknames</string> + <string name="preference_nicks_on_new_line_summary">Shows nicknames on a separate line</string> + + <string name="preference_time_at_end_key" translatable="false">time_at_end</string> + <string name="preference_time_at_end_title">Right-Aligned Timestamps</string> + <string name="preference_time_at_end_summary">Aligns timestamps at the end of each message</string> + + <string name="preference_show_avatars_key" translatable="false">show_avatars</string> + <string name="preference_show_avatars_title">Show Avatars</string> <string name="preference_autocomplete_title">Autocomplete</string> @@ -110,14 +132,6 @@ <string name="preference_autocomplete_prefix_title">Show after prefix</string> <string name="preference_autocomplete_prefix_summary">Suggest nicks and channels after entering @ or #</string> - <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_show_lag_key" translatable="false">show_lag</string> - <string name="preference_show_lag_title">Show lag</string> - <string name="preference_show_lag_summary">Displays the lag between client and core in the action bar</string> - <string name="preference_backlog_title">Backlog</string> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 768aec53125cb908d8f226d8c39f7506b28b8058..880ce39e082b62bc84368134ae8ba782d60f09e0 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -9,6 +9,22 @@ android:key="@string/preference_theme_key" android:title="@string/preference_theme_title" /> + <DropDownPreference + android:defaultValue="EMOJI" + android:entries="@array/preference_input_enter_entries" + android:entryValues="@array/preference_input_enter_entryvalues" + android:key="@string/preference_input_enter_key" + android:title="@string/preference_input_enter_title" /> + + <SwitchPreference + android:defaultValue="false" + android:key="@string/preference_show_lag_key" + android:summary="@string/preference_show_lag_summary" + android:title="@string/preference_show_lag_title" /> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/preference_messages_title"> + <SwitchPreference android:defaultValue="false" android:key="@string/preference_monospace_key" @@ -45,31 +61,23 @@ android:key="@string/preference_colorize_nicknames_key" android:title="@string/preference_colorize_nicknames_title" /> - <DropDownPreference - android:defaultValue="EMOJI" - android:entries="@array/preference_input_enter_entries" - android:entryValues="@array/preference_input_enter_entryvalues" - android:key="@string/preference_input_enter_key" - android:title="@string/preference_input_enter_title" /> - - <DropDownPreference - android:defaultValue="HIGHEST" - android:entries="@array/preference_show_prefix_entries" - android:entryValues="@array/preference_show_prefix_entryvalues" - android:key="@string/preference_show_prefix_key" - android:title="@string/preference_show_prefix_title" /> + <SwitchPreference + android:defaultValue="false" + android:key="@string/preference_nicks_on_new_line_key" + android:summary="@string/preference_nicks_on_new_line_summary" + android:title="@string/preference_nicks_on_new_line_title" /> <SwitchPreference android:defaultValue="false" - android:key="@string/preference_hostmask_key" - android:summary="@string/preference_hostmask_summary" - android:title="@string/preference_hostmask_title" /> + android:key="@string/preference_time_at_end_key" + android:summary="@string/preference_time_at_end_summary" + android:title="@string/preference_time_at_end_title" /> + <!-- <SwitchPreference android:defaultValue="false" - android:key="@string/preference_show_lag_key" - android:summary="@string/preference_show_lag_summary" - android:title="@string/preference_show_lag_title" /> + android:key="@string/preference_show_avatars_key" /> + --> </PreferenceCategory> <PreferenceCategory android:title="@string/preference_autocomplete_title"> diff --git a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt index 27f674a99e2a3010de2a15cbe45d5393a2444adc..b933e85e2647905713143f57da514dce0d4a41d1 100644 --- a/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt +++ b/viewmodel/src/main/java/de/kuschku/quasseldroid/viewmodel/data/FormattedMessage.kt @@ -3,7 +3,9 @@ package de.kuschku.quasseldroid.viewmodel.data class FormattedMessage( val id: Int, val time: CharSequence, - val content: CharSequence, + val name: CharSequence? = null, + val content: CharSequence? = null, + val combined: CharSequence, val isSelected: Boolean, val isExpanded: Boolean, val isMarkerLine: Boolean