Skip to content

Commit

Permalink
Bump Android SDK to v6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Baumann committed Jul 30, 2018
1 parent 37a7d86 commit 2b8dfad
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 38 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,28 @@ To add these entries into the `info.plist`, you can use the `edit-config` tag in

### Android Configuration

No special configuration is needed for Android. Just require the plugin.
As the Android SDK links different modules depending on your configuration, we're providing a Gradle plugin which needs to be added to your Android project. To prepare this, you'll have to add the following lines to your projects .gradle file (`platforms/android/build.gradle`):

```
buildscript {
repositories {
// ...
maven { url "https://artifactory.9elements.com/artifactory/imgly" }
}
dependencies {
// ...
classpath 'ly.img.android.pesdk:plugin:6.0.0'
}
}
allprojects {
repositories {
// ...
maven { url "https://artifactory.9elements.com/artifactory/imgly" }
}
// ...
}
```

## Development
The example app was created by starting a new Cordova app, adding the iOS and Android platforms and linking the plugin using the `cordova plugin add /path/to/plugin --link` command mentioned above.
Expand Down
71 changes: 64 additions & 7 deletions src/android/CameraActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@
import android.app.Activity;
import android.os.Bundle;

import ly.img.android.sdk.models.constant.Directory;
import ly.img.android.sdk.models.state.EditorLoadSettings;
import ly.img.android.sdk.models.state.EditorSaveSettings;
import ly.img.android.sdk.models.state.manager.SettingsList;
import ly.img.android.ui.activities.CameraPreviewBuilder;
import ly.img.android.ui.utilities.PermissionRequest;
import ly.img.android.pesdk.assets.filter.basic.FilterPackBasic;
import ly.img.android.pesdk.assets.font.basic.FontPackBasic;
import ly.img.android.pesdk.assets.frame.basic.FramePackBasic;
import ly.img.android.pesdk.assets.overlay.basic.OverlayPackBasic;
import ly.img.android.pesdk.assets.sticker.emoticons.StickerPackEmoticons;
import ly.img.android.pesdk.assets.sticker.shapes.StickerPackShapes;
import ly.img.android.pesdk.backend.model.constant.Directory;
import ly.img.android.pesdk.backend.model.state.CameraSettings;
import ly.img.android.pesdk.backend.model.state.EditorLoadSettings;
import ly.img.android.pesdk.backend.model.state.EditorSaveSettings;
import ly.img.android.pesdk.backend.model.state.manager.SettingsList;
import ly.img.android.pesdk.ui.activity.CameraPreviewBuilder;
import ly.img.android.pesdk.ui.model.state.UiConfigFilter;
import ly.img.android.pesdk.ui.model.state.UiConfigFrame;
import ly.img.android.pesdk.ui.model.state.UiConfigOverlay;
import ly.img.android.pesdk.ui.model.state.UiConfigSticker;
import ly.img.android.pesdk.ui.model.state.UiConfigText;
import ly.img.android.pesdk.ui.utils.PermissionRequest;


