Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.andrehardian:cameraexera:1.0.8'
}
dependencies {
implementation("com.github.andrehardian:cameraexera:1.0.8")
}
<dependency>
<groupId>com.github.andrehardian</groupId>
<artifactId>cameraexera</artifactId>
<version>1.0.8</version>
</dependency>
libraryDependencies += "com.github.andrehardian" % "cameraexera" % "1.0.8"
:dependencies [[com.github.andrehardian/cameraexera "1.0.8"]]
android camera library from laxus exera technology
File -> project structure -> app/sample -> source compability and target compability use 1.8
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
Add dependencies :
dependencies {
compile 'com.github.andrehardian:cameraExera:1.0.6'
}
using NoActionBar theme
Theme.AppCompat.Light.NoActionBar
Start CameraExera using builder pattern from your activity
startActivityForResult(new Intent(this, CameraExera.class), REQUEST_CODE);
CameraRequired cameraRequired = new CameraRequired();
// set width crop image
cameraRequired.setWidth(400);
// set height crop image
cameraRequired.setHeight(400);
// set array index image, if not in array dont fill this
cameraRequired.setArrayIndex(0);
// for hide gallery in camera
cameraRequired.setHideGalery(true);
startActivityForResult(new Intent(this, CameraExera.class).putExtra(CameraExera.BUNDLE_KEY,cameraRequired), REQUEST_CODE);
or
startActivityForResult(new Intent(this, CameraExera.class).putExtra(CameraExera.BUNDLE_KEY,
new CameraRequired().setWidth(400).setHeight(400).setHideGalery(true)), REQUEST_CODE);
CameraExera
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_CODE) {
// get path image
String path = data.getStringExtra(UtilsCamera.resultTagCamera);
// get position image in array
int positionArray = data.getIntExtra(CameraExera.positionImage, 0);
// get bitmap using path
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
if (path != null) {
Bitmap bitmap = BitmapFactory.decodeFile(path, options);
}
}
}
}
Almost all of the code for these library projects is based on: 1. android image cropper 2. Project Lombok 3. Rx Android 4. Rx Java
cameraExera by andrehardian is licensed under a Apache License 2.0