Skip to content
Snippets Groups Projects
Commit e1639388 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

First version of channel and user info screen

parent 56a43b7e
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<string name="label_crashes">Crashes</string> <string name="label_crashes">Crashes</string>
<string name="label_delete">Delete</string> <string name="label_delete">Delete</string>
<string name="label_delete_all">Delete All</string> <string name="label_delete_all">Delete All</string>
<string name="label_details">Details</string>
<string name="label_disconnect">Disconnect</string> <string name="label_disconnect">Disconnect</string>
<string name="label_filter_messages">Filter Messages</string> <string name="label_filter_messages">Filter Messages</string>
<string name="label_github">GitHub</string> <string name="label_github">GitHub</string>
......
...@@ -6,9 +6,13 @@ import de.kuschku.libquassel.util.Flags ...@@ -6,9 +6,13 @@ import de.kuschku.libquassel.util.Flags
import de.kuschku.libquassel.util.ShortFlag import de.kuschku.libquassel.util.ShortFlag
import de.kuschku.libquassel.util.ShortFlags import de.kuschku.libquassel.util.ShortFlags
data class BufferInfo(var bufferId: Int, var networkId: Int, var type: Buffer_Types, data class BufferInfo(
var bufferId: Int,
var networkId: Int,
var type: Buffer_Types,
var groupId: Int, var groupId: Int,
var bufferName: String?) { var bufferName: String?
) {
enum class Type(override val bit: Short) : ShortFlag<Type> { enum class Type(override val bit: Short) : ShortFlag<Type> {
InvalidBuffer(0x00), InvalidBuffer(0x00),
StatusBuffer(0x01), StatusBuffer(0x01),
......
...@@ -124,6 +124,7 @@ class IrcChannel( ...@@ -124,6 +124,7 @@ class IrcChannel(
_userModes.getOr(ircUser, "") _userModes.getOr(ircUser, "")
} }
fun userModes(): Map<IrcUser, String> = _userModes
fun userModes(nick: String) = network().ircUser(nick)?.let { userModes(it) } ?: "" fun userModes(nick: String) = network().ircUser(nick)?.let { userModes(it) } ?: ""
fun liveUserModes(nick: String) = network().ircUser(nick)?.let { userModes(it) } ?: "" fun liveUserModes(nick: String) = network().ircUser(nick)?.let { userModes(it) } ?: ""
...@@ -370,10 +371,10 @@ class IrcChannel( ...@@ -370,10 +371,10 @@ class IrcChannel(
private var _codecForEncoding: Charset? = null private var _codecForEncoding: Charset? = null
private var _codecForDecoding: Charset? = null private var _codecForDecoding: Charset? = null
private var _A_channelModes: MutableMap<Char, MutableSet<String>> = mutableMapOf() var _A_channelModes: MutableMap<Char, MutableSet<String>> = mutableMapOf()
private var _B_channelModes: MutableMap<Char, String> = mutableMapOf() var _B_channelModes: MutableMap<Char, String> = mutableMapOf()
private var _C_channelModes: MutableMap<Char, String> = mutableMapOf() var _C_channelModes: MutableMap<Char, String> = mutableMapOf()
private var _D_channelModes: MutableSet<Char> = mutableSetOf() var _D_channelModes: MutableSet<Char> = mutableSetOf()
companion object { companion object {
val NULL = IrcChannel("", Network.NULL, SignalProxy.NULL) val NULL = IrcChannel("", Network.NULL, SignalProxy.NULL)
......
...@@ -262,6 +262,9 @@ class Network constructor( ...@@ -262,6 +262,9 @@ class Network constructor(
} }
} }
fun channelModes(): Map<ChannelModeType, Set<Char>>? = _channelModes
fun supports(): Map<String, String> = _supports
fun supports(param: String) = _supports.contains(param.toUpperCase(Locale.US)) fun supports(param: String) = _supports.contains(param.toUpperCase(Locale.US))
fun support(param: String) = _supports.getOr(param, "") fun support(param: String) = _supports.getOr(param, "")
/** /**
...@@ -431,7 +434,7 @@ class Network constructor( ...@@ -431,7 +434,7 @@ class Network constructor(
if (_connectionState == actualConnectionState) if (_connectionState == actualConnectionState)
return return
_connectionState = actualConnectionState _connectionState = actualConnectionState
liveConnectionState.onNext(_connectionState) live_connectionState.onNext(_connectionState)
super.setConnectionState(state) super.setConnectionState(state)
} }
...@@ -884,7 +887,7 @@ class Network constructor( ...@@ -884,7 +887,7 @@ class Network constructor(
private var _currentServer: String = "" private var _currentServer: String = ""
private var _connected: Boolean = false private var _connected: Boolean = false
private var _connectionState: ConnectionState = ConnectionState.Disconnected private var _connectionState: ConnectionState = ConnectionState.Disconnected
val liveConnectionState = BehaviorSubject.createDefault(ConnectionState.Disconnected) val live_connectionState = BehaviorSubject.createDefault(ConnectionState.Disconnected)
private var _prefixes: List<Char>? = null private var _prefixes: List<Char>? = null
private var _prefixModes: List<Char>? = null private var _prefixModes: List<Char>? = null
private var _channelModes: Map<ChannelModeType, Set<Char>>? = null private var _channelModes: Map<ChannelModeType, Set<Char>>? = null
......
...@@ -110,7 +110,7 @@ class QuasselViewModel : ViewModel() { ...@@ -110,7 +110,7 @@ class QuasselViewModel : ViewModel() {
it.updates().map { user -> it.updates().map { user ->
BufferData( BufferData(
info = info, info = info,
network = network.networkInfo(), network = network,
description = user.realName() description = user.realName()
) )
} }
...@@ -123,17 +123,17 @@ class QuasselViewModel : ViewModel() { ...@@ -123,17 +123,17 @@ class QuasselViewModel : ViewModel() {
channel.liveTopic().map { topic -> channel.liveTopic().map { topic ->
BufferData( BufferData(
info = info, info = info,
network = network.networkInfo(), network = network,
description = topic description = topic
) )
} }
} }
} }
BufferInfo.Type.StatusBuffer.toInt() -> { BufferInfo.Type.StatusBuffer.toInt() -> {
network.liveConnectionState.map { network.live_connectionState.map {
BufferData( BufferData(
info = info, info = info,
network = network.networkInfo() network = network
) )
} }
} }
...@@ -315,7 +315,7 @@ class QuasselViewModel : ViewModel() { ...@@ -315,7 +315,7 @@ class QuasselViewModel : ViewModel() {
val network = session.networks[info.networkId] val network = session.networks[info.networkId]
when (info.type.enabledValues().firstOrNull()) { when (info.type.enabledValues().firstOrNull()) {
Buffer_Type.StatusBuffer -> { Buffer_Type.StatusBuffer -> {
network?.liveConnectionState?.map { network?.live_connectionState?.map {
SelectedBufferItem( SelectedBufferItem(
info, info,
connectionState = it, connectionState = it,
...@@ -422,7 +422,7 @@ class QuasselViewModel : ViewModel() { ...@@ -422,7 +422,7 @@ class QuasselViewModel : ViewModel() {
} }
} }
BufferInfo.Type.StatusBuffer.toInt() -> { BufferInfo.Type.StatusBuffer.toInt() -> {
network.liveConnectionState.map { network.live_connectionState.map {
BufferProps( BufferProps(
info = info, info = info,
network = network.networkInfo(), network = network.networkInfo(),
......
package de.kuschku.quasseldroid.viewmodel.data package de.kuschku.quasseldroid.viewmodel.data
import de.kuschku.libquassel.quassel.BufferInfo import de.kuschku.libquassel.quassel.BufferInfo
import de.kuschku.libquassel.quassel.syncables.Network
import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork import de.kuschku.libquassel.quassel.syncables.interfaces.INetwork
data class BufferData( data class BufferData(
val info: BufferInfo? = null, val info: BufferInfo? = null,
val network: INetwork.NetworkInfo? = null, val network: Network? = null,
val description: String? = null val description: String? = null
) )
\ No newline at end of file
package de.kuschku.quasseldroid.viewmodel.data
data class InfoGroup(
val name: String? = null,
val properties: List<InfoProperty>
)
\ No newline at end of file
package de.kuschku.quasseldroid.viewmodel.data
import android.support.annotation.DrawableRes
data class InfoProperty(
val name: CharSequence? = null,
@DrawableRes val icon: Int? = null,
val value: CharSequence
)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment