Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
8495618f
Commit
8495618f
authored
Nov 22, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to get the user status drawable.
parent
e118fb44
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
DrawableHelper.kt
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
+21
-0
No files found.
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
View file @
8495618f
...
...
@@ -4,6 +4,7 @@ import android.support.v4.content.ContextCompat
import
android.support.v4.graphics.drawable.DrawableCompat
import
android.widget.EditText
import
android.widget.TextView
import
chat.rocket.android.R
/**
* @author Filipe de Lima Brito (filipedelimabrito@gmail.com)
...
...
@@ -98,4 +99,24 @@ object DrawableHelper {
* @see compoundDrawables
*/
fun
compoundDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
/**
* Returns the user status drawable.
*
* @param userStatus The user status.
* @param context The context.
* @return The user status drawable.
*/
fun
getUserStatusDrawable
(
userStatus
:
String
,
context
:
Context
):
Drawable
{
val
userStatusDrawable
=
getDrawableFromId
(
R
.
drawable
.
ic_user_status_black
,
context
).
mutate
()
wrapDrawable
(
userStatusDrawable
)
when
(
userStatus
)
{
// TODO: create a enum or check if it will come from the SDK
"online"
->
tintDrawable
(
userStatusDrawable
,
context
,
R
.
color
.
colorUserStatusOnline
)
"busy"
->
tintDrawable
(
userStatusDrawable
,
context
,
R
.
color
.
colorUserStatusBusy
)
"away"
->
tintDrawable
(
userStatusDrawable
,
context
,
R
.
color
.
colorUserStatusAway
)
"offline"
->
tintDrawable
(
userStatusDrawable
,
context
,
R
.
color
.
colorUserStatusOffline
)
}
return
userStatusDrawable
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment