adapt to location-rendering-api

This commit is contained in:
B. Petersen
2019-03-06 21:48:07 +01:00
parent 59716c2909
commit ee8480787c
3 changed files with 95 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
package com.b44t.messenger;
public class DcArray {
public DcArray(long arrayCPtr) {
this.arrayCPtr = arrayCPtr;
}
@Override protected void finalize() throws Throwable {
super.finalize();
unrefArrayCPtr();
arrayCPtr = 0;
}
public native int getCnt ();
public native float getLatitude (int index);
public native float getLongitude(int index);
public native float getAccuracy (int index);
public native long getTimestamp(int index);
public native int getMsgId (int index);
// working with raw c-data
private long arrayCPtr; // CAVE: the name is referenced in the JNI
private native void unrefArrayCPtr();
}
+3
View File
@@ -21,6 +21,7 @@ public class DcContext {
public final static int DC_EVENT_MSG_READ = 2015;
public final static int DC_EVENT_CHAT_MODIFIED = 2020;
public final static int DC_EVENT_CONTACTS_CHANGED = 2030;
public final static int DC_EVENT_LOCATION_CHANGED = 2035;
public final static int DC_EVENT_CONFIGURE_PROGRESS = 2041;
public final static int DC_EVENT_IMEX_PROGRESS = 2051;
public final static int DC_EVENT_IMEX_FILE_WRITTEN = 2052;
@@ -154,6 +155,7 @@ public class DcContext {
public native int joinSecurejoin (String qr);
public native void sendLocationsToChat (int chat_id, int seconds);
public native boolean isSendingLocationsToChat(int chat_id);
public @NonNull DcArray getLocations (int chat_id, int contact_id) { return new DcArray(getLocationsCPtr(chat_id, contact_id)); }
/**
* @return true if at least one chat has location streaming enabled
@@ -180,4 +182,5 @@ public class DcContext {
private native long getMsgCPtr (int id);
private native long getDraftCPtr (int id);
private native long getContactCPtr (int id);
private native long getLocationsCPtr (int chat_id, int contact_id);
}