Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
QuasselDroid-ng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
QuasselDroid-ng
Commits
d12c63f1
Verified
Commit
d12c63f1
authored
7 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Reuse theming logic for notification sender colors
Signed-off-by:
Janne Koschinski
<
janne@kuschku.de
>
parent
ebde7dc0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt
+43
-13
43 additions, 13 deletions
...uschku/quasseldroid/service/QuasselNotificationBackend.kt
app/src/main/res/values/colors.xml
+0
-17
0 additions, 17 deletions
app/src/main/res/values/colors.xml
with
43 additions
and
30 deletions
app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt
+
43
−
13
View file @
d12c63f1
...
...
@@ -20,6 +20,7 @@
package
de.kuschku.quasseldroid.service
import
android.content.Context
import
android.support.annotation.ColorInt
import
android.text.SpannableStringBuilder
import
de.kuschku.libquassel.protocol.*
import
de.kuschku.libquassel.quassel.BufferInfo
...
...
@@ -32,14 +33,15 @@ import de.kuschku.libquassel.util.irc.HostmaskHelper
import
de.kuschku.quasseldroid.GlideApp
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.settings.NotificationSettings
import
de.kuschku.quasseldroid.settings.Settings
import
de.kuschku.quasseldroid.util.AvatarHelper
import
de.kuschku.quasseldroid.util.NotificationMessage
import
de.kuschku.quasseldroid.util.QuasseldroidNotificationManager
import
de.kuschku.quasseldroid.util.helper.getColorCompat
import
de.kuschku.quasseldroid.util.helper.loadWithFallbacks
import
de.kuschku.quasseldroid.util.helper.styledAttributes
import
de.kuschku.quasseldroid.util.irc.format.ContentFormatter
import
de.kuschku.quasseldroid.util.ui.TextDrawable
import
javax.inject.Inject
...
...
@@ -50,21 +52,33 @@ class QuasselNotificationBackend @Inject constructor(
private
val
contentFormatter
:
ContentFormatter
,
private
val
notificationHandler
:
QuasseldroidNotificationManager
)
:
NotificationManager
{
private
val
senderColors
=
listOf
(
R
.
color
.
senderColor0
,
R
.
color
.
senderColor1
,
R
.
color
.
senderColor2
,
R
.
color
.
senderColor3
,
R
.
color
.
senderColor4
,
R
.
color
.
senderColor5
,
R
.
color
.
senderColor6
,
R
.
color
.
senderColor7
,
R
.
color
.
senderColor8
,
R
.
color
.
senderColor9
,
R
.
color
.
senderColorA
,
R
.
color
.
senderColorB
,
R
.
color
.
senderColorC
,
R
.
color
.
senderColorD
,
R
.
color
.
senderColorE
,
R
.
color
.
senderColorF
).
map
(
context
::
getColorCompat
).
toIntArray
()
private
var
notificationSettings
:
NotificationSettings
private
var
appearanceSettings
:
AppearanceSettings
private
var
messageSettings
:
MessageSettings
private
lateinit
var
notificationSettings
:
NotificationSettings
private
lateinit
var
messageSettings
:
MessageSettings
private
val
selfColor
=
context
.
getColorCompat
(
android
.
R
.
color
.
background_dark
)
@ColorInt
private
var
selfColor
:
Int
private
var
senderColors
:
IntArray
init
{
updateSettings
()
notificationSettings
=
Settings
.
notification
(
context
)
appearanceSettings
=
Settings
.
appearance
(
context
)
messageSettings
=
Settings
.
message
(
context
)
context
.
setTheme
(
AppearanceSettings
.
DEFAULT
.
theme
.
style
)
senderColors
=
context
.
theme
.
styledAttributes
(
R
.
attr
.
senderColor0
,
R
.
attr
.
senderColor1
,
R
.
attr
.
senderColor2
,
R
.
attr
.
senderColor3
,
R
.
attr
.
senderColor4
,
R
.
attr
.
senderColor5
,
R
.
attr
.
senderColor6
,
R
.
attr
.
senderColor7
,
R
.
attr
.
senderColor8
,
R
.
attr
.
senderColor9
,
R
.
attr
.
senderColorA
,
R
.
attr
.
senderColorB
,
R
.
attr
.
senderColorC
,
R
.
attr
.
senderColorD
,
R
.
attr
.
senderColorE
,
R
.
attr
.
senderColorF
)
{
IntArray
(
16
)
{
getColor
(
it
,
0
)
}
}
selfColor
=
context
.
theme
.
styledAttributes
(
R
.
attr
.
colorForegroundSecondary
)
{
getColor
(
0
,
0
)
}
}
override
fun
init
(
session
:
Session
)
{
...
...
@@ -112,7 +126,23 @@ class QuasselNotificationBackend @Inject constructor(
fun
updateSettings
()
{
notificationSettings
=
Settings
.
notification
(
context
)
appearanceSettings
=
Settings
.
appearance
(
context
)
messageSettings
=
Settings
.
message
(
context
)
context
.
setTheme
(
AppearanceSettings
.
DEFAULT
.
theme
.
style
)
senderColors
=
context
.
theme
.
styledAttributes
(
R
.
attr
.
senderColor0
,
R
.
attr
.
senderColor1
,
R
.
attr
.
senderColor2
,
R
.
attr
.
senderColor3
,
R
.
attr
.
senderColor4
,
R
.
attr
.
senderColor5
,
R
.
attr
.
senderColor6
,
R
.
attr
.
senderColor7
,
R
.
attr
.
senderColor8
,
R
.
attr
.
senderColor9
,
R
.
attr
.
senderColorA
,
R
.
attr
.
senderColorB
,
R
.
attr
.
senderColorC
,
R
.
attr
.
senderColorD
,
R
.
attr
.
senderColorE
,
R
.
attr
.
senderColorF
)
{
IntArray
(
16
)
{
getColor
(
it
,
0
)
}
}
selfColor
=
context
.
theme
.
styledAttributes
(
R
.
attr
.
colorForegroundSecondary
)
{
getColor
(
0
,
0
)
}
}
@Synchronized
...
...
This diff is collapsed.
Click to expand it.
app/src/main/res/values/colors.xml
+
0
−
17
View file @
d12c63f1
...
...
@@ -40,23 +40,6 @@
<color
name=
"ripple_dark"
>
#33ffffff
</color>
<color
name=
"ripple_light"
>
#1f000000
</color>
<color
name=
"senderColor0"
>
#F44336
</color>
<color
name=
"senderColor1"
>
#2196F3
</color>
<color
name=
"senderColor2"
>
#7CB342
</color>
<color
name=
"senderColor3"
>
#7B1FA2
</color>
<color
name=
"senderColor4"
>
#DA8E00
</color>
<color
name=
"senderColor5"
>
#4CAF50
</color>
<color
name=
"senderColor6"
>
#3F51B5
</color>
<color
name=
"senderColor7"
>
#E91E63
</color>
<color
name=
"senderColor8"
>
#b94600
</color>
<color
name=
"senderColor9"
>
#9E9D24
</color>
<color
name=
"senderColorA"
>
#558B2F
</color>
<color
name=
"senderColorB"
>
#009688
</color>
<color
name=
"senderColorC"
>
#0277BD
</color>
<color
name=
"senderColorD"
>
#00838F
</color>
<color
name=
"senderColorE"
>
#9C27B0
</color>
<color
name=
"senderColorF"
>
#C51162
</color>
<!-- mirc colors -->
<color
name=
"mircColor00"
>
#ffffff
</color>
<color
name=
"mircColor01"
>
#000000
</color>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment