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
e0440062
Commit
e0440062
authored
Jan 25, 2017
by
Yusuke Iwaki
Committed by
GitHub
Jan 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into alternative_websocket_connection_management
parents
609f9bda
d278e218
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
38 deletions
+41
-38
AbstractMessageViewHolder.java
...roid/layouthelper/chatroom/AbstractMessageViewHolder.java
+2
-0
MessageNormalViewHolder.java
...ndroid/layouthelper/chatroom/MessageNormalViewHolder.java
+1
-1
MessageSystemViewHolder.java
...ndroid/layouthelper/chatroom/MessageSystemViewHolder.java
+1
-1
MessageRenderer.java
...in/java/chat/rocket/android/renderer/MessageRenderer.java
+17
-22
UserRenderer.java
.../main/java/chat/rocket/android/renderer/UserRenderer.java
+1
-12
list_item_normal_message.xml
app/src/main/res/layout/list_item_normal_message.xml
+12
-1
list_item_system_message.xml
app/src/main/res/layout/list_item_system_message.xml
+1
-1
message_styles.xml
app/src/main/res/values/message_styles.xml
+6
-0
No files found.
app/src/main/java/chat/rocket/android/layouthelper/chatroom/AbstractMessageViewHolder.java
View file @
e0440062
...
...
@@ -14,6 +14,7 @@ import chat.rocket.android.realm_helper.RealmModelViewHolder;
public
abstract
class
AbstractMessageViewHolder
extends
RealmModelViewHolder
<
PairedMessage
>
{
protected
final
ImageView
avatar
;
protected
final
TextView
username
;
protected
final
TextView
subUsername
;
protected
final
TextView
timestamp
;
protected
final
View
userAndTimeContainer
;
protected
final
String
hostname
;
...
...
@@ -29,6 +30,7 @@ public abstract class AbstractMessageViewHolder extends RealmModelViewHolder<Pai
super
(
itemView
);
avatar
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
username
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
username
);
subUsername
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
sub_username
);
timestamp
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
timestamp
);
userAndTimeContainer
=
itemView
.
findViewById
(
R
.
id
.
user_and_timestamp_container
);
newDayContainer
=
itemView
.
findViewById
(
R
.
id
.
newday_container
);
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageNormalViewHolder.java
View file @
e0440062
...
...
@@ -31,7 +31,7 @@ public class MessageNormalViewHolder extends AbstractMessageViewHolder {
protected
void
bindMessage
(
PairedMessage
pairedMessage
)
{
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
)
.
avatarInto
(
avatar
,
hostname
)
.
usernameInto
(
username
)
.
usernameInto
(
username
,
subUsername
)
.
timestampInto
(
timestamp
)
.
bodyInto
(
body
)
.
urlsInto
(
urls
)
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageSystemViewHolder.java
View file @
e0440062
...
...
@@ -24,7 +24,7 @@ public class MessageSystemViewHolder extends AbstractMessageViewHolder {
protected
void
bindMessage
(
PairedMessage
pairedMessage
)
{
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
)
.
avatarInto
(
avatar
,
hostname
)
.
usernameInto
(
username
)
.
usernameInto
(
username
,
subUsername
)
.
timestampInto
(
timestamp
);
if
(
pairedMessage
.
target
!=
null
)
{
...
...
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.java
View file @
e0440062
package
chat
.
rocket
.
android
.
renderer
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.text.Spannable
;
import
android.text.SpannableStringBuilder
;
import
android.text.style.ForegroundColorSpan
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.squareup.picasso.Picasso
;
import
chat.rocket.android.R
;
...
...
@@ -53,12 +48,14 @@ public class MessageRenderer extends AbstractRenderer<Message> {
/**
* show Username in textView.
*/
public
MessageRenderer
usernameInto
(
TextView
t
extView
)
{
public
MessageRenderer
usernameInto
(
TextView
usernameTextView
,
TextView
subUsernameT
extView
)
{
if
(
TextUtils
.
isEmpty
(
object
.
getAlias
()))
{
userRenderer
.
usernameInto
(
textView
);
userRenderer
.
usernameInto
(
usernameTextView
);
if
(
subUsernameTextView
!=
null
)
{
subUsernameTextView
.
setVisibility
(
View
.
GONE
);
}
}
else
{
final
User
user
=
object
.
getUser
();
setAliasInto
(
object
.
getAlias
(),
user
==
null
?
null
:
user
.
getUsername
(),
textView
);
aliasAndUsernameInto
(
usernameTextView
,
subUsernameTextView
);
}
return
this
;
}
...
...
@@ -146,21 +143,19 @@ public class MessageRenderer extends AbstractRenderer<Message> {
.
into
(
imageView
);
}
private
void
setAliasInto
(
String
alias
,
String
username
,
TextView
textView
)
{
final
SpannableStringBuilder
spannableStringBuilder
=
new
SpannableStringBuilder
();
final
ForegroundColorSpan
foregroundColorSpan
=
new
ForegroundColorSpan
(
Color
.
BLACK
);
spannableStringBuilder
.
append
(
alias
);
if
(
username
!=
null
)
{
spannableStringBuilder
.
append
(
" @"
);
spannableStringBuilder
.
append
(
username
);
private
void
aliasAndUsernameInto
(
TextView
aliasTextView
,
TextView
usernameTextView
)
{
if
(
shouldHandle
(
aliasTextView
))
{
aliasTextView
.
setText
(
object
.
getAlias
());
}
spannableStringBuilder
.
setSpan
(
foregroundColorSpan
,
0
,
alias
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
textView
.
setText
(
spannableStringBuilder
);
if
(
shouldHandle
(
usernameTextView
))
{
if
(
object
.
getUser
()
!=
null
)
{
usernameTextView
.
setText
(
"@"
+
object
.
getUser
().
getUsername
());
usernameTextView
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
usernameTextView
.
setVisibility
(
View
.
GONE
);
}
}
}
}
app/src/main/java/chat/rocket/android/renderer/UserRenderer.java
View file @
e0440062
package
chat
.
rocket
.
android
.
renderer
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.text.Spannable
;
import
android.text.SpannableStringBuilder
;
import
android.text.style.ForegroundColorSpan
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
...
...
@@ -44,14 +40,7 @@ public class UserRenderer extends AbstractRenderer<User> {
return
this
;
}
final
SpannableStringBuilder
spannableStringBuilder
=
new
SpannableStringBuilder
();
final
ForegroundColorSpan
foregroundColorSpan
=
new
ForegroundColorSpan
(
Color
.
BLACK
);
spannableStringBuilder
.
append
(
object
.
getUsername
());
spannableStringBuilder
.
setSpan
(
foregroundColorSpan
,
0
,
object
.
getUsername
().
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
textView
.
setText
(
spannableStringBuilder
);
textView
.
setText
(
object
.
getUsername
());
return
this
;
}
...
...
app/src/main/res/layout/list_item_normal_message.xml
View file @
e0440062
...
...
@@ -39,9 +39,20 @@
android:id=
"@+id/username"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text
Style=
"bold
"
android:text
Appearance=
"@style/TextAppearance.RocketChat.Message.Username
"
tools:text=
"John Doe"
/>
<Space
android:layout_width=
"4dp"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/sub_username"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"@style/TextAppearance.RocketChat.Message.SubUsername"
tools:text=
"\@John Doe"
/>
<Space
android:layout_width=
"@dimen/margin_8"
android:layout_height=
"wrap_content"
/>
...
...
app/src/main/res/layout/list_item_system_message.xml
View file @
e0440062
...
...
@@ -38,7 +38,7 @@
android:id=
"@+id/username"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text
Style=
"bold
"
android:text
Appearance=
"@style/TextAppearance.RocketChat.Message.Username
"
tools:text=
"John Doe"
/>
<Space
...
...
app/src/main/res/values/message_styles.xml
View file @
e0440062
...
...
@@ -2,4 +2,10 @@
<resources>
<color
name=
"newday_color"
>
#e0e0e0
</color>
<color
name=
"newday_text_color"
>
#444444
</color>
<style
name=
"TextAppearance.RocketChat.Message.Username"
parent=
"TextAppearance.AppCompat.Body2"
>
<item
name=
"android:textColor"
>
#bb000000
</item>
</style>
<style
name=
"TextAppearance.RocketChat.Message.SubUsername"
parent=
"TextAppearance.AppCompat.Body1"
>
<item
name=
"android:textColor"
>
#5f000000
</item>
</style>
</resources>
\ 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