Fix for Message.GetTime
This commit is contained in:
parent
11ff3396fe
commit
21bb188901
4 changed files with 9 additions and 9 deletions
|
@ -81,7 +81,7 @@ public class ChatStorage {
|
||||||
db.update(TABLE_NAME, values, "id LIKE " + id, null);
|
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();
|
ContentValues values = new ContentValues();
|
||||||
if (from.equals("")) {
|
if (from.equals("")) {
|
||||||
values.put("localContact", from);
|
values.put("localContact", from);
|
||||||
|
@ -97,11 +97,11 @@ public class ChatStorage {
|
||||||
values.put("status", LinphoneChatMessage.State.Idle.toInt());
|
values.put("status", LinphoneChatMessage.State.Idle.toInt());
|
||||||
}
|
}
|
||||||
values.put("message", message);
|
values.put("message", message);
|
||||||
values.put("time", System.currentTimeMillis());
|
values.put("time", time);
|
||||||
return (int) db.insert(TABLE_NAME, null, values);
|
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)
|
if (image == null)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class ChatStorage {
|
||||||
image.compress(CompressFormat.JPEG, 100, baos);
|
image.compress(CompressFormat.JPEG, 100, baos);
|
||||||
values.put("image", baos.toByteArray());
|
values.put("image", baos.toByteArray());
|
||||||
|
|
||||||
values.put("time", System.currentTimeMillis());
|
values.put("time", time);
|
||||||
return (int) db.insert(TABLE_NAME, null, values);
|
return (int) db.insert(TABLE_NAME, null, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -740,12 +740,12 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
|
|
||||||
public int onMessageSent(String to, String message) {
|
public int onMessageSent(String to, String message) {
|
||||||
getChatStorage().deleteDraft(to);
|
getChatStorage().deleteDraft(to);
|
||||||
return getChatStorage().saveMessage("", to, message);
|
return getChatStorage().saveMessage("", to, message, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int onMessageSent(String to, Bitmap image, String imageURL) {
|
public int onMessageSent(String to, Bitmap image, String imageURL) {
|
||||||
getChatStorage().deleteDraft(to);
|
getChatStorage().deleteDraft(to);
|
||||||
return getChatStorage().saveMessage("", to, image);
|
return getChatStorage().saveMessage("", to, image, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMessageStateChanged(String to, String message, int newState) {
|
public void onMessageStateChanged(String to, String message, int newState) {
|
||||||
|
|
|
@ -1106,11 +1106,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
String notificationText = null;
|
String notificationText = null;
|
||||||
int id = -1;
|
int id = -1;
|
||||||
if (textMessage != null && textMessage.length() > 0) {
|
if (textMessage != null && textMessage.length() > 0) {
|
||||||
id = chatStorage.saveMessage(from.asStringUriOnly(), "", textMessage);
|
id = chatStorage.saveMessage(from.asStringUriOnly(), "", textMessage, message.getTime());
|
||||||
notificationText = textMessage;
|
notificationText = textMessage;
|
||||||
} else if (url != null && url.length() > 0) {
|
} else if (url != null && url.length() > 0) {
|
||||||
Bitmap bm = ChatFragment.downloadImage(url);
|
Bitmap bm = ChatFragment.downloadImage(url);
|
||||||
id = chatStorage.saveMessage(from.asStringUriOnly(), "", bm);
|
id = chatStorage.saveMessage(from.asStringUriOnly(), "", bm, message.getTime());
|
||||||
notificationText = url;
|
notificationText = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0dadf758c3bcd5ca26011cc2eee63a9abaa3e7fc
|
Subproject commit 3bf7dd21dc68302928e90b5c33949e5ea913bec6
|
Loading…
Reference in a new issue