Fix some issues

This commit is contained in:
Sylvain Berfini 2013-05-29 11:03:01 +02:00
parent 736755d46a
commit 621eb9f5ec
7 changed files with 29 additions and 19 deletions

View file

@ -123,7 +123,7 @@ run-tests:
$(SDK_PATH)/android update test-project --path . -m ../ && \ $(SDK_PATH)/android update test-project --path . -m ../ && \
ant debug && \ ant debug && \
ant installd && \ ant installd && \
ant test adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner
clean: clean:
$(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) clean $(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) clean

View file

@ -49,7 +49,7 @@ public class CallManager {
void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException { public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
LinphoneCore lc = LinphoneManager.getLc(); LinphoneCore lc = LinphoneManager.getLc();
LinphoneCallParams params = lc.createDefaultCallParameters(); LinphoneCallParams params = lc.createDefaultCallParameters();

View file

@ -253,11 +253,18 @@ public class ChatStorage {
} }
public int getUnreadMessageCount() { public int getUnreadMessageCount() {
return db.query(TABLE_NAME, null, "read LIKE " + NOT_READ, null, null, null, null).getCount(); Cursor c = db.query(TABLE_NAME, null, "read LIKE " + NOT_READ, null, null, null, null);
int count = c.getCount();
c.close();
return count;
} }
public int getUnreadMessageCount(String contact) { public int getUnreadMessageCount(String contact) {
return db.query(TABLE_NAME, null, "remoteContact LIKE \"" + contact + "\" AND read LIKE " + NOT_READ, null, null, null, null).getCount(); Cursor c = db.query(TABLE_NAME, null, "remoteContact LIKE \"" + contact + "\" AND read LIKE " + NOT_READ, null, null, null, null);
int count = c.getCount();
c.close();
return count;
} }
public byte[] getRawImageFromMessage(int id) { public byte[] getRawImageFromMessage(int id) {

View file

@ -101,7 +101,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
String displayednumberOrAddress = numberOrAddress; String displayednumberOrAddress = numberOrAddress;
if (numberOrAddress.startsWith("sip:")) { if (numberOrAddress.startsWith("sip:")) {
displayednumberOrAddress = displayednumberOrAddress.substring(4); displayednumberOrAddress = displayednumberOrAddress.replace("sip:", "");
} }
TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress); TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
@ -116,16 +116,19 @@ public class ContactFragment extends Fragment implements OnClickListener {
} }
v.findViewById(R.id.chat).setOnClickListener(chatListener); v.findViewById(R.id.chat).setOnClickListener(chatListener);
if (LinphoneUtils.isSipAddress(numberOrAddress)) { LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
v.findViewById(R.id.chat).setTag(numberOrAddress); if (lpc != null) {
} else { if (!displayednumberOrAddress.startsWith("sip:")) {
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); numberOrAddress = "sip:" + displayednumberOrAddress;
if (lpc != null) {
if (!numberOrAddress.startsWith("sip:")) {
numberOrAddress = "sip:" + numberOrAddress;
}
v.findViewById(R.id.chat).setTag(numberOrAddress + "@" + lpc.getDomain());
} }
String tag = numberOrAddress;
if (!numberOrAddress.contains("@")) {
tag = numberOrAddress + "@" + lpc.getDomain();
}
v.findViewById(R.id.chat).setTag(tag);
} else {
v.findViewById(R.id.chat).setTag(numberOrAddress);
} }
final String finalNumberOrAddress = numberOrAddress; final String finalNumberOrAddress = numberOrAddress;

View file

@ -157,7 +157,7 @@ public class LinphoneActivity extends FragmentActivity implements
if (findViewById(R.id.fragmentContainer) != null) { if (findViewById(R.id.fragmentContainer) != null) {
dialerFragment = new DialerFragment(); dialerFragment = new DialerFragment();
dialerFragment.setArguments(getIntent().getExtras()); dialerFragment.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, dialerFragment).commit(); getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, dialerFragment, currentFragment.toString()).commit();
selectMenu(FragmentsAvailable.DIALER); selectMenu(FragmentsAvailable.DIALER);
} }
} }
@ -367,7 +367,7 @@ public class LinphoneActivity extends FragmentActivity implements
} }
transaction.addToBackStack(newFragmentType.toString()); transaction.addToBackStack(newFragmentType.toString());
transaction.replace(R.id.fragmentContainer, newFragment); transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString());
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
getSupportFragmentManager().executePendingTransactions(); getSupportFragmentManager().executePendingTransactions();

View file

@ -133,7 +133,7 @@ import android.widget.Toast;
* @author Guillaume Beraudo * @author Guillaume Beraudo
* *
*/ */
public final class LinphoneManager implements LinphoneCoreListener { public class LinphoneManager implements LinphoneCoreListener {
private static LinphoneManager instance; private static LinphoneManager instance;
private Context mServiceContext; private Context mServiceContext;
@ -171,7 +171,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
simpleListeners.remove(listener); simpleListeners.remove(listener);
} }
private LinphoneManager(final Context c, LinphoneServiceListener listener) { protected LinphoneManager(final Context c, LinphoneServiceListener listener) {
sExited=false; sExited=false;
mServiceContext = c; mServiceContext = c;
mListenerDispatcher = new ListenerDispatcher(listener); mListenerDispatcher = new ListenerDispatcher(listener);

View file

@ -80,7 +80,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
* setLatestEventInfo and startActivity() which needs a context. * setLatestEventInfo and startActivity() which needs a context.
*/ */
private Handler mHandler = new Handler(); public Handler mHandler = new Handler();
private static LinphoneService instance; private static LinphoneService instance;
// private boolean mTestDelayElapsed; // add a timer for testing // private boolean mTestDelayElapsed; // add a timer for testing