PeterStaev / nativescript-photo-editor

🎨 Easily edit an image in your NativeScript app (crop, draw, etc)
Apache License 2.0
47 stars 15 forks source link

Landscape Orientation #5

Closed throwingdarts closed 5 years ago

throwingdarts commented 5 years ago

Thank you for the great plugin! Is there a setting (or can there be) for the editor to open in a landscape orientation?

PeterStaev commented 5 years ago

Hey @throwingdarts , you should be able to use nativescript-orientation plugin to lock your editor in landscape and then when it returns the result to change it again.

throwingdarts commented 5 years ago

Thank you, I will try that. This doesn't seem to be an issue in iOS btw.

PeterStaev commented 5 years ago

Not sure what do you mean under issue?

throwingdarts commented 5 years ago

I just mean in my case my app is in landscape orientation. I have disabled portrait option. However for whatever reason on my android tablet when the photo editor launches it opens in portrait orientation and when closed my app is still in landscape. This is not the case on my iPad. (I have not yet implemented the nativescript-orientation plugin you suggested.)

PeterStaev commented 5 years ago

Aha, it is probably because of this: https://github.com/PeterStaev/nativescript-photo-editor/blob/5a3faf98da20180d7cc78f6d597f35dc06b051ab/android/photoeditor/src/main/AndroidManifest.xml#L10-L16

Even if i remove the hardcoded orientation I'm not sure that it will work as then it will rotate based on device orientation. So I think you should add the above lines in your app's AndroidManifest.xml and set the orientation to be landscape. Then I think it should work.

throwingdarts commented 5 years ago

Thanks @PeterStaev but unfortunately when I add this to my AndroidManifest.xml within the application node the app will no longer build on android platform.

<application android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme">

    <activity
        android:name="com.tns.NativeScriptActivity"
        android:label="@string/title_activity_kimera"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:theme="@style/LaunchScreenTheme"
        android:screenOrientation="landscape">          

        <meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity 
        android:name="com.tangrainc.photoeditor.PhotoEditorActivity" 
        android:screenOrientation="landscape" /> 

    <activity 
        android:name="com.theartofdev.edmodo.cropper.CropImageActivity" 
        android:screenOrientation="landscape" 
        android:theme="@style/Base.Theme.AppCompat" />

    <activity android:name="com.tns.ErrorReportActivity"/>
</application>
PeterStaev commented 5 years ago

And what is the error? 😕

PeterStaev commented 5 years ago

@throwingdarts , version 1.0.3 has been just pushed to npm and this remove the hardcoded screen orientation in the plugin itself. See if that will make any difference in your case.

throwingdarts commented 5 years ago

Version 1.0.3 works perfectly! Thank you so much.