Fix for Message.GetTime

This commit is contained in:
Sylvain Berfini 2013-04-11 18:04:07 +02:00
parent 11ff3396fe
commit 21bb188901
4 changed files with 9 additions and 9 deletions

View file

@ -81,7 +81,7 @@ public class ChatStorage {
db.update(TABLE_NAME, values, "id LIKE " + id, null);
}
public int saveMessage(String from, String to, String message) {
public int saveMessage(String from, String to, String message, long time) {
ContentValues values = new ContentValues();
if (from.equals("")) {
values.put("localContact", from);
@ -97,11 +97,11 @@ public class ChatStorage {
values.put("status", LinphoneChatMessage.State.Idle.toInt());
}
values.put("message", message);
values.put("time", System.currentTimeMillis());
values.put("time", time);
return (int) db.insert(TABLE_NAME, null, values);
}
public int saveMessage(String from, String to, Bitmap image) {
public int saveMessage(String from, String to, Bitmap image, long time) {
if (image == null)
return -1;
@ -124,7 +124,7 @@ public class ChatStorage {
image.compress(CompressFormat.JPEG, 100, baos);
values.put("image", baos.toByteArray());
values.put("time", System.currentTimeMillis());
values.put("time", time);
return (int) db.insert(TABLE_NAME, null, values);
}

View file

@ -740,12 +740,12 @@ public class LinphoneActivity extends FragmentActivity implements
public int onMessageSent(String to, String message) {
getChatStorage().deleteDraft(to);
return getChatStorage().saveMessage("", to, message);
return getChatStorage().saveMessage("", to, message, System.currentTimeMillis());
}
public int onMessageSent(String to, Bitmap image, String imageURL) {
getChatStorage().deleteDraft(to);
return getChatStorage().saveMessage("", to, image);
return getChatStorage().saveMessage("", to, image, System.currentTimeMillis());
}
public void onMessageStateChanged(String to, String message, int newState) {

View file

@ -1106,11 +1106,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
String notificationText = null;
int id = -1;
if (textMessage != null && textMessage.length() > 0) {
id = chatStorage.saveMessage(from.asStringUriOnly(), "", textMessage);
id = chatStorage.saveMessage(from.asStringUriOnly(), "", textMessage, message.getTime());
notificationText = textMessage;
} else if (url != null && url.length() > 0) {
Bitmap bm = ChatFragment.downloadImage(url);
id = chatStorage.saveMessage(from.asStringUriOnly(), "", bm);
id = chatStorage.saveMessage(from.asStringUriOnly(), "", bm, message.getTime());
notificationText = url;
}

@ -1 +1 @@
Subproject commit 0dadf758c3bcd5ca26011cc2eee63a9abaa3e7fc
Subproject commit 3bf7dd21dc68302928e90b5c33949e5ea913bec6