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.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.PowerManager.WakeLock; import android.os.PowerManager.WakeLock;
import android.util.TypedValue;
import android.view.Display; import android.view.Display;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -440,6 +442,13 @@ public class VideoCallActivity extends Activity implements
} }
} }
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() { private void resizePreview() {
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)) Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay(); .getDefaultDisplay();
@ -451,14 +460,14 @@ public class VideoCallActivity extends Activity implements
w = 176; w = 176;
h = 148; h = 148;
} else { } else {
w = 88; w = 74;
h = 74; h = 88;
} }
if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) {
params = new LayoutParams(h, w); params = new LayoutParams(dpToPixels(h), dpToPixels(w));
} else { } else {
params = new LayoutParams(w, h); params = new LayoutParams(dpToPixels(w), dpToPixels(h));
} }
params.setMargins(0, 0, 15, 15); params.setMargins(0, 0, 15, 15);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

View file

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