mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-30 19:56:44 +01:00
upgrade the new editor to 7.0.10
This commit is contained in:
parent
37d8f4babf
commit
6f565f5828
3 changed files with 87 additions and 83 deletions
|
@ -92,31 +92,28 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the PESDKPlugin
|
// Apply the PESDKPlugin
|
||||||
apply plugin: 'ly.img.android.pesdk'
|
apply plugin: 'ly.img.android.sdk'
|
||||||
|
|
||||||
pesdkConfig {
|
imglyConfig {
|
||||||
|
pesdk {
|
||||||
|
enabled true
|
||||||
licencePath 'pesdk_license'
|
licencePath 'pesdk_license'
|
||||||
|
}
|
||||||
|
|
||||||
supportLibVersion "28.0.0"
|
supportLibVersion "28.0.0"
|
||||||
|
|
||||||
modules {
|
modules {
|
||||||
include 'ly.img.android.pesdk.operation:text'
|
include 'ui:core'
|
||||||
include 'ly.img.android.pesdk.operation:focus'
|
include 'ui:text'
|
||||||
include 'ly.img.android.pesdk.operation:brush'
|
include 'ui:focus'
|
||||||
include 'ly.img.android.pesdk.operation:filter'
|
include 'ui:brush'
|
||||||
include 'ly.img.android.pesdk.operation:adjustment'
|
include 'ui:filter'
|
||||||
|
include 'ui:transform'
|
||||||
|
include 'ui:adjustment'
|
||||||
|
|
||||||
include 'ly.img.android.pesdk.ui.mobile_ui:core'
|
include 'backend:serializer'
|
||||||
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:brush'
|
|
||||||
include 'ly.img.android.pesdk.ui.mobile_ui:filter'
|
|
||||||
include 'ly.img.android.pesdk.ui.mobile_ui:transform'
|
|
||||||
include 'ly.img.android.pesdk.ui.mobile_ui:adjustment'
|
|
||||||
|
|
||||||
include 'ly.img.android.pesdk:serializer'
|
include 'assets:font-basic'
|
||||||
|
include 'assets:filter-basic'
|
||||||
include 'ly.img.android.pesdk.assets:font-basic'
|
|
||||||
include 'ly.img.android.pesdk.assets:filter-basic'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,14 @@ import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.SaveAsDialog
|
import com.simplemobiletools.gallery.pro.dialogs.SaveAsDialog
|
||||||
import com.simplemobiletools.gallery.pro.extensions.config
|
import com.simplemobiletools.gallery.pro.extensions.config
|
||||||
import com.simplemobiletools.gallery.pro.extensions.fixDateTaken
|
import com.simplemobiletools.gallery.pro.extensions.fixDateTaken
|
||||||
|
import ly.img.android.pesdk.PhotoEditorSettingsList
|
||||||
import ly.img.android.pesdk.assets.filter.basic.FilterPackBasic
|
import ly.img.android.pesdk.assets.filter.basic.FilterPackBasic
|
||||||
import ly.img.android.pesdk.assets.font.basic.FontPackBasic
|
import ly.img.android.pesdk.assets.font.basic.FontPackBasic
|
||||||
import ly.img.android.pesdk.backend.model.config.CropAspectAsset
|
import ly.img.android.pesdk.backend.model.config.CropAspectAsset
|
||||||
import ly.img.android.pesdk.backend.model.state.BrushSettings
|
import ly.img.android.pesdk.backend.model.state.BrushSettings
|
||||||
import ly.img.android.pesdk.backend.model.state.EditorLoadSettings
|
import ly.img.android.pesdk.backend.model.state.LoadSettings
|
||||||
import ly.img.android.pesdk.backend.model.state.EditorSaveSettings
|
import ly.img.android.pesdk.backend.model.state.PhotoEditorSaveSettings
|
||||||
|
import ly.img.android.pesdk.backend.model.state.SaveSettings
|
||||||
import ly.img.android.pesdk.backend.model.state.manager.SettingsList
|
import ly.img.android.pesdk.backend.model.state.manager.SettingsList
|
||||||
import ly.img.android.pesdk.ui.activity.PhotoEditorBuilder
|
import ly.img.android.pesdk.ui.activity.PhotoEditorBuilder
|
||||||
import ly.img.android.pesdk.ui.model.state.*
|
import ly.img.android.pesdk.ui.model.state.*
|
||||||
|
@ -30,8 +32,6 @@ import ly.img.android.pesdk.ui.panels.item.CropAspectItem
|
||||||
import ly.img.android.pesdk.ui.panels.item.ToggleAspectItem
|
import ly.img.android.pesdk.ui.panels.item.ToggleAspectItem
|
||||||
import ly.img.android.pesdk.ui.panels.item.ToolItem
|
import ly.img.android.pesdk.ui.panels.item.ToolItem
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
|
||||||
import kotlin.collections.LinkedHashMap
|
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
class NewEditActivity : SimpleActivity() {
|
class NewEditActivity : SimpleActivity() {
|
||||||
|
@ -181,18 +181,31 @@ class NewEditActivity : SimpleActivity() {
|
||||||
private fun openEditor(inputImage: Uri) {
|
private fun openEditor(inputImage: Uri) {
|
||||||
sourceImageUri = inputImage
|
sourceImageUri = inputImage
|
||||||
val filename = inputImage.toString().getFilenameFromPath()
|
val filename = inputImage.toString().getFilenameFromPath()
|
||||||
|
|
||||||
val settingsList = createPesdkSettingsList(filename)
|
val settingsList = createPesdkSettingsList(filename)
|
||||||
|
|
||||||
settingsList.getSettingsModel(EditorLoadSettings::class.java).imageSource = sourceImageUri
|
settingsList.configure<LoadSettings> {
|
||||||
|
it.source = inputImage
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsList[LoadSettings::class].source = inputImage
|
||||||
|
|
||||||
PhotoEditorBuilder(this)
|
PhotoEditorBuilder(this)
|
||||||
.setSettingsList(settingsList)
|
.setSettingsList(settingsList)
|
||||||
.startActivityForResult(this, PESDK_EDIT_IMAGE)
|
.startActivityForResult(this, PESDK_EDIT_IMAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createPesdkSettingsList(filename: String): SettingsList {
|
private fun createPesdkSettingsList(filename: String): PhotoEditorSettingsList {
|
||||||
val settingsList = SettingsList()
|
val settingsList = PhotoEditorSettingsList().apply {
|
||||||
settingsList.config.getAssetMap(CropAspectAsset::class.java).apply {
|
configure<UiConfigFilter> {
|
||||||
|
it.setFilterList(FilterPackBasic.getFilterPack())
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<UiConfigText> {
|
||||||
|
it.setFontList(FontPackBasic.getFontPack())
|
||||||
|
}
|
||||||
|
|
||||||
|
config.getAssetMap(CropAspectAsset::class.java).apply {
|
||||||
add(CropAspectAsset("my_crop_1_2", 1, 2, false))
|
add(CropAspectAsset("my_crop_1_2", 1, 2, false))
|
||||||
add(CropAspectAsset("my_crop_2_1", 2, 1, false))
|
add(CropAspectAsset("my_crop_2_1", 2, 1, false))
|
||||||
add(CropAspectAsset("my_crop_19_9", 19, 9, false))
|
add(CropAspectAsset("my_crop_19_9", 19, 9, false))
|
||||||
|
@ -205,7 +218,7 @@ class NewEditActivity : SimpleActivity() {
|
||||||
add(CropAspectAsset("my_crop_10_16", 10, 16, false))
|
add(CropAspectAsset("my_crop_10_16", 10, 16, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsList.getSettingsModel(UiConfigAspect::class.java).aspectList.apply {
|
getSettingsModel(UiConfigAspect::class.java).aspectList.apply {
|
||||||
add(ToggleAspectItem(CropAspectItem("my_crop_2_1"), CropAspectItem("my_crop_1_2")))
|
add(ToggleAspectItem(CropAspectItem("my_crop_2_1"), CropAspectItem("my_crop_1_2")))
|
||||||
add(ToggleAspectItem(CropAspectItem("my_crop_19_9"), CropAspectItem("my_crop_9_19")))
|
add(ToggleAspectItem(CropAspectItem("my_crop_19_9"), CropAspectItem("my_crop_9_19")))
|
||||||
add(ToggleAspectItem(CropAspectItem("my_crop_5_4"), CropAspectItem("my_crop_4_5")))
|
add(ToggleAspectItem(CropAspectItem("my_crop_5_4"), CropAspectItem("my_crop_4_5")))
|
||||||
|
@ -213,42 +226,36 @@ class NewEditActivity : SimpleActivity() {
|
||||||
add(ToggleAspectItem(CropAspectItem("my_crop_16_10"), CropAspectItem("my_crop_10_16")))
|
add(ToggleAspectItem(CropAspectItem("my_crop_16_10"), CropAspectItem("my_crop_10_16")))
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsList.getSettingsModel(UiConfigFilter::class.java).setFilterList(
|
getSettingsModel(BrushSettings::class.java).apply {
|
||||||
FilterPackBasic.getFilterPack()
|
brushColor = applicationContext.config.editorBrushColor
|
||||||
)
|
brushHardness = applicationContext.config.editorBrushHardness
|
||||||
|
brushSize = applicationContext.config.editorBrushSize
|
||||||
settingsList.getSettingsModel(UiConfigText::class.java).setFontList(
|
|
||||||
FontPackBasic.getFontPack()
|
|
||||||
)
|
|
||||||
|
|
||||||
settingsList.getSettingsModel(BrushSettings::class.java).apply {
|
|
||||||
brushColor = config.editorBrushColor
|
|
||||||
brushHardness = config.editorBrushHardness
|
|
||||||
brushSize = config.editorBrushSize
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not use Text Design, it takes up too much space
|
// do not use Text Design, it takes up too much space
|
||||||
val tools = settingsList.getSettingsModel(UiConfigMainMenu::class.java).toolList
|
val tools = getSettingsModel(UiConfigMainMenu::class.java).toolList
|
||||||
val newTools = tools.filterNot {
|
val newTools = tools.filterNot {
|
||||||
it.name!!.isEmpty()
|
it.name!!.isEmpty()
|
||||||
}.toMutableList() as ArrayList<ToolItem>
|
}.toMutableList() as ArrayList<ToolItem>
|
||||||
|
|
||||||
// move Focus to the end, as it is the least used
|
// move Focus at the end, as it is the least used
|
||||||
// on some devices it is not obvious that the toolbar can be scrolled horizontally, so move the best ones to the start to make them visible
|
// on some devices it is not obvious that the toolbar can be scrolled horizontally, so move the best ones at the beginning to make them visible
|
||||||
val focus = newTools.firstOrNull { it.name == getString(R.string.pesdk_focus_title_name) }
|
val focus = newTools.firstOrNull { it.name == getString(R.string.pesdk_focus_title_name) }
|
||||||
if (focus != null) {
|
if (focus != null) {
|
||||||
newTools.remove(focus)
|
newTools.remove(focus)
|
||||||
newTools.add(focus)
|
newTools.add(focus)
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsList.getSettingsModel(UiConfigMainMenu::class.java).setToolList(newTools)
|
getSettingsModel(UiConfigMainMenu::class.java).setToolList(newTools)
|
||||||
|
|
||||||
settingsList.getSettingsModel(UiConfigTheme::class.java).theme = R.style.Imgly_Theme_NoFullscreen
|
getSettingsModel(UiConfigTheme::class.java).theme = R.style.Imgly_Theme_NoFullscreen
|
||||||
|
|
||||||
settingsList.getSettingsModel(EditorSaveSettings::class.java)
|
configure<PhotoEditorSaveSettings> {
|
||||||
.setExportFormat(EditorSaveSettings.FORMAT.AUTO)
|
it.exportFormat = SaveSettings.FORMAT.AUTO
|
||||||
.setOutputFilePath("$cacheDir/editor/$filename")
|
it.setOutputFilePath("$cacheDir/editor/$filename")
|
||||||
.savePolicy = EditorSaveSettings.SavePolicy.RETURN_SOURCE_OR_CREATE_OUTPUT_IF_NECESSARY
|
it.savePolicy = SaveSettings.SavePolicy.RETURN_SOURCE_OR_CREATE_OUTPUT_IF_NECESSARY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return settingsList
|
return settingsList
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
classpath 'com.android.tools.build:gradle:3.5.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath 'ly.img.android.pesdk:plugin:6.6.4'
|
classpath 'ly.img.android.pesdk:plugin:7.0.10'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
Loading…
Reference in a new issue