How to display still 360 images in full screen like YouTube - google-cardboard

I have to display 360 still images in my Android app. I want the exact same feature like YouTube's 360 video but for still images.
I am essentially lookin for the same functionality of full screen 360 and when clicked on cardboard button switch to cardboard view.
I want to use this in both modes as it will enable the user to choose whether to use the cardboard or not but still be able to move around and view everything.
I want the same features when you open YouTube 360 example
I started reading from getting started for cardboard sdk for Android from here. It talks about using opengl and functionality of selection and updating the UI dynamically using opengl. I don't need those features, I only need to display static 360 images.
Please point me in the right direction.

You can use VrPanoramaView
https://developers.google.com/vr/android/samples/vrview
For the fullscreen, use setDisplayMode
panoWidgetView.setDisplayMode(VrVideoView.DisplayMode.FULLSCREEN_STEREO);

It's really simple to load a panorama image using the cardboard SDK. You need to just include a VrPanoramaView like this in your layout
<com.google.vrtoolkit.cardboard.widgets.pano.VrPanoramaView
android:id="#+id/pano_view"
android:layout_margin="5dip"
android:layout_width="match_parent"
android:scrollbars="#null"
android:layout_height="250dip" />
Inside the Activity, the primary method is
VrPanoramaView.loadImageFromBitmap(). It is given a standard Android
Bitmap object and an optional VrPanoramaView.Options object. The
latter is used to configure the format of the image. The Activity also
implements a VrPanoramaEventListener which receives events when the
load operation succeeds or fails.
Quoted from the Getting Started here.

Related

AgoraKit - How to create a grid style video session layout?

I'm using Agora sdk for video calling feature in my app. I've tried the advance iOS example, and currently able to see the video call between two users.
However my UI needs to show it in grid layout of same size items (maximum 8 video call views)... Like a vertical UICollectionView of equal sized cells. (screenshot below)
I've tried the Advanced video example from here - https://github.com/AgoraIO/Advanced-Video but couldn't figure out how to make the grids.
Kindly guide me how to do this. Thanks.
I have a small demo that creates NxN grids of all the video feeds in a chat in this example.
https://github.com/maxxfrazer/Agora-iOS-Swift-Example/blob/248a1d2291060891f2fda92a657c2067d841d964/Agora-iOS-Example/ChannelViewController%2BVideoControl.swift#L108
it just leaves black holes where the other ones should be if there's not a square number of people in the chat, but hopefully it is enough to get you started with repositioning views based on the number of connected users.

Can I use an SVG image as an button icon?

Is this possible at all? I call Image.createSVG(...) and receive an Image object without any errors. I then call Button.setIcon(). But there's no icon on the button.
You need to check Image.isSVGSupported() which currently will always return false.
Back in the day J2ME supported SVG thru one of the JSR's. No platform since has supported SVG natively with the exception of the web so this doesn't work on any of the modern platforms and we didn't bother implementing this even for the JavaScript port.
In the future we'd like to have a more efficient/portable way of supporting SVG e.g.: https://github.com/codenameone/CodenameOne/issues/1890

Implement a carousel in uwp similar to an Iphone Home screen

Am currently working on a uwp project which involves using a carousel that has some sort of grid of pictures that can be swiped by clicking some round navigation buttons. This is also similar to the carousel in Twitter bootstrap. To get a better picture of this, an example is shown below
Rather than different apps on display, different pictures from the user library would be shown. I would like to dynamically display the first 100 pictures from the user's library. I have searched the internet for something similar to this, but the closest I can get is http://blogs.u2u.be/diederik/post/2015/08/23/A-CoverFlow-control-for-the-Universal-Windows-Platform.aspx.
How can I achieve this?
Have you taken a look at the FlipView class?
https://msdn.microsoft.com/library/windows/apps/br242678
Or the CaouselPanel class?
https://msdn.microsoft.com/library/windows/apps/hh967950
and implemented them with a different data template (perhaps a styled gridview) instead of strictly images?
This is the flipview page from the windows dev center:
https://msdn.microsoft.com/windows/uwp/controls-and-patterns/flipview
It should explain the basics of how the itemcontrol works.
Have a look at FlipView. I hope that is what you are looking for.

