Giter Site home page Giter Site logo

wajahatkarim3 / longimagecamera Goto Github PK

View Code? Open in Web Editor NEW
115.0 5.0 26.0 7.1 MB

📷 A camera view to capture long image merged from small captured images as it is in Shoparoo app available on Google Play!!

License: Apache License 2.0

Java 100.00%
camera android camera-api camera2-api views

longimagecamera's Introduction

LongImageCamera

Download Android Arsenal API

A camera view to capture long image merged from small captured images as it is in Shoparoo app! This library uses CameraView from Google as the backbone of camera functionality and adds auto-support of creating long or wide images from multiple images. This library includes:

  • Built-in Camera UI and activity
  • Built-in Image Viewer with pinch-fling gestures for zoom/move/rotate etc.
  • TouchImageView with gestures support for zoom/move/rotate etc.
  • Built-in permission handling for Camera and Storage
  • Horizontal or Vertical image merging

Demo

Install Demo app or APK from Releases on your device and try to capture a long image!

Changelog

Changes exist in the releases tab.

Installation

Add this in your app's build.gradle file:

dependencies {
  compile 'com.wajahatkarim3.LongImageCamera:LongImageCamera:1.0.2'
}

Or add LongImageCamera as a new dependency inside your pom.xml

<dependency>
  <groupId>com.wajahatkarim3.LongImageCamera</groupId>
  <artifactId>LongImageCamera</artifactId>
  <version>1.0.2</version>
  <type>pom</type>
</dependency>

Usage

Launch Camera Activity

Start the camera from any Activity with this code:

// Launches camera in Vertical Merge Mode (Captured image will be long)
LongImageCameraActivity.launch( myActivity );

// Launches Camea in Horizontal Merge Mode (Captured image will be wide)
LongImageCameraActivity.launch( myActivity, LongImageCameraActivity.ImageMergeMode.HORIZONTAL );

and then you will get the result image in onActivityResult() method like this:

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == RESULT_OK && requestCode == LongImageCameraActivity.LONG_IMAGE_RESULT_CODE && data != null)
        {
            String imageFileName = data.getStringExtra(LongImageCameraActivity.IMAGE_PATH_KEY);
            Log.e(TAG, "onActivityResult: " + imageFileName );
        }
    }

Launch Image Viewer Activity

This library comes with a built-in image viewer including support of pinch/fling gestures for zoom/move/roate etc. You can launch image viewer with this code:

Intent ii = new Intent(myActivity, PreviewLongImageActivity.class);
ii.putExtra("imageName", myImagePath);
startActivity(ii);

Using TouchImageView in your layouts

You can use customized ImageView with support of gestures for zoom/move/rotate etc like this:

<com.wajahatkarim3.longimagecamera.TouchImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

Libs used in this Library

Donations

This project needs you! If you would like to support this project's further development, the creator of this project or the continuous maintenance of this project, feel free to donate. Your donation is highly appreciated (and I love food, coffee and beer). Thank you!

PayPal

  • Donate $5: Thank's for creating this project, here's a tea (or some juice) for you!
  • Donate $10: Wow, I am stunned. Let me take you to the movies!
  • Donate $15: I really appreciate your work, let's grab some lunch!
  • Donate $25: That's some awesome stuff you did right there, dinner is on me!
  • Donate $50: I really really want to support this project, great job!
  • Donate $100: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!
  • Donate $2799: Go buddy, buy Macbook Pro for yourself! Of course, you can also choose what you want to donate, all donations are awesome!

Developed By

Wajahat Karim

How to Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Copyright 2017 Wajahat Karim

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

longimagecamera's People

Contributors

wajahatkarim3 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

longimagecamera's Issues

App is crasing

HI, I downloaded your project and ran it on my emulator: Nexux 4 API 22, it only worked for first time and then crashing on clicking Launch Camera Button.

Below is the stack:

FATAL EXCEPTION: main
Process: com.wajahatkarim3.longimagecamera.demo, PID: 24782
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wajahatkarim3.longimagecamera.demo/com.wajahatkarim3.longimagecamera.LongImageCameraActivity}: java.lang.RuntimeException: startPreview failed
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.google.android.cameraview.Camera1.start(Camera1.java:95)
at com.google.android.cameraview.CameraView.start(CameraView.java:259)
at com.wajahatkarim3.longimagecamera.LongImageCameraActivity.checkForCameraPermission(LongImageCameraActivity.java:247)
at com.wajahatkarim3.longimagecamera.LongImageCameraActivity.onCreate(LongImageCameraActivity.java:117)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

onActivityResult issue

Good day,

I just started using your library. Nice work.

But I can't get 2 static Strings from the LongImageActivity which are LONG_IMAGE_RESULT_CODE and IMAGE_PATH_KEY.

Any solution?

Thanks.

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.