Languages

Menu
Sites
Language
Support for the 2 landscape orientations

Hi,

 

I would like to support both landscape and landscape_reverse orientations but I don't seem to find the right way of doing it.

I can choose one or the other using Form::SetOrientation but there isn't a mode that support both. I tried to use ORIENTATION_AUTOMATIC but it also support portrait which I don't want.

Any suggestion on how to approach the situation?

 

Thanks,

Stefano

Responses

2 Replies
Alex Dem

Hi,
I think there is no way to acheive this using Form::SetOrientation().
This mode (for 2 landscape modes) should be supported on platform side and enum Tizen::Ui::Orientation should be extended with appropriate state.
p.s. There is device orientation sensor is in Tizen also, but I suppose that big efforts will be performed to use it for this simple case.
Alexey.

Stefano Zanetti

Yes you would expect support for this quite common use case.

I managed to manually adjust the orientation based on accelerometer. I share it here in case someone else needs it. 

 

In a class that support Tizen::Uix::Sensor::ISensorEventListener

OnDataReceived(Tizen::Uix::Sensor::SensorType sensorType, Tizen::Uix::Sensor::SensorData& sensorData, result r) {
....
float accX = 0.0f;
sensorData.GetValue(static_cast<SensorDataKey>(ACCELERATION_DATA_KEY_X), accX);
Orientation orient = GetAppFrame()->GetFrame()->GetCurrentForm()->GetOrientation();
float rotationthreshold = 0.8f;
if (accX < -rotationthreshold && orient != ORIENTATION_LANDSCAPE_REVERSE)
{
    GetAppFrame()->GetFrame()->GetCurrentForm()->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
}
else if (accX > rotationthreshold && orient != ORIENTATION_LANDSCAPE)
{
    GetAppFrame()->GetFrame()->GetCurrentForm()->SetOrientation(ORIENTATION_LANDSCAPE);
}

 

It works fine although the swap is instant. No rotation animation but that seems to be standard on other Tizen Apps at the moment.