GithubHelp home page GithubHelp logo

cameramodule's Introduction

CameraModule

Camera module for Android applications.

Screenshots: https://www.dropbox.com/sh/2d7svoykpwpwmbw/AAAveLqvtaJ2Zt5NHaEu3-QSa

Usage

In your Application class call managers initializer:

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ManagerInitializer.i.init(getApplicationContext());
    }
}

Then call CameraActivity to use camera:

Intent intent = new Intent(this, CameraActivity.class);
intent.putExtra(CameraActivity.PATH, Environment.getExternalStorageDirectory().getPath());
intent.putExtra(CameraActivity.OPEN_PHOTO_PREVIEW, true);
intent.putExtra(CameraActivity.USE_FRONT_CAMERA, false);
startActivity(intent);

Customising

To create custom layout for CameraFragment, please use this ids:

camera_preview - Container for CameraPreview that extends ViewGroup.

capture - View for capturing photos

zoom_ratio - TextView for displaying zoom ratio value

flash_mode - ImageButton for displaying and switching flash mode

progress - ProgressBar that indicates that capturing or saving photo in progress

camera_settings - ImageButton that call CameraSettingsDialogFragment

Then put layout resources id to intent extras for CameraActivty:

Intent intent = new Intent(this, CameraActivity.class);
intent.putExtra(CameraActivity.PATH, Environment.getExternalStorageDirectory().getPath());
intent.putExtra(CameraActivity.OPEN_PHOTO_PREVIEW, true);
intent.putExtra(CameraActivity.LAYOUT_ID, R.layout.fragment_camera_custom);
startActivity(intent);

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned!

License

The MIT License (MIT)

	Copyright (c) 2017 Zillow

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cameramodule's People

Contributors

edbaev avatar shliama avatar voltazor avatar warko-san avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cameramodule's Issues

Lib crashes on Galaxy Tab s2

Hello,

Got a crash report from a user working on a Galaxy Tab S2
Does any have the same issue?

We don't own a Galaxy Tab S2 at the office for testing

Cheers

getActionBar null !

I get an issue in CameraPreview class, when calling getActionBar, that is null. I have no ActionBar.
the "showActionBar()" method cares if the actionbar is null, but not the "showBack" method.

Zoom according to finger velocity

I have found that Zoom is very slow, please give me advise I want to change it according to Velocity. as you are adding ++ in zoom in I want to add some percentage of the Maximum Zoom that camera support in accordance with the finger velocity.

Help me !!

[BUG] App not releasing the camera onPause()

Requirements:
Device: Nexus 4
SDK: 22

Steps to reproduce:

  • Open the sample and open the camera.
  • Let the preview run and switch to another camera app with multitask button

Current Behaviour:

  • The other app cannot connect to the camera because this lib didn't free the access to it.

Expected behaviour:

  • The other app should be able to connect to the camera

autofocus failed on some devices

hi Yalantis,

thanks for your camera module, it works fine, but i got some "autofous failed" on some devices.
here is the error message,and it happens sometime when camera startFocus and the code "camera.autoFocus(callback)" line running:

java.lang.RuntimeException: autoFocus failed
at android.hardware.Camera.native_autoFocus(Native Method)
at android.hardware.Camera.autoFocus(Camera.java:1148)
at com.haofengsoft.lovefamily.camera.CameraPreview.startFocusing(CameraPreview.java:159)
at com.haofengsoft.lovefamily.camera.CameraPreview.takePicture(CameraPreview.java:166)
at com.haofengsoft.lovefamily.camera.CustomCameraActivity.takePhoto(CustomCameraActivity.java:816)
at com.haofengsoft.lovefamily.camera.CustomCameraActivity$4.onClick(CustomCameraActivity.java:494)
at android.view.View.performClick(View.java:4444)
at android.view.View$PerformClick.run(View.java:18457)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5047)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

java.lang.RuntimeException: setParameters failed

Nexus 7 (2012) Model
Android 4.4.4
Build KTU84P
Tuesday March 18 2014

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.beusoft.liuying/com.yalantis.cameramodule.activity.CameraActivity}: java.lang.RuntimeException: setParameters failed
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: setParameters failed
at android.hardware.Camera.native_setParameters(Native Method)
at android.hardware.Camera.setParameters(Camera.java:1651)
at com.yalantis.cameramodule.fragment.CameraFragment.initParams(CameraFragment.java:458)
at com.yalantis.cameramodule.fragment.CameraFragment.init(CameraFragment.java:176)
at com.yalantis.cameramodule.fragment.CameraFragment.onCreate(CameraFragment.java:132)
at android.app.Fragment.performCreate(Fragment.java:1678)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:859)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.BackStackRecord.run(BackStackRecord.java:684)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
at android.app.Activity.performStart(Activity.java:5240)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.