├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── raw │ │ │ │ └── tut2.gif │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimen.xml │ │ │ │ ├── attrs.xml │ │ │ │ ├── themes.xml │ │ │ │ └── arrays.xml │ │ │ ├── drawable-hdpi │ │ │ │ └── cpv_alpha.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── cpv_alpha.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── cpv_alpha.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ ├── ic_launcher_round.webp │ │ │ │ └── ic_launcher_foreground.webp │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ ├── ic_launcher_round.webp │ │ │ │ └── ic_launcher_foreground.webp │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ ├── ic_launcher_round.webp │ │ │ │ └── ic_launcher_foreground.webp │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ ├── ic_launcher_round.webp │ │ │ │ └── ic_launcher_foreground.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ ├── ic_launcher_round.webp │ │ │ │ └── ic_launcher_foreground.webp │ │ │ ├── drawable │ │ │ │ ├── dot_drawable.xml │ │ │ │ ├── cpv_ic_arrow_right_black_24dp.xml │ │ │ │ ├── cpv_preset_checked.xml │ │ │ │ ├── baseline_arrow_upward_24.xml │ │ │ │ ├── sheet_top.xml │ │ │ │ ├── cpv_btn_background_pressed.xml │ │ │ │ ├── baseline_arrow_back_24.xml │ │ │ │ ├── baseline_done_24.xml │ │ │ │ ├── baseline_close_24.xml │ │ │ │ ├── check_green.xml │ │ │ │ ├── drag_shape.xml │ │ │ │ ├── baseline_arrow_downward_24.xml │ │ │ │ ├── discount_back.xml │ │ │ │ ├── play_filled.xml │ │ │ │ ├── picked_sub_item.xml │ │ │ │ ├── baseline_info_outline_24.xml │ │ │ │ ├── cpv_btn_background.xml │ │ │ │ ├── baseline_brush_24.xml │ │ │ │ ├── redo_line.xml │ │ │ │ ├── undo_line.xml │ │ │ │ ├── expand_left_right_line.xml │ │ │ │ ├── delete_bin_line.xml │ │ │ │ ├── save_3_line.xml │ │ │ │ ├── baseline_auto_awesome_24.xml │ │ │ │ ├── pencil_line.xml │ │ │ │ ├── history_line.xml │ │ │ │ ├── image_add_line.xml │ │ │ │ ├── eraser_line.xml │ │ │ │ ├── lock_2_line.xml │ │ │ │ ├── paint_line.xml │ │ │ │ ├── question_line.xml │ │ │ │ ├── eye_close_line.xml │ │ │ │ ├── eye_line.xml │ │ │ │ ├── account_circle_line.xml │ │ │ │ ├── equalizer_line.xml │ │ │ │ ├── share_line.xml │ │ │ │ ├── palette_line.xml │ │ │ │ ├── hand.xml │ │ │ │ ├── settings_line.xml │ │ │ │ ├── premium_icon.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── history.xml │ │ │ │ ├── gallery_fragment.xml │ │ │ │ ├── info_layout.xml │ │ │ │ ├── pref_activity.xml │ │ │ │ ├── layout_image.xml │ │ │ │ ├── input_dialog.xml │ │ │ │ ├── gallery_item.xml │ │ │ │ ├── progress_dialog.xml │ │ │ │ ├── upscale_compare_dialog.xml │ │ │ │ ├── gallery.xml │ │ │ │ ├── crop_image.xml │ │ │ │ ├── before_after_slider.xml │ │ │ │ ├── save_image.xml │ │ │ │ ├── fullscreen_image.xml │ │ │ │ ├── upscale.xml │ │ │ │ ├── drawing_activity.xml │ │ │ │ └── settings.xml │ │ │ ├── menu │ │ │ │ ├── multi_select.xml │ │ │ │ ├── bhmenu.xml │ │ │ │ ├── bottom_nav_menu.xml │ │ │ │ └── main_menu.xml │ │ │ ├── xml │ │ │ │ ├── provider_paths.xml │ │ │ │ ├── backup_rules.xml │ │ │ │ ├── data_extraction_rules.xml │ │ │ │ └── preference.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── ic_launcher-playstore.png │ │ ├── java │ │ │ └── com │ │ │ │ └── serhat │ │ │ │ └── aieditor │ │ │ │ ├── drawing │ │ │ │ ├── Stroke.java │ │ │ │ └── DrawView.java │ │ │ │ ├── viewpager │ │ │ │ ├── PagerItems.java │ │ │ │ ├── PagerItem.java │ │ │ │ ├── MainViewPager2Adapter.java │ │ │ │ ├── FragmentPagerItem.java │ │ │ │ └── FragmentPagerItems.java │ │ │ │ ├── MainViewPager2Adapter.java │ │ │ │ ├── model │ │ │ │ └── GalleryModel.java │ │ │ │ ├── AutoResetMode.java │ │ │ │ ├── activity │ │ │ │ └── PrefsActivity.java │ │ │ │ ├── app │ │ │ │ ├── ApplicationPath.java │ │ │ │ └── App.java │ │ │ │ ├── preference │ │ │ │ └── Prefs.java │ │ │ │ ├── Utils.java │ │ │ │ ├── fragment │ │ │ │ ├── SettingsFragment.java │ │ │ │ ├── SavedFragment.java │ │ │ │ ├── HistoryFragment.java │ │ │ │ └── UpscaledFragment.java │ │ │ │ ├── BeforeAfterSlider.java │ │ │ │ └── adapter │ │ │ │ └── HistoryAdapter.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── serhat │ │ │ └── aieditor │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── serhat │ │ └── aieditor │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── migrations.xml ├── deploymentTargetSelector.xml ├── misc.xml └── gradle.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle ├── LICENSE ├── gradle.properties ├── README.md ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /app/src/main/res/raw/tut2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/raw/tut2.gif -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AI Image Editor 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/cpv_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/drawable-hdpi/cpv_alpha.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/cpv_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/drawable-xhdpi/cpv_alpha.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/cpv_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/drawable-xxhdpi/cpv_alpha.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Serkali-sudo/ai-image-editor/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F8FAE5 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dot_drawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 04 22:29:42 TRT 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/history.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetSelector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF000000 4 | #FFFFFFFF 5 | #5C6BC0 6 | #ffb0bec5 7 | #fff77c73 8 | #FF7043 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cpv_ic_arrow_right_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cpv_preset_checked.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_arrow_upward_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/sheet_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | gradlePluginPortal() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | 16 | rootProject.name = "ai-image-editor" 17 | include ':app' 18 | -------------------------------------------------------------------------------- /app/src/main/res/menu/multi_select.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cpv_btn_background_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_arrow_back_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_done_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/drawing/Stroke.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.drawing; 2 | 3 | import android.graphics.Path; 4 | 5 | public class Stroke { 6 | 7 | public int colour; 8 | public float strokeWidth; 9 | public Path path; 10 | 11 | public Stroke(int colour, float width, Path path) { 12 | this.colour = colour; 13 | this.strokeWidth = width; 14 | this.path = path; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_close_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/check_green.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/drag_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_arrow_downward_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/discount_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/xml/provider_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 15 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/play_filled.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/test/java/com/serhat/aieditor/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/viewpager/PagerItems.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.viewpager; 2 | 3 | import android.content.Context; 4 | 5 | import java.util.ArrayList; 6 | 7 | public abstract class PagerItems extends ArrayList { 8 | 9 | private final Context context; 10 | 11 | protected PagerItems(Context context) { 12 | this.context = context; 13 | } 14 | 15 | public Context getContext() { 16 | return context; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/picked_sub_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_info_outline_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/gallery_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cpv_btn_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_brush_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6dp 4 | 66dp 5 | 34dp 6 | 58dp 7 | 50dp 8 | 8dp 9 | 28dp 10 | 40dp 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/redo_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/undo_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/expand_left_right_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/delete_bin_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/save_3_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/info_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/menu/bhmenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 10 | 11 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/viewpager/PagerItem.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.viewpager; 2 | 3 | public abstract class PagerItem { 4 | 5 | protected static final float DEFAULT_WIDTH = 1.f; 6 | 7 | private final CharSequence title; 8 | private final float width; 9 | 10 | protected PagerItem(CharSequence title,float width){ 11 | this.title = title; 12 | this.width = width; 13 | } 14 | 15 | public CharSequence getTitle(){ 16 | return title; 17 | } 18 | 19 | public float getWidth(){ 20 | return width; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/baseline_auto_awesome_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/pencil_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/menu/bottom_nav_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/history_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pref_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 12 | 13 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/image_add_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/eraser_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/lock_2_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/input_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/paint_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/gallery_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/question_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/eye_close_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/eye_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | -keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | -renamesourcefileattribute SourceFile 22 | -dontwarn javax.annotation.Nullable -------------------------------------------------------------------------------- /app/src/main/res/layout/progress_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/upscale_compare_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/serhat/aieditor/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.serhat.aieditor", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/account_circle_line.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | 15 | 16 | 21 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/xml/preference.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/equalizer_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Serhat İbin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/share_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/palette_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/hand.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/viewpager/MainViewPager2Adapter.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.viewpager; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.collection.SparseArrayCompat; 5 | import androidx.fragment.app.Fragment; 6 | import androidx.fragment.app.FragmentActivity; 7 | import androidx.viewpager2.adapter.FragmentStateAdapter; 8 | 9 | import java.lang.ref.WeakReference; 10 | 11 | public class MainViewPager2Adapter extends FragmentStateAdapter { 12 | 13 | private final FragmentPagerItems pages; 14 | 15 | private final SparseArrayCompat> holder; 16 | 17 | public MainViewPager2Adapter(FragmentActivity fm, FragmentPagerItems pages) { 18 | super(fm); 19 | this.pages = pages; 20 | this.holder = new SparseArrayCompat<>(pages.size()); 21 | } 22 | 23 | @NonNull 24 | @Override 25 | public Fragment createFragment(int position) { 26 | return getPagerItem(position).instantiate(pages.getContext(), position); 27 | } 28 | 29 | @Override 30 | public int getItemCount() { 31 | return pages.size(); 32 | } 33 | 34 | protected FragmentPagerItem getPagerItem(int position) { 35 | return pages.get(position); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Enables namespacing of each library's R class so that its R class includes only the 19 | # resources declared in the library itself and none from the library's dependencies, 20 | # thereby reducing the size of the R class for that library 21 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/MainViewPager2Adapter.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.collection.SparseArrayCompat; 5 | import androidx.fragment.app.Fragment; 6 | import androidx.fragment.app.FragmentActivity; 7 | import androidx.viewpager2.adapter.FragmentStateAdapter; 8 | 9 | import com.serhat.aieditor.viewpager.FragmentPagerItem; 10 | import com.serhat.aieditor.viewpager.FragmentPagerItems; 11 | 12 | import java.lang.ref.WeakReference; 13 | 14 | public class MainViewPager2Adapter extends FragmentStateAdapter { 15 | 16 | private final FragmentPagerItems pages; 17 | 18 | private final SparseArrayCompat> holder; 19 | 20 | public MainViewPager2Adapter(FragmentActivity fm, FragmentPagerItems pages) { 21 | super(fm); 22 | this.pages = pages; 23 | this.holder = new SparseArrayCompat<>(pages.size()); 24 | } 25 | 26 | @NonNull 27 | @Override 28 | public Fragment createFragment(int position) { 29 | return getPagerItem(position).instantiate(pages.getContext(), position); 30 | } 31 | 32 | @Override 33 | public int getItemCount() { 34 | return pages.size(); 35 | } 36 | 37 | protected FragmentPagerItem getPagerItem(int position) { 38 | return pages.get(position); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/settings_line.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 15 | #83FFFFFF 16 | 17 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AI Image Editor 2 | 3 | A simple client app that demonstrates how to create a mask of drawing on an image and use it as a input for Stable Diffusion AI inpainting models via API. 4 | 5 | ![Adsız](https://github.com/Serkali-sudo/AI_Image_Editor/assets/59535990/f43c9e3b-da74-4421-b825-bc941b82c218) 6 | 7 | ## Requirements 8 | * An API key from [fal.ai](https://fal.ai/) 9 | * Minimum API: Android 5.1 (21) 10 | 11 | ## Features 12 | * Edit images using ai inpaint models like **Stable Diffusion XL Lightning** 13 | * Auto crop images that are not right size for the ai model 14 | * Downscale or upscale image resolution if it is too small or too big for the ai model 15 | * Auto save every image generated 16 | * Upscale images using ai models like: **RealESRGAN** 17 | 18 | ## How to use 19 | * Get an API key from [fal.ai](https://fal.ai/) 20 | * Enter the API key to the app from settings or it will prompt when you try to run or at start of the app if you havent entered an api key 21 | * Add an image you want to edit then paint the parts you want to edit 22 | * Write a prompt to tell ai to how it should edit 23 | * Then hit run and wait the result will appear on the top 24 | 25 | https://github.com/Serkali-sudo/ai-image-editor/assets/59535990/b105992f-3761-4e12-a675-a388731e74a4 26 | 27 | ## Screenshots 28 | ![showcase_big](https://github.com/Serkali-sudo/AI_Image_Editor/assets/59535990/eaebf3c0-7a89-4f37-9484-f734fdcf54ed) 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/model/GalleryModel.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.model; 2 | 3 | import com.serhat.aieditor.Utils; 4 | 5 | import java.io.File; 6 | 7 | public class GalleryModel { 8 | 9 | public String prompt; 10 | public String negative_prompt; 11 | public int width; 12 | public int height; 13 | public String path; 14 | public String originalPath; 15 | public String seed; 16 | public long id; 17 | public String addedDate; 18 | public boolean isSelected = false; 19 | 20 | public GalleryModel() { 21 | 22 | } 23 | 24 | 25 | public GalleryModel(long id, String prompt, String negative_prompt, 26 | int width, int height, String path, String originalPath, String seed, String addedDate) { 27 | this.id = id; 28 | this.prompt = prompt; 29 | this.negative_prompt = negative_prompt; 30 | this.width = width; 31 | this.height = height; 32 | this.path = path; 33 | this.originalPath = originalPath; 34 | this.seed = seed; 35 | this.addedDate = addedDate; 36 | } 37 | 38 | public void deleteFromDisk() { 39 | try { 40 | File file = new File(path); 41 | if (file.exists()) { 42 | file.delete(); 43 | } 44 | } catch (Exception e) { 45 | Utils.e("GalleryModel", e.getMessage()); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 17 | 18 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/AutoResetMode.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor; 2 | 3 | import androidx.annotation.IntDef; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | /** 9 | * Describes how the {@link ZoomageView} will reset to its original size 10 | * once interaction with it stops. {@link #UNDER} will reset when the image is smaller 11 | * than or equal to its starting size, {@link #OVER} when it's larger than or equal to its starting size, 12 | * {@link #ALWAYS} in both situations, 13 | * and {@link #NEVER} causes no reset. Note that when using {@link #NEVER}, the image will still animate 14 | * to within the screen bounds in certain situations. 15 | */ 16 | @Retention(RetentionPolicy.SOURCE) 17 | @IntDef({AutoResetMode.NEVER, AutoResetMode.UNDER, AutoResetMode.OVER, AutoResetMode.ALWAYS}) 18 | public @interface AutoResetMode { 19 | 20 | int UNDER = 0; 21 | int OVER = 1; 22 | int ALWAYS = 2; 23 | int NEVER = 3; 24 | 25 | class Parser { 26 | 27 | @AutoResetMode 28 | public static int fromInt(final int value) { 29 | switch (value) { 30 | case OVER: 31 | return OVER; 32 | case ALWAYS: 33 | return ALWAYS; 34 | case NEVER: 35 | return NEVER; 36 | default: 37 | return UNDER; 38 | } 39 | } 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/activity/PrefsActivity.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.activity; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.annotation.NonNull; 6 | import androidx.annotation.Nullable; 7 | 8 | import android.view.MenuItem; 9 | 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import androidx.appcompat.widget.Toolbar; 12 | 13 | 14 | import com.serhat.aieditor.R; 15 | import com.serhat.aieditor.fragment.SettingsFragment; 16 | 17 | import java.util.Objects; 18 | 19 | public class PrefsActivity extends AppCompatActivity { 20 | @Override 21 | protected void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.pref_activity); 24 | Toolbar toolbar = findViewById(R.id.toolbar); 25 | getSupportFragmentManager() 26 | .beginTransaction() 27 | .replace(R.id.settings_container, new SettingsFragment()) 28 | .commit(); 29 | setSupportActionBar(toolbar); 30 | Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); 31 | } 32 | 33 | @Override 34 | public boolean onOptionsItemSelected(@NonNull MenuItem item) { 35 | int id = item.getItemId(); 36 | if (id == android.R.id.home) { 37 | finish(); 38 | setResult(RESULT_OK); 39 | return true; 40 | } 41 | return super.onOptionsItemSelected(item); 42 | 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | namespace 'com.serhat.aieditor' 7 | compileSdk 34 8 | 9 | defaultConfig { 10 | applicationId "com.serhat.aieditor" 11 | minSdk 21 12 | targetSdk 34 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled true 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | compileOptions { 25 | sourceCompatibility JavaVersion.VERSION_1_8 26 | targetCompatibility JavaVersion.VERSION_1_8 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation 'androidx.appcompat:appcompat:1.6.1' 32 | implementation 'com.google.android.material:material:1.11.0' 33 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 34 | testImplementation 'junit:junit:4.13.2' 35 | androidTestImplementation 'androidx.test.ext:junit:1.1.5' 36 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' 37 | implementation 'com.android.volley:volley:1.2.1' 38 | implementation 'com.github.bumptech.glide:glide:4.16.0' 39 | implementation 'com.google.android.flexbox:flexbox:3.0.0' 40 | implementation "androidx.preference:preference:1.2.1" 41 | implementation 'com.airbnb.android:lottie:5.2.0' 42 | implementation "com.vanniktech:android-image-cropper:4.5.0" 43 | } -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Landscape (16:9) 6 | Landscape (4:3) 7 | Square (1:1) 8 | Portrait (9:16) 9 | Portrait (3:4) 10 | 11 | 12 | 13 | Light 14 | Dark 15 | Auto (By Time) 16 | Auto (By Battery) 17 | Auto (Follow System) 18 | 19 | 20 | 21 | 22 | 0 23 | 1 24 | 2 25 | 3 26 | 4 27 | 28 | 29 | 30 | 0 31 | 1 32 | 2 33 | 3 34 | 4 35 | 36 | 37 | 38 | 39 | RealESRGAN_x4plus 40 | RealESRGAN_x2plus 41 | RealESRGAN_x4plus_anime_6B 42 | RealESRGAN_x4_v3 43 | RealESRGAN_x4_wdn_v3 44 | RealESRGAN_x4_anime_v3 45 | 46 | 47 | 48 | 1 49 | 2 50 | 3 51 | 4 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/gallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 12 | 13 | 14 | 19 | 20 | 21 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/app/ApplicationPath.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.app; 2 | 3 | import android.os.Build; 4 | import android.os.Environment; 5 | 6 | import java.io.File; 7 | 8 | public class ApplicationPath { 9 | 10 | public static String savePath() { 11 | return getQuantumPath("AI Editor Saved", Environment.DIRECTORY_PICTURES); 12 | } 13 | 14 | public static String upscalePath() { 15 | return getQuantumPath("AI Editor Upscaled", Environment.DIRECTORY_PICTURES); 16 | } 17 | 18 | 19 | public static String getQuantumPath(String folderName, String dir) { 20 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { 21 | File result = new File(Environment.getExternalStoragePublicDirectory(dir), 22 | folderName); 23 | if (result.isDirectory() || result.mkdirs()) { 24 | return result.getPath(); 25 | } 26 | else { 27 | return (Environment.getExternalStoragePublicDirectory(dir).getPath()); 28 | } 29 | } else { 30 | if (App.getInstance().isStoragePermissionGranted()) { 31 | File result = new File(Environment.getExternalStoragePublicDirectory(dir), 32 | folderName); 33 | if (result.isDirectory() || result.mkdirs()) { 34 | return result.getPath(); 35 | } else { 36 | return (Environment.getExternalStoragePublicDirectory(dir).getPath()); 37 | } 38 | } else { 39 | return App.getInstance().getExternalFilesDir(folderName).getPath(); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/app/App.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.app; 2 | 3 | import android.Manifest; 4 | import android.app.Application; 5 | import android.content.pm.PackageManager; 6 | 7 | import androidx.appcompat.app.AppCompatDelegate; 8 | import androidx.core.app.ActivityCompat; 9 | 10 | 11 | import com.serhat.aieditor.preference.Prefs; 12 | 13 | public class App extends Application { 14 | 15 | public static App SELF_INSTANCE; 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | SELF_INSTANCE = this; 21 | Prefs prefs = Prefs.getInstance(getApplicationContext()); 22 | 23 | switch (prefs.getString("themeChoice", "4")) { 24 | case "0": 25 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); 26 | break; 27 | case "1": 28 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); 29 | break; 30 | case "2": 31 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_TIME); 32 | break; 33 | case "3": 34 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY); 35 | break; 36 | case "4": 37 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); 38 | break; 39 | } 40 | } 41 | 42 | 43 | public static App getInstance() { 44 | return SELF_INSTANCE; 45 | } 46 | 47 | public boolean isStoragePermissionGranted() { 48 | return ActivityCompat.checkSelfPermission(App.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/viewpager/FragmentPagerItem.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.viewpager; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | 6 | import androidx.fragment.app.Fragment; 7 | 8 | public class FragmentPagerItem extends PagerItem { 9 | 10 | private static final String TAG = FragmentPagerItem.class.getSimpleName(); 11 | private static final String KEY_POSITION = TAG + ":Position"; 12 | 13 | private final String className; 14 | private final Bundle args; 15 | 16 | 17 | protected FragmentPagerItem(CharSequence title, float width, String className, Bundle args) { 18 | super(title, width); 19 | this.className = className; 20 | this.args = args; 21 | } 22 | 23 | public static FragmentPagerItem of(CharSequence title, Class clazz) { 24 | return of(title, DEFAULT_WIDTH, clazz); 25 | } 26 | 27 | public static FragmentPagerItem of(CharSequence title, Class clazz, Bundle args) { 28 | return of(title, DEFAULT_WIDTH, clazz, args); 29 | } 30 | 31 | public static FragmentPagerItem of(CharSequence title, float width, 32 | Class clazz) { 33 | return of(title, width, clazz, new Bundle()); 34 | } 35 | 36 | public static FragmentPagerItem of(CharSequence title, float width, 37 | Class clazz, Bundle args) { 38 | return new FragmentPagerItem(title, width, clazz.getName(), args); 39 | } 40 | 41 | public static boolean hasPosition(Bundle args) { 42 | return args != null && args.containsKey(KEY_POSITION); 43 | } 44 | 45 | public static int getPosition(Bundle args) { 46 | return (hasPosition(args)) ? args.getInt(KEY_POSITION) : 0; 47 | } 48 | 49 | static void setPosition(Bundle args, int position) { 50 | args.putInt(KEY_POSITION, position); 51 | } 52 | 53 | public Fragment instantiate(Context context, int position) { 54 | setPosition(args, position); 55 | return Fragment.instantiate(context,className,args); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/viewpager/FragmentPagerItems.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.viewpager; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | 6 | import androidx.annotation.StringRes; 7 | import androidx.fragment.app.Fragment; 8 | 9 | public class FragmentPagerItems extends PagerItems { 10 | 11 | public FragmentPagerItems(Context context) { 12 | super(context); 13 | } 14 | 15 | public static Creator with(Context context) { 16 | return new Creator(context); 17 | } 18 | 19 | public static class Creator { 20 | 21 | private final FragmentPagerItems items; 22 | 23 | public Creator(Context context) { 24 | items = new FragmentPagerItems(context); 25 | } 26 | 27 | public Creator add(@StringRes int title, Class clazz) { 28 | return add(FragmentPagerItem.of(items.getContext().getString(title), clazz)); 29 | } 30 | 31 | public Creator add(@StringRes int title, Class clazz, Bundle args) { 32 | return add(FragmentPagerItem.of(items.getContext().getString(title), clazz, args)); 33 | } 34 | 35 | public Creator add(@StringRes int title, float width, Class clazz) { 36 | return add(FragmentPagerItem.of(items.getContext().getString(title), width, clazz)); 37 | } 38 | 39 | public Creator add(@StringRes int title, float width, Class clazz, 40 | Bundle args) { 41 | return add(FragmentPagerItem.of(items.getContext().getString(title), width, clazz, args)); 42 | } 43 | 44 | public Creator add(CharSequence title, Class clazz) { 45 | return add(FragmentPagerItem.of(title, clazz)); 46 | } 47 | 48 | public Creator add(CharSequence title, Class clazz, Bundle args) { 49 | return add(FragmentPagerItem.of(title, clazz, args)); 50 | } 51 | 52 | public Creator add(FragmentPagerItem item) { 53 | items.add(item); 54 | return this; 55 | } 56 | 57 | public FragmentPagerItems create() { 58 | return items; 59 | } 60 | 61 | } 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 10 | 11 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 40 | 41 | 46 | 47 | 52 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/preference/Prefs.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor.preference; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | import androidx.preference.PreferenceManager; 7 | 8 | public class Prefs { 9 | 10 | private final SharedPreferences sharedPreferences; 11 | private final SharedPreferences.Editor editor; 12 | 13 | private static Prefs instance; 14 | 15 | private Prefs(Context context) { 16 | sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 17 | editor = sharedPreferences.edit(); 18 | } 19 | 20 | public static Prefs getInstance(Context context) { 21 | if (instance == null) { 22 | instance = new Prefs(context); 23 | } 24 | return instance; 25 | } 26 | 27 | public void setInt(String key, int value) { 28 | editor.putInt(key, value); 29 | editor.apply(); 30 | } 31 | 32 | 33 | public void setLong(String key, long value) { 34 | editor.putLong(key, value); 35 | editor.apply(); 36 | } 37 | 38 | 39 | public void setString(String key, String value) { 40 | editor.putString(key, value); 41 | editor.apply(); 42 | } 43 | 44 | 45 | public void setBoolean(String key, boolean value) { 46 | editor.putBoolean(key, value); 47 | editor.apply(); 48 | } 49 | 50 | public void setFloat(String key, float value) { 51 | editor.putFloat(key, value).apply(); 52 | } 53 | 54 | public void removeKey(String key) { 55 | editor.remove(key); 56 | editor.apply(); 57 | } 58 | 59 | public boolean getBoolean(String key, boolean def) { 60 | return sharedPreferences.getBoolean(key, def); 61 | } 62 | 63 | public int getInt(String key, int def) { 64 | return sharedPreferences.getInt(key, def); 65 | } 66 | 67 | public float getFloat(String key, float def) { 68 | return sharedPreferences.getFloat(key, def); 69 | } 70 | 71 | 72 | public long getLong(String key, long def) { 73 | return sharedPreferences.getLong(key, def); 74 | } 75 | 76 | 77 | public String getString(String key, String def) { 78 | return sharedPreferences.getString(key, def); 79 | } 80 | 81 | public SharedPreferences getSharedPreferences() { 82 | return sharedPreferences; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/serhat/aieditor/Utils.java: -------------------------------------------------------------------------------- 1 | package com.serhat.aieditor; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.util.DisplayMetrics; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.view.inputmethod.InputMethodManager; 9 | import android.widget.EditText; 10 | 11 | public class Utils { 12 | public static boolean DEBUG = true; 13 | 14 | public static void hideKeyboard(Activity appCompatActivity) { 15 | View view = appCompatActivity.getCurrentFocus(); 16 | if (view != null) { 17 | InputMethodManager imm = (InputMethodManager) 18 | appCompatActivity.getSystemService(Context.INPUT_METHOD_SERVICE); 19 | imm.hideSoftInputFromWindow(view.getWindowToken(), 0); 20 | } 21 | } 22 | 23 | public static int pxToDp(Context context, int px) { 24 | DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); 25 | float density = displayMetrics.density; 26 | return Math.round(px / density); 27 | } 28 | 29 | // public static int px2dp(Context context, int px) { 30 | // Resources r = context.getResources(); 31 | // DisplayMetrics metrics = r.getDisplayMetrics(); 32 | // float dp = TypedValue.applyDimension( 33 | // TypedValue.COMPLEX_UNIT_PX, 34 | // px, 35 | // metrics 36 | // ); 37 | // return (int) dp; 38 | // } 39 | 40 | public static void hideKeyboard(Activity appCompatActivity, EditText editText) { 41 | InputMethodManager imm = (InputMethodManager) 42 | appCompatActivity.getSystemService(Context.INPUT_METHOD_SERVICE); 43 | imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); 44 | 45 | } 46 | 47 | 48 | public static void d(String tag, String message) { 49 | if (DEBUG) { 50 | Log.d(tag, message); 51 | } 52 | } 53 | 54 | public static void e(String tag, String message) { 55 | if (DEBUG) { 56 | Log.e(tag, message); 57 | } 58 | } 59 | 60 | public static void i(String tag, String message) { 61 | if (DEBUG) { 62 | Log.i(tag, message); 63 | } 64 | } 65 | 66 | public static void w(String tag, String message) { 67 | if (DEBUG) { 68 | Log.w(tag, message); 69 | } 70 | } 71 | 72 | public static void v(String tag, String message) { 73 | if (DEBUG) { 74 | Log.v(tag, message); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /app/src/main/res/layout/crop_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 17 | 22 | 23 | 31 | 32 | 40 | 41 | 42 | 43 | 47 | 48 | 56 | 57 | 60 | 61 | 65 | 66 | 67 | 68 | 69 | 73 | 74 | 75 | 76 | 77 | 78 |