Mobile-UXSDK-Android icon indicating copy to clipboard operation
Mobile-UXSDK-Android copied to clipboard

FPVWidget not resizing correctly

Open ITCCodeDev opened this issue 6 years ago • 2 comments

The FPVWidget is not resizing correctly (i.e. when width is set to "match_parent" in a full screen layout element it is not covering the full width of the screen). I have just included the widget in my xml file as follows -

       <dji.ui.widget.FPVWidget
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"/>
        <dji.ui.widget.FPVOverlayWidget
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"/>

I have instantiated the FPVWidget in the activity and resize the window on clicking a toggle switch. On resizing it I have the layout parameters as follows -

final FrameLayout.LayoutParams fpvLayoutParams = new FrameLayout.LayoutParams(
    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
);

I apply these parameters to the widget view using view.setLayoutParams(fpvLayoutParams). There are no crashes in the logcat but the resizing does not work as expected. I also tried using the CameraLiveView in the XML without configuring it separately as mentioned here but that did not work at all. DJI Android UI-Library v4.4.1 and Mobile SDK v4.4.1 Testing with a DJI Inspire 1 v2 and a Lenovo Tab 4 8 Plus Tablet Android v7.1.1 Android Studio v3.0.1 Not using the sample code to do this - I have specified the elements causing the issues.

ITCCodeDev avatar Mar 22 '18 20:03 ITCCodeDev

My thoughts ...

You declared FrameLayout.LayoutParams using the Java "final" construct, doesn't this make the instance "static" with no possibility to modify later?

RobSherratt avatar Apr 02 '18 13:04 RobSherratt

No, the "final" construct is just so it can be used in the setOnCheckedChangeListener for the switch I was trying to use to do the resizing - I don't actually change that variable, just use it to set the size. I did the same thing using the TextureView and programmatically implementing the video callback instead of using the widget and it works perfectly. Also, as I mentioned earlier, it did "work" to some extent, just that it didn't actually cover the full width/height of the window like it should if the "match_parent" parameters are used, pointing to an issue with the internal implementation of the widget.

ITCCodeDev avatar Apr 04 '18 19:04 ITCCodeDev