replace vectores by arrays in linphone core api

This commit is contained in:
Jehan Monnier 2012-05-02 10:12:08 +02:00
parent 9c7823db22
commit f7d7660662
4 changed files with 11 additions and 11 deletions

View file

@ -20,6 +20,8 @@ package org.linphone;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import org.linphone.core.CallDirection; import org.linphone.core.CallDirection;
@ -110,9 +112,8 @@ public class HistoryActivity extends ListActivity {
class CallHistoryAdapter extends BaseAdapter { class CallHistoryAdapter extends BaseAdapter {
final List<LinphoneCallLog> mLogs; final List<LinphoneCallLog> mLogs;
@SuppressWarnings("unchecked")
CallHistoryAdapter(Context aContext) { CallHistoryAdapter(Context aContext) {
mLogs = LinphoneManager.getLc().getCallLogs(); mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
} }
public int getCount() { public int getCount() {
return mLogs.size(); return mLogs.size();

View file

@ -166,9 +166,8 @@ public final class LinphoneUtils {
return calls; return calls;
} }
@SuppressWarnings("unchecked")
public static final List<LinphoneCall> getLinphoneCalls(LinphoneCore lc) { public static final List<LinphoneCall> getLinphoneCalls(LinphoneCore lc) {
return (List<LinphoneCall>) lc.getCalls(); return (List<LinphoneCall>) Arrays.asList(lc.getCalls());
} }
public static final boolean hasExistingResumeableCall(LinphoneCore lc) { public static final boolean hasExistingResumeableCall(LinphoneCore lc) {

View file

@ -195,11 +195,11 @@ class LinphoneCoreImpl implements LinphoneCore {
acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr); acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr);
} }
public synchronized Vector<LinphoneCallLog> getCallLogs() { public synchronized LinphoneCallLog[] getCallLogs() {
isValid(); isValid();
Vector<LinphoneCallLog> logs = new Vector<LinphoneCallLog>(); LinphoneCallLog[] logs = new LinphoneCallLog[getNumberOfCallLogs(nativePtr)];
for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) {
logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr, i))); logs[i] = new LinphoneCallLogImpl(getCallLog(nativePtr, i));
} }
return logs; return logs;
} }
@ -540,11 +540,11 @@ class LinphoneCoreImpl implements LinphoneCore {
terminateAllCalls(nativePtr); terminateAllCalls(nativePtr);
} }
private native Object getCall(long nativePtr, int position); private native Object getCall(long nativePtr, int position);
@SuppressWarnings("unchecked") public synchronized Vector getCalls() { public synchronized LinphoneCall[] getCalls() {
int size = getCallsNb(nativePtr); int size = getCallsNb(nativePtr);
Vector<LinphoneCall> calls = new Vector<LinphoneCall>(size); LinphoneCall[] calls = new LinphoneCall[size];
for (int i=0; i < size; i++) { for (int i=0; i < size; i++) {
calls.add((LinphoneCall)getCall(nativePtr, i)); calls[i]=((LinphoneCall)getCall(nativePtr, i));
} }
return calls; return calls;
} }

@ -1 +1 @@
Subproject commit d0ced93c25f088c04a9f92b82aa41c5b1f271e23 Subproject commit 504a67b0e74c9d9a23c95e8e38127368c8276804