Fix camera orientation.
This commit is contained in:
parent
904bc34dbb
commit
0c9c75af60
4 changed files with 14 additions and 20 deletions
|
@ -68,6 +68,7 @@ import android.view.Gravity;
|
|||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -166,12 +167,21 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
|
||||
displayMissedCalls(missedCalls);
|
||||
|
||||
int rotation = Compatibility.getRotation(getWindowManager().getDefaultDisplay());
|
||||
// Inverse landscape rotation to initiate linphoneCore correctly
|
||||
if (rotation == 270)
|
||||
int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
||||
switch (rotation) {
|
||||
case Surface.ROTATION_0:
|
||||
rotation = 0;
|
||||
break;
|
||||
case Surface.ROTATION_90:
|
||||
rotation = 90;
|
||||
else if (rotation == 90)
|
||||
break;
|
||||
case Surface.ROTATION_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case Surface.ROTATION_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
}
|
||||
|
||||
LinphoneManager.getLc().setDeviceRotation(rotation);
|
||||
mAlwaysChangingPhoneAngle = rotation;
|
||||
|
|
|
@ -34,10 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
@TargetApi(8)
|
||||
public class ApiEightPlus {
|
||||
|
||||
public static int getRotation(Display display) {
|
||||
return display.getRotation();
|
||||
}
|
||||
|
||||
public static void initPushNotificationService(Context context) {
|
||||
try {
|
||||
// Starting the push notification service
|
||||
|
|
|
@ -332,10 +332,6 @@ public class ApiFivePlus {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static int getRotation(Display display) {
|
||||
return display.getOrientation();
|
||||
}
|
||||
|
||||
public static Notification createMessageNotification(Context context, String title, String msg, PendingIntent intent) {
|
||||
Notification notif = new Notification();
|
||||
notif.icon = R.drawable.chat_icon_over;
|
||||
|
|
|
@ -159,14 +159,6 @@ public class Compatibility {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static int getRotation(Display display) {
|
||||
if (Version.sdkStrictlyBelow(Version.API08_FROYO_22)) {
|
||||
return ApiFivePlus.getRotation(display);
|
||||
} else {
|
||||
return ApiEightPlus.getRotation(display);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setNotificationLatestEventInfo(Notification notif, Context context, String title, String content, PendingIntent intent) {
|
||||
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30)) {
|
||||
ApiElevenPlus.setNotificationLatestEventInfo(notif, context, title, content, intent);
|
||||
|
|
Loading…
Reference in a new issue