whitebear
whitebear

Reputation: 12433

Force Android splash screen on Portlait mode by Titanium

I made application which has four tabas and one uses camera function.

This tab needs both portlait/landscape. Other three tabs use only porlait mode.

Now I set like this for iOS

in tiapp.xml

<ios>
    <plist>
        <dict>
            <key>UISupportedInterfaceOrientations~iphone</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
            </array>
            <key>UISupportedInterfaceOrientations~ipad</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
            </array>
        </dict>
    </plist>
</ios>

then in app.js

Force orientation like this.

tabWin1.orientationModes = [Ti.UI.PORTRAIT];
tabWin2.orientationModes = [Ti.UI.PORTRAIT];
tabWin3.orientationModes = [Ti.UI.PORTRAIT];
tabWin4.orientationModes = [Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_RIGHT,Ti.UI.LANDSCAPE_LEFT];

It works perfect. Even I hold iPhone landscape and start application, splash screen is forced to portlait mode.

Now I want to do the same thing for in Android

in tiapp.xml

I set like this.

<application>
    <activity
        android:configChanges="keyboardHidden|orientation"
        android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
    <activity
        android:configChanges="keyboardHidden|orientation"
        android:name="org.appcelerator.titanium.TiTranslucentActivity"
        android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent"/>
    <activity
        android:configChanges="keyboardHidden|orientation"
        android:name="org.appcelerator.titanium.TiModalActivity"
        android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent"/>
    <activity
        android:configChanges="keyboardHidden|orientation"
        android:name="ti.modules.titanium.ui.TiTabActivity" android:screenOrientation="portrait"/>
    <activity
        android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:screenOrientation="portrait"/>            
</application>

However it doesn't force the splash screen in portlait mode.

How can I fix it?

Upvotes: 0

Views: 874

Answers (1)

Thomas Lemaitre
Thomas Lemaitre

Reputation: 1154

If you want locking the Splash screen in Portrait mode, you must lock the Android Activity (follow this step : http://bencoding.com/2016/02/11/android-orientation-locking-for-titanium/).

But ! If you do this, your entire app will be lock in Portrait. I don't think there is way to lock the splashscreen in Portrait mode and set a Window to Landscape mode after (it's explain here : http://docs.appcelerator.com/platform/latest/#!/guide/Orientation-section-29004932_Orientation-LimitingorientationmodesonAndroid)

Upvotes: 2

Related Questions