CPhoto

Android take photo library on coroutines

License

License

GroupId

GroupId

io.github.geniusrus
ArtifactId

ArtifactId

cphoto
Last Version

Last Version

3.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

CPhoto
Android take photo library on coroutines
Project URL

Project URL

https://github.com/GeniusRUS/CPhoto
Source Code Management

Source Code Management

https://github.com/GeniusRUS/CPhoto

Download cphoto

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.geniusrus/cphoto/ -->
<dependency>
    <groupId>io.github.geniusrus</groupId>
    <artifactId>cphoto</artifactId>
    <version>3.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/io.github.geniusrus/cphoto/
implementation 'io.github.geniusrus:cphoto:3.0.0'
// https://jarcasting.com/artifacts/io.github.geniusrus/cphoto/
implementation ("io.github.geniusrus:cphoto:3.0.0")
'io.github.geniusrus:cphoto:aar:3.0.0'
<dependency org="io.github.geniusrus" name="cphoto" rev="3.0.0">
  <artifact name="cphoto" type="aar" />
</dependency>
@Grapes(
@Grab(group='io.github.geniusrus', module='cphoto', version='3.0.0')
)
libraryDependencies += "io.github.geniusrus" % "cphoto" % "3.0.0"
[io.github.geniusrus/cphoto "3.0.0"]

Dependencies

runtime (8)

Group / Artifact Type Version
androidx.exifinterface » exifinterface jar 1.3.2
androidx.annotation » annotation jar 1.1.0
org.jetbrains.kotlin : kotlin-stdlib-jdk7 jar 1.4.31
org.jetbrains.kotlinx : kotlinx-coroutines-android jar 1.4.3
androidx.activity » activity jar 1.2.0
androidx.activity » activity-ktx jar 1.2.0
androidx.fragment » fragment jar 1.3.0
androidx.fragment » fragment-ktx jar 1.3.0

Project Modules

There are no modules declared in this project.

CPhoto

Short description

Simple way to obtain picture from file system & photo with the Kotlin Coroutines

Details

If one of the conditions is not valid, then the corresponding exception is thrown:

  • ExternalStorageWriteException - if write access to the internal storage is not received
  • NotPermissionException - If the permission (API >= 23) to write to memory has been refused
  • CancelOperationException - if the user interrupted the operation of receiving photos

Thera are 3 types of returning values:

Bitmap,
Uri,
String (absolute path to file)

There are 5 types to obtaining images (TypeRequest):

CAMERA, - only from camera
GALLERY, - only from gallery
COMBINE, - combining two previous types
COMBINE_MULTIPLE, - same as COMBINE, but support multiple selection, requires API 16
FROM_DOCUMENT; - using Storage Access Framework, requieres API 19

Usage

  • Get photo from camera
val imageFromCamera = CRPhoto(context).requestBitmap(TypeRequest.CAMERA)
  • Is equal to
val imageFromCamera = this@context takePhotoBitmap TypeRequest.CAMERA

Install

Add to your .gradle file:

implementation 'com.geniusrus.cphoto:cphoto:$latest_version'

Sample

The sample is on app module

Developed by

  • Viktor Likhanov

Yandex: [email protected]

License

Apache v2.0 License

Copyright (c) 2018 Viktor Likhanov

Versions

Version
3.0.0