Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-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
xabber-android
Commits
9d3afd55
Commit
9d3afd55
authored
Apr 16, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Last outgoing message and time are displayed in active chats.
parent
1787ea35
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
+24
-14
AbstractChat.java
...in/java/com/xabber/android/data/message/AbstractChat.java
+5
-6
ContactItemInflater.java
...va/com/xabber/android/ui/adapter/ContactItemInflater.java
+19
-8
No files found.
app/src/main/java/com/xabber/android/data/message/AbstractChat.java
View file @
9d3afd55
...
...
@@ -451,8 +451,9 @@ public abstract class AbstractChat extends BaseEntity {
for
(
int
index
=
messages
.
size
()
-
1
;
index
>=
0
;
index
--)
{
MessageItem
messageItem
=
messages
.
get
(
index
);
if
(
messageItem
.
getAction
()
==
null
)
{
lastText
=
messageItem
.
isIncoming
()
?
messageItem
.
getText
()
:
""
;
String
lastMessage
=
messageItem
.
getText
();
lastText
=
messageItem
.
isIncoming
()
?
"< "
+
lastMessage
:
"> "
+
lastMessage
;
lastTime
=
messageItem
.
getTimestamp
();
return
;
}
...
...
@@ -467,8 +468,7 @@ public abstract class AbstractChat extends BaseEntity {
Application
.
getInstance
().
runInBackground
(
new
Runnable
()
{
@Override
public
void
run
()
{
MessageTable
.
getInstance
().
removeMessages
(
MessageManager
.
getMessageIds
(
messageItems
,
true
));
MessageTable
.
getInstance
().
removeMessages
(
MessageManager
.
getMessageIds
(
messageItems
,
true
));
}
});
}
...
...
@@ -482,8 +482,7 @@ public abstract class AbstractChat extends BaseEntity {
Application
.
getInstance
().
runInBackground
(
new
Runnable
()
{
@Override
public
void
run
()
{
MessageTable
.
getInstance
().
removeMessages
(
MessageManager
.
getMessageIds
(
messageItems
,
true
));
MessageTable
.
getInstance
().
removeMessages
(
MessageManager
.
getMessageIds
(
messageItems
,
true
));
MessageTable
.
getInstance
().
removeMessages
(
historyIds
);
historyIds
.
clear
();
}
...
...
app/src/main/java/com/xabber/android/ui/adapter/ContactItemInflater.java
View file @
9d3afd55
...
...
@@ -15,8 +15,11 @@ import com.xabber.android.data.message.MessageManager;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.ui.ContactEditor
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.android.utils.StringUtils
;
import
com.xabber.androiddev.R
;
import
java.util.Date
;
public
class
ContactItemInflater
{
static
class
ContactViewHolder
{
...
...
@@ -78,13 +81,7 @@ public class ContactItemInflater {
viewHolder
.
avatar
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
MUCManager
.
getInstance
().
hasRoom
(
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()))
{
context
.
startActivity
(
ContactViewer
.
createIntent
(
context
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
}
else
{
context
.
startActivity
(
ContactEditor
.
createIntent
(
context
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
}
onAvatarClick
(
abstractContact
);
}
});
...
...
@@ -93,8 +90,12 @@ public class ContactItemInflater {
if
(
MessageManager
.
getInstance
()
.
hasActiveChat
(
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()))
{
statusText
=
MessageManager
.
getInstance
()
String
lastMessage
=
MessageManager
.
getInstance
()
.
getLastText
(
abstractContact
.
getAccount
(),
abstractContact
.
getUser
());
Date
lastTime
=
MessageManager
.
getInstance
()
.
getLastTime
(
abstractContact
.
getAccount
(),
abstractContact
.
getUser
());
statusText
=
StringUtils
.
getSmartTimeText
(
context
,
lastTime
)
+
" "
+
lastMessage
;
}
else
{
statusText
=
abstractContact
.
getStatusText
();
}
...
...
@@ -126,4 +127,14 @@ public class ContactItemInflater {
return
view
;
}
private
void
onAvatarClick
(
AbstractContact
contact
)
{
if
(
MUCManager
.
getInstance
().
hasRoom
(
contact
.
getAccount
(),
contact
.
getUser
()))
{
context
.
startActivity
(
ContactViewer
.
createIntent
(
context
,
contact
.
getAccount
(),
contact
.
getUser
()));
}
else
{
context
.
startActivity
(
ContactEditor
.
createIntent
(
context
,
contact
.
getAccount
(),
contact
.
getUser
()));
}
}
}
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