How to use manipulation mode to translate an image without clipping

I'm trying to create a simple application that allows the user to move an image with a TranslateTransform inside an Imagecontrol, using the ManipulationDeltaevent Handler.
However, performs the translate manipulation, the image is clipped in a weird way. In fact, it seems that it is the entire viewport which is translated instead of the image inside the viewport.
I have reproduced this behavior in this very simple application:
The code is straightforward and looks like so:
<Image
x:Name="Image"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stretch="None"
ManipulationMode="TranslateX, TranslateY"
ManipulationStarted="Image_ManipulationStarted"
ManipulationCompleted="Image_ManipulationCompleted"
ManipulationDelta="Image_ManipulationDelta"
Source="/Assets/image.png"
>
<Image.RenderTransform>
<TranslateTransform x:Name="Translation" />
</Image.RenderTransform>
</Image>
This is the code behind:
private void Image_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
Translation.X += e.Delta.Translation.X;
Translation.Y += e.Delta.Translation.Y;
}
This application displays a rectangular 600x600 plain red image. I have resized the application so that the image is way bigger than the available client area. When the user slightly moves the image in the upper left direction, this is what the application looks like:
It seems, as I explained, that the entire viewport has been translated.
If I virtually add where the image should be to the screen shot above, this is what I would have expected:
In the screenshot above, one can see that the image is taller than the application so the entire height of the client area should be covered with a red portion of the image. Likewize, since the image has been moved to the left, only a narrow portion of the right screen should be white.
I hope these screenshots help give sense to my explanations.
Please, is it possible to obtain the desired behaviour when using the ManipulationModes?
Please, is it possible to obtain the desired behaviour when using the ManipulationModes?
I think the answer is no, it's not possible to do this in an UWP app, you will need to create a desktop app to obtain the desired behaviour.
In an UWP app, the Page is in a Frame, then the controls or shapes are in the Page, so basically the controls or shapes are all in a Frame container. What you want to do is actually getting the Rectangle out from its container, in this case we need another container for this Rectangle in an UWP app.
So what I could think about for this is creating a new window to hold this Rectangle. But problems will come with this new window, the app's title is along with a new window unless this window is in the full screen mode. Obviously a full screen mode window will not solve the problem.
This function can be done with Win32 APIs, you may refer to C# Drag-and-Drop: Show the dragged item while dragging, but this APIs are not supported in an UWP app. They are for desktop app only. For example, you may refer to CreateIconIndirect function. Besides, I can't find any supported APIs for UWP app which the same functions have.

Images in J2me Lwuit

I have developed an LWUIT app. I have two types of images dispayed in the app. One coming from server side that need to displayed (like a photo posted and saved to server side) and one packaged in my jar and displayed mainly as icons (like a music icon, loading animation gif etc). I need to display all images according to the sreen size and resolution. The first kind is displayed by taking the screen display height and width and then use scale method and show a scaled version of the image. But however I have no idea how to show the second kind. i.e. icons. Example, my loading image looks good in most of the phones but for some phones like samsung, it looks blurred and over-sized. How to do this. My basic idea is to keep 3 types of images of icons like icon_width_lowXheight_low.png, icon_width_mediumXheight_medium.png and image_width_highXheight_high.png and show it based on the screen size. Please let me know the bets way to achieve this?
Thanks,
Parvathy
You should use MultiImages which were added in LWUIT 1.5. I don't have a link for this in LWUIT but our work in Codename One is pretty close to this so check out the How Do I? on multi images (and I suggest migration to Codename One regardless).
I think that you will need to use this
Image i = Image.createImage("your image path here");
i = i.scaled(widthValue, heightValue);
And put this values in relation to the Display.getInstance().getDisplayHeight() and Display.getInstance().getDisplayWidth()
Right?

Resources