How to display multiple camera previews with different effects? - android

I am trying to achieve this on android.
Any idea on how I can do this? I couldn't find any examples that use multiple camera previews. I am aware of the library "grafika", however from what I understood it uses 1 view (TextureView) if I'm not wrong, and then positions all the previews on it, therefor it remains a single view, which is not what I want. Each camera preview has to be separated in it's own view.

Related

Is it possible to host (or mimicking hosting) of views withing live wallpaper?

background
I've made a simple app called "LWP+", which shows a cropped image . When the user chooses a photo, I save it into a file, and then do the cropping when needed. I do this by using 2 libraries. One for allowing the user to choose the cropping rectangle, and one for the actual cropping.
The problem
This is just for a normal cropping, but a nicer feature I'd like to add is a way to scroll through the content of the entire given image, at least horizontally.
On a normal Activity, I'd probably use a ViewPager that has an ImageView for each page.
But here a live wallpaper doesn't really have a layout.
What I've found
There isn't much of information about live wallpapers in general, but when I've searched for scrolling of an image in it, I've found just how to move the canvas.
This can actually be a good idea, of somehow having bitmaps (or partial decoding of the image) around the current position, and translating the canvas as needed. I could also use a GestureDetector class to identify flinging, but this is only a tiny fraction of what's needed to do a nice scrolling of a zoomed image.
It is also very complex, as it requires good memory considerations in mind.
If I could use a normal view, I could have used a ViewPager, or even a third library that shows an image and allows to scroll in it freely , like in the gallery app (such as this one).
The question
Given a View of any kind, such as ViewPager or another, is it possible to host it somehow inside the LiveWallpaper, to let it show content, and to handle touch events ?
Alternatively, is there an efficient way to view content as I've written, yet in a live wallpaper? Meaning viewing a portion of a large image, while allowing to scroll though it (like a ViewPager, but maybe even freely like on a photo viewer library, in all directions) ?

Difference between SurfaceView and ImageView

I would like to know what is the difference between SurfaceView and ImageView and their usage scenarios. Both seem to be the same. Kindly direct me if there are proper links which I had probably missed.
Some advantages and differences of a surface view:
Better rendering mechanism. threads can update the surface's content without using a handler. This helps for better performance in games and too much animation.
So if you need to update GUI rapidly or if the rendering takes too much time and affects user experience then Surfaceview is advisable instead of imageview.
Surfaceviews cannot be transparent, they can only appear behind other elements in the view hierarchy.
Surfaceview has dedicated buffer, too. So it costs more resources than imageview and other views.
Here is a reference links which you could refer to understand better.
Difference between SurfaceView and View?
Hope this clears some doubt.
Basically the difference lies on how both the views are being processed internally.
Surface View, has more rendering options. The view implicitly can render the images or animations using the graphics hardware. It doesn't need any third party support ( or makes less use of ) to make the animation work.
Preferably used when you want too many animations to be used. The View renders them automatically to the screen size. Ex: gaming applications.
Image View, is preferably when you want to display more of static images. The View render the images to any layout size. But when you have any animations on the page, the View takes support of GUI related conversions.

Draggable split-view with image preview

I am trying to implement the above layout in my Android app.
Basically its two images filling the whole screen, but with a "slider" that is draggable and masks one image over the other. The labels are just some text relating to the image, and should also be masked over when dragged.
So far I haven't been able to see how best to do this using standard layouts, and have been thinking of how to implement this using Canvas.
Any help/tips on the most efficient way to implement this would be appreciated.
NOTE: The slider is supposed to work a lot like the one in the gallery image editor in stock android gallery - except that it stays in place after letting go.
I ended up using LibGDX and making a custom scene for everything.
Didn't find a way to do this using built-in layouts.

Overriding android default camera/activities

I have requirement where in I have to overlay a header and footer over the camera. There is a set of three button which will handle the even of camera like (click/retake).
As of now i create a surface to use as preview and add jpegcallback and picture callback to take picture and store it. I manually handle android camera hardware and parameter configuration. As all of us know there has issues around camera and picture orientation. I have worked around this by setting camera orientation and also by rotating my captured image. Though the approach looks ugly i am able to achieve the end goal.
It would be great if we have a way of overriding the android default camera activity as any of the above steps are not required. I come from a Java/Java EE background and as per my understanding we should be able to create a custom Activity and override the behaviors and properties.
My Question:
Can we override the activities for android.provider.MediaStore.ACTION_IMAGE_CAPTURE and also com.android.camera.action.CROP.
If so which package of android has the java class for this activities.
Hopefully I am not misunderstanding your question but it sounds like you want to use the camera in your app. You want to view what the camera is seeing while having a header and footer above and below the camera preview. Then you want these buttons to do things like take a picture, etc.
If I am wrong I apologize.
Just look at the Camera implementation in the docs.
http://developer.android.com/guide/topics/media/camera.html#custom-camera
You can create your own activity layout with any buttons/text above, below, or on top of a preview view that you use to display the camera feed. Then just use the on click events for the buttons or whatever to do the things you want. Majority of this is in the documentation in the link.

android app with opengl navigation element, background image and video

i have done a view apps with setContetnView and the xml layouts... Actually I do some steps in opengl. Now i want to have one background image, a video area an the opengl 3d navigation element beside the video area to control the videos.
Is it necessary to do the whole work in opengl, or is it possible to put the opengl part over an existing view?
Where can I find more infos on this?
You can place the OpenGL view over top of the other views. I worked on an app that placed a OpenGLView over top of a VideoView. There may be some performance issues, so I would recommend adding the hardware acceleration attribute to your AndroidManifest.xml (under the application element):
android:hardwareAcceleration="true"
One thing that you will need to know to get the layout you expect is that the SurfaceViews do not conform to the normal view hierarchy, so you will want to set the z-order of the view programmatically, using the method setZOrderOnTop:
mVideoView.setZOrderOnTop(false);
mOpenGLView.setZOrderOnTop(true);

Categories

Resources