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;
...
@@ -14,6 +14,7 @@ import chat.rocket.android.realm_helper.RealmModelViewHolder;
public
abstract
class
AbstractMessageViewHolder
extends
RealmModelViewHolder
<
PairedMessage
>
{
public
abstract
class
AbstractMessageViewHolder
extends
RealmModelViewHolder
<
PairedMessage
>
{
protected
final
ImageView
avatar
;
protected
final
ImageView
avatar
;
protected
final
TextView
username
;
protected
final
TextView
username
;
protected
final
TextView
subUsername
;
protected
final
TextView
timestamp
;
protected
final
TextView
timestamp
;
protected
final
View
userAndTimeContainer
;
protected
final
View
userAndTimeContainer
;
protected
final
String
hostname
;
protected
final
String
hostname
;
...
@@ -29,6 +30,7 @@ public abstract class AbstractMessageViewHolder extends RealmModelViewHolder<Pai
...
@@ -29,6 +30,7 @@ public abstract class AbstractMessageViewHolder extends RealmModelViewHolder<Pai
super
(
itemView
);
super
(
itemView
);
avatar
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
avatar
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
user_avatar
);
username
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
username
);
username
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
username
);
subUsername
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
sub_username
);
timestamp
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
timestamp
);
timestamp
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
timestamp
);
userAndTimeContainer
=
itemView
.
findViewById
(
R
.
id
.
user_and_timestamp_container
);
userAndTimeContainer
=
itemView
.
findViewById
(
R
.
id
.
user_and_timestamp_container
);
newDayContainer
=
itemView
.
findViewById
(
R
.
id
.
newday_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 {
...
@@ -31,7 +31,7 @@ public class MessageNormalViewHolder extends AbstractMessageViewHolder {
protected
void
bindMessage
(
PairedMessage
pairedMessage
)
{
protected
void
bindMessage
(
PairedMessage
pairedMessage
)
{
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
)
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
)
.
avatarInto
(
avatar
,
hostname
)
.
avatarInto
(
avatar
,
hostname
)
.
usernameInto
(
username
)
.
usernameInto
(
username
,
subUsername
)
.
timestampInto
(
timestamp
)
.
timestampInto
(
timestamp
)
.
bodyInto
(
body
)
.
bodyInto
(
body
)
.
urlsInto
(
urls
)
.
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 {
...
@@ -24,7 +24,7 @@ public class MessageSystemViewHolder extends AbstractMessageViewHolder {
protected
void
bindMessage
(
PairedMessage
pairedMessage
)
{
protected
void
bindMessage
(
PairedMessage
pairedMessage
)
{
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
)
new
MessageRenderer
(
itemView
.
getContext
(),
pairedMessage
.
target
)
.
avatarInto
(
avatar
,
hostname
)
.
avatarInto
(
avatar
,
hostname
)
.
usernameInto
(
username
)
.
usernameInto
(
username
,
subUsername
)
.
timestampInto
(
timestamp
);
.
timestampInto
(
timestamp
);
if
(
pairedMessage
.
target
!=
null
)
{
if
(
pairedMessage
.
target
!=
null
)
{
...
...
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.java
View file @
e0440062
package
chat
.
rocket
.
android
.
renderer
;
package
chat
.
rocket
.
android
.
renderer
;
import
android.content.Context
;
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.view.View
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
...
@@ -53,12 +48,14 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -53,12 +48,14 @@ public class MessageRenderer extends AbstractRenderer<Message> {
/**
/**
* show Username in textView.
* show Username in textView.
*/
*/
public
MessageRenderer
usernameInto
(
TextView
t
extView
)
{
public
MessageRenderer
usernameInto
(
TextView
usernameTextView
,
TextView
subUsernameT
extView
)
{
if
(
TextUtils
.
isEmpty
(
object
.
getAlias
()))
{
if
(
TextUtils
.
isEmpty
(
object
.
getAlias
()))
{
userRenderer
.
usernameInto
(
textView
);
userRenderer
.
usernameInto
(
usernameTextView
);
if
(
subUsernameTextView
!=
null
)
{
subUsernameTextView
.
setVisibility
(
View
.
GONE
);
}
}
else
{
}
else
{
final
User
user
=
object
.
getUser
();
aliasAndUsernameInto
(
usernameTextView
,
subUsernameTextView
);
setAliasInto
(
object
.
getAlias
(),
user
==
null
?
null
:
user
.
getUsername
(),
textView
);
}
}
return
this
;
return
this
;
}
}
...
@@ -146,21 +143,19 @@ public class MessageRenderer extends AbstractRenderer<Message> {
...
@@ -146,21 +143,19 @@ public class MessageRenderer extends AbstractRenderer<Message> {
.
into
(
imageView
);
.
into
(
imageView
);
}
}
private
void
setAliasInto
(
String
alias
,
String
username
,
TextView
textView
)
{
private
void
aliasAndUsernameInto
(
TextView
aliasTextView
,
TextView
usernameTextView
)
{
final
SpannableStringBuilder
spannableStringBuilder
=
new
SpannableStringBuilder
();
if
(
shouldHandle
(
aliasTextView
))
{
final
ForegroundColorSpan
foregroundColorSpan
=
new
ForegroundColorSpan
(
Color
.
BLACK
);
aliasTextView
.
setText
(
object
.
getAlias
());
spannableStringBuilder
.
append
(
alias
);
if
(
username
!=
null
)
{
spannableStringBuilder
.
append
(
" @"
);
spannableStringBuilder
.
append
(
username
);
}
}
spannableStringBuilder
if
(
shouldHandle
(
usernameTextView
))
{
.
setSpan
(
foregroundColorSpan
,
0
,
alias
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
if
(
object
.
getUser
()
!=
null
)
{
usernameTextView
.
setText
(
"@"
+
object
.
getUser
().
getUsername
());
textView
.
setText
(
spannableStringBuilder
);
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
;
package
chat
.
rocket
.
android
.
renderer
;
import
android.content.Context
;
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.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -44,14 +40,7 @@ public class UserRenderer extends AbstractRenderer<User> {
...
@@ -44,14 +40,7 @@ public class UserRenderer extends AbstractRenderer<User> {
return
this
;
return
this
;
}
}
final
SpannableStringBuilder
spannableStringBuilder
=
new
SpannableStringBuilder
();
textView
.
setText
(
object
.
getUsername
());
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
);
return
this
;
return
this
;
}
}
...
...
app/src/main/res/layout/list_item_normal_message.xml
View file @
e0440062
...
@@ -39,9 +39,20 @@
...
@@ -39,9 +39,20 @@
android:id=
"@+id/username"
android:id=
"@+id/username"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text
Style=
"bold
"
android:text
Appearance=
"@style/TextAppearance.RocketChat.Message.Username
"
tools:text=
"John Doe"
/>
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
<Space
android:layout_width=
"@dimen/margin_8"
android:layout_width=
"@dimen/margin_8"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
...
...
app/src/main/res/layout/list_item_system_message.xml
View file @
e0440062
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
android:id=
"@+id/username"
android:id=
"@+id/username"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text
Style=
"bold
"
android:text
Appearance=
"@style/TextAppearance.RocketChat.Message.Username
"
tools:text=
"John Doe"
/>
tools:text=
"John Doe"
/>
<Space
<Space
...
...
app/src/main/res/values/message_styles.xml
View file @
e0440062
...
@@ -2,4 +2,10 @@
...
@@ -2,4 +2,10 @@
<resources>
<resources>
<color
name=
"newday_color"
>
#e0e0e0
</color>
<color
name=
"newday_color"
>
#e0e0e0
</color>
<color
name=
"newday_text_color"
>
#444444
</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>
</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