Fixes for smartphones

This commit is contained in:
Sylvain Berfini 2012-04-27 16:53:03 +02:00
parent adcc6657bc
commit a938cc5fc2
2 changed files with 15 additions and 5 deletions

View file

@ -35,11 +35,13 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.util.TypedValue;
import android.view.Display;
import android.view.KeyEvent;
import android.view.Menu;
@ -439,6 +441,13 @@ public class VideoCallActivity extends Activity implements
finish();
}
}
private int dpToPixels(int dp){
Resources r = getResources();
int px = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
r.getDisplayMetrics());
return px;
}
private void resizePreview() {
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
@ -451,14 +460,14 @@ public class VideoCallActivity extends Activity implements
w = 176;
h = 148;
} else {
w = 88;
h = 74;
w = 74;
h = 88;
}
if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) {
params = new LayoutParams(h, w);
params = new LayoutParams(dpToPixels(h), dpToPixels(w));
} else {
params = new LayoutParams(w, h);
params = new LayoutParams(dpToPixels(w), dpToPixels(h));
}
params.setMargins(0, 0, 15, 15);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

View file

@ -68,6 +68,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
//Main library
if (!hasNeonInCpuFeatures()) {
System.loadLibrary("linphonenoneon");
Log.w("linphone", "No-neon liblinphone loaded");
} else {
System.loadLibrary("linphone");
}
@ -150,7 +151,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
byte[] re = new byte[1024];
while(in.read(re) != -1){
String line = new String(re);
if (line.startsWith("Features")) {
if (line.contains("Features")) {
result = line.contains("neon");
break;
}