Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ASHIR14 committed Aug 27, 2020
0 parents commit 01eb77d
Show file tree
Hide file tree
Showing 68 changed files with 2,505 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gradle
.DS_Store
.idea
build/
local.properties
localhost/
obj/
*.iml
Gemfile.lock
_site/
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Android</name>
<comment>Project Android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: android
jdk: oraclejdk8
sudo: false

android:

components:
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- android-22
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- sys-img-armeabi-v7a-android-22

before_script:
- echo yes | android update sdk --all --filter build-tools-28.0.3 --no-ui --force
- touch local.properties
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 100M
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- chmod +x gradlew

script:
- ./gradlew clean build connectedCheck
19 changes: 19 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2018 Gabriel Basilio Brito

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to use,
copy, modify, merge, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

1 - You cannot use this software to make an Android Backgroung Removal App and publish it to the Google Play Store, but you can use it to integrate the functionality in an existing app.

2 - 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.
130 changes: 130 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<div align="center">

<h1>
✂️
Android-CutOut
</h1>
Android image background cutting library
</div>

[ ![Version](https://api.bintray.com/packages/gabrielbb/Android-CutOut/Android-CutOut/images/download.svg) ](https://bintray.com/gabrielbb/Android-CutOut/Android-CutOut/_latestVersion)
[ ![Build](https://api.travis-ci.org/GabrielBB/Android-CutOut.svg?branch=master) ](https://api.travis-ci.org/GabrielBB/Android-CutOut.svg?branch=master)

## Usage

Add Gradle dependency:
```groovy
implementation 'com.github.gabrielbb:cutout:0.1.2'
```

Start the CutOut screen with this single line:

```java
CutOut.activity().start(this);
```

<img src="/images/Capture.JPG" width="200"> &nbsp; <img src="/images/Capture_2.JPG" width="200">

### Getting the result

```java
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == CutOut.CUTOUT_ACTIVITY_REQUEST_CODE) {

switch (resultCode) {
case Activity.RESULT_OK:
Uri imageUri = CutOut.getUri(data);
// Save the image using the returned Uri here
break;
case CutOut.CUTOUT_ACTIVITY_RESULT_ERROR_CODE:
Exception ex = CutOut.getError(data);
break;
default:
System.out.print("User cancelled the CutOut screen");
}
}
}
```

## Features

<img src="/images/Magic_Wand.JPG" width="250"> &nbsp; <img src="/images/Pencil.JPG" width="250"> &nbsp; <img src="/images/Zoom.JPG" width="250">


## Options

You can use one or more options from these:

```java
CutOut.activity()
.src(uri)
.bordered()
.noCrop()
.intro()
.start(this);
```

- #### src

By default the user can select images from camera or gallery but you can also pass an `android.net.Uri` of an image that is already saved:

```java
Uri uri = Uri.parse("/images/cat.jpg");

CutOut.activity().src(uri).start(this);
```


- #### bordered

```java
CutOut.activity().bordered().start(this);
```

This option makes the final PNG have a border around it. The default border color is White. You can also pass the `android.graphics.Color` of your choice.


- #### noCrop

```java
CutOut.activity().noCrop().start(this);
```

By default and thanks to this library: [Android-Image-Cropper](https://github.com/ArthurHub/Android-Image-Cropper), the user can crop or rotate the image. This option disables that cropping screen.



- #### intro

```java
CutOut.activity().intro().start(this);
```

Display an intro explaining every button usage. The user can skip the intro and it is only shown once. The images displayed in the intro are the same you saw in the "Features" section of this document.

## Change log
*0.1.2*
- Removed Admob Ads automatic integration. I will probably add it later. For now, it was causing problems.
- Images are now saved as temporary files in the cache directory. This guarantees that these images will be deleted when users uninstall your app or when the disk memory is low. If you want the images to live forever on the Gallery, you should take the returned Uri and save the image there by yourself.

## License
Copyright (c) 2018 Gabriel Basilio Brito

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to use,
copy, modify, merge, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

1 - You cannot use this software to make an Android app that its main goal is to remove background from images and publish it to the Google Play Store, but you can use it to integrate the functionality in an existing app or a new app that does more than just this.

2 - 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.
41 changes: 41 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
maven { url 'https://dl.bintray.com/gabrielbb/Android-CutOut' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
compileSdkVersion = 28
minSdkVersion = 16
buildToolsVersion = '28.0.3'
versionCode = 2
javaVersion = JavaVersion.VERSION_1_8
PUBLISH_GROUP_ID = 'com.github.gabrielbb'
PUBLISH_ARTIFACT_ID = 'cutout'
PUBLISH_VERSION = '0.1.2'
}
1 change: 1 addition & 0 deletions cutout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
54 changes: 54 additions & 0 deletions cutout/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apply plugin: 'com.android.library'
apply from: 'publish.gradle'

android {
compileSdkVersion rootProject.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.compileSdkVersion
versionCode rootProject.versionCode
versionName rootProject.PUBLISH_VERSION

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility rootProject.javaVersion
targetCompatibility rootProject.javaVersion
}

lintOptions {
abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.github.duanhong169:checkerboarddrawable:1.0.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.alexvasilkov:gesture-views:2.5.2'
implementation 'com.github.apl-devs:appintro:v4.2.3'
implementation 'com.github.jkwiecien:EasyImage:1.3.1'

implementation 'com.intuit.sdp:sdp-android:1.0.6'
}

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
}
21 changes: 21 additions & 0 deletions cutout/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Loading

0 comments on commit 01eb77d

Please sign in to comment.