/**
* Created by maltebaumann on 06/14/17.
Expand All @@ -22,7 +35,7 @@ public class CameraActivity extends Activity implements PermissionRequest.Respon

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SettingsList settingsList = new SettingsList();
SettingsList settingsList = createPesdkSettingsList();
settingsList.getSettingsModel(EditorLoadSettings.class)
.getSettingsModel(EditorSaveSettings.class)
.setExportDir(Directory.DCIM, FOLDER)
Expand All @@ -36,6 +49,50 @@ public void onCreate(Bundle savedInstanceState) {
.startActivityForResult(this, CAMERA_PREVIEW_RESULT);
}

private SettingsList createPesdkSettingsList() {

// Create a empty new SettingsList and apply the changes on this referance.
SettingsList settingsList = new SettingsList();

// If you include our asset Packs and you use our UI you also need to add them to the UI,
// otherwise they are only available for the backend
// See the specific feature sections of our guides if you want to know how to add our own Assets.

settingsList.getSettingsModel(UiConfigFilter.class).setFilterList(
FilterPackBasic.getFilterPack()
);

settingsList.getSettingsModel(UiConfigText.class).setFontList(
FontPackBasic.getFontPack()
);

settingsList.getSettingsModel(UiConfigFrame.class).setFrameList(
FramePackBasic.getFramePack()
);

settingsList.getSettingsModel(UiConfigOverlay.class).setOverlayList(
OverlayPackBasic.getOverlayPack()
);

settingsList.getSettingsModel(UiConfigSticker.class).setStickerLists(
StickerPackEmoticons.getStickerCategory(),
StickerPackShapes.getStickerCategory()
);

// Set custom camera image export settings
settingsList.getSettingsModel(CameraSettings.class)
.setExportDir(Directory.DCIM, "PESDKPlugin")
.setExportPrefix("camera_");

// Set custom editor image export settings
settingsList.getSettingsModel(EditorSaveSettings.class)
.setExportDir(Directory.DCIM, "PESDKPlugin")
.setExportPrefix("result_")
.setSavePolicy(EditorSaveSettings.SavePolicy.RETURN_ALWAYS_ONLY_OUTPUT);

return settingsList;
}

@Override
protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand Down
19 changes: 6 additions & 13 deletions src/android/PESDKPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,18 @@
import java.io.File;

import ly.img.android.PESDK;
import ly.img.android.sdk.models.constant.Directory;
import ly.img.android.sdk.models.state.EditorLoadSettings;
import ly.img.android.sdk.models.state.EditorSaveSettings;
import ly.img.android.sdk.models.state.manager.SettingsList;
import ly.img.android.ui.activities.ImgLyIntent;
import ly.img.android.ui.activities.PhotoEditorBuilder;
import ly.img.android.pesdk.backend.model.constant.Directory;
import ly.img.android.pesdk.backend.model.state.EditorLoadSettings;
import ly.img.android.pesdk.backend.model.state.EditorSaveSettings;
import ly.img.android.pesdk.backend.model.state.manager.SettingsList;
import ly.img.android.pesdk.ui.activity.ImgLyIntent;
import ly.img.android.pesdk.ui.activity.PhotoEditorBuilder;

public class PESDKPlugin extends CordovaPlugin {

public static final int PESDK_EDITOR_RESULT = 1;
private CallbackContext callback = null;

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);

PESDK.init(cordova.getActivity().getApplication(), "LICENSE_ANDROID");
}

@Override
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
if (action.equals("present")) {
Expand Down
93 changes: 76 additions & 17 deletions src/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,95 @@
buildscript {
repositories {
jcenter()
google()
maven { url 'https://artifactory.9elements.com/artifactory/imgly' }
}
dependencies {
classpath 'ly.img.android.pesdk:plugin:6.0.0'
}
}
apply plugin: 'com.android.application'

dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.51'
}

repositories {
maven {
url "https://artifactory.9elements.com/artifactory/imgly"
}
jcenter()
google()
maven { url 'https://artifactory.9elements.com/artifactory/imgly' }
}

android {
defaultConfig {
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
vectorDrawables.useSupportLibrary true
// Apply the Android Plugin
apply plugin: 'com.android.application'

// Apply the PESDKPlugin.
// [!] This assumes you made the correct changes to your projects build.gradle file!
// See https://docs.photoeditorsdk.com/guides/android/v6/introduction/getting_started for details.
apply plugin: 'ly.img.android.pesdk'

// Configure the PESDKPlugin
pesdkConfig {

licencePath "LICENSE_ANDROID" // Name of the Licence file in the asset folder

// Insert the latest SDK version here. You will find it here https://github.com/imgly/pesdk-android-demo/releases
pesdkVersion "6.0.0"

// If you use another supportLibVersion ('com.android.support'), change this version here to update your own supportLibVersion
supportLibVersion "27.1.1"

// Define the modules you are need
modules {
// Add all the backend modules you need
include 'ly.img.android.pesdk.operation:text'
include 'ly.img.android.pesdk.operation:frame'
include 'ly.img.android.pesdk.operation:focus'
include 'ly.img.android.pesdk.operation:brush'
include 'ly.img.android.pesdk.operation:camera'
include 'ly.img.android.pesdk.operation:filter'
include 'ly.img.android.pesdk.operation:sticker'
include 'ly.img.android.pesdk.operation:overlay'
include 'ly.img.android.pesdk.operation:adjustment'
include 'ly.img.android.pesdk.operation:text-design'
include 'ly.img.android.pesdk.operation:abstract-sticker'

// Add all the UI modules you are need
include 'ly.img.android.pesdk.ui.mobile_ui:core'
include 'ly.img.android.pesdk.ui.mobile_ui:text'
include 'ly.img.android.pesdk.ui.mobile_ui:focus'
include 'ly.img.android.pesdk.ui.mobile_ui:frame'
include 'ly.img.android.pesdk.ui.mobile_ui:brush'
include 'ly.img.android.pesdk.ui.mobile_ui:filter'
include 'ly.img.android.pesdk.ui.mobile_ui:camera'
include 'ly.img.android.pesdk.ui.mobile_ui:sticker'
include 'ly.img.android.pesdk.ui.mobile_ui:overlay'
include 'ly.img.android.pesdk.ui.mobile_ui:transform'
include 'ly.img.android.pesdk.ui.mobile_ui:adjustment'
include 'ly.img.android.pesdk.ui.mobile_ui:text-design'


// Add the serializer if you need
include 'ly.img.android.pesdk:serializer'

// Add asset packs if you need
include 'ly.img.android.pesdk.assets:font-basic'
include 'ly.img.android.pesdk.assets:font-text-design'
include 'ly.img.android.pesdk.assets:frame-basic'
include 'ly.img.android.pesdk.assets:filter-basic'
include 'ly.img.android.pesdk.assets:overlay-basic'
include 'ly.img.android.pesdk.assets:sticker-shapes'
include 'ly.img.android.pesdk.assets:sticker-emoticons'
}
}

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
pickFirst 'lib/mips/librsjni.so'
pickFirst 'lib/mips/libRSSupport.so'
}
}

dependencies {
compile 'ly.img.android:photo-editor-sdk:5.1.5'
}


0 comments on commit 2b8dfad

Please sign in to comment.