From c44a884a952f3a8d62bf194f678bbbff30b475c1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 17:34:00 +0100 Subject: [PATCH] show the editor draw canvas only when appropriate --- .../gallery/pro/activities/EditActivity.kt | 10 ++++++++++ .../gallery/pro/views/EditorDrawCanvas.kt | 9 +++++++++ app/src/main/res/layout/activity_edit.xml | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index e0f76780f..a791a634a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -180,6 +180,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun loadDefaultImageView() { default_image_view.beVisible() crop_image_view.beGone() + editor_draw_canvas.beGone() val options = RequestOptions() .skipMemoryCache(true) @@ -219,6 +220,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun loadCropImageView() { default_image_view.beGone() + editor_draw_canvas.beGone() crop_image_view.apply { beVisible() setOnCropImageCompleteListener(this@EditActivity) @@ -233,6 +235,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + private fun loadDrawCanvas() { + default_image_view.beGone() + crop_image_view.beGone() + editor_draw_canvas.beVisible() + } + @TargetApi(Build.VERSION_CODES.N) private fun saveImage() { var inputStream: InputStream? = null @@ -388,6 +396,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener loadCropImageView() } else if (default_image_view.isGone() && currPrimaryAction == PRIMARY_ACTION_FILTER) { loadDefaultImageView() + } else if (editor_draw_canvas.isGone() && currPrimaryAction == PRIMARY_ACTION_DRAW) { + loadDrawCanvas() } arrayOf(bottom_primary_filter, bottom_primary_crop_rotate, bottom_primary_draw).forEach { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt new file mode 100644 index 000000000..9fd6014e3 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -0,0 +1,9 @@ +package com.simplemobiletools.gallery.pro.views + +import android.content.Context +import android.util.AttributeSet +import android.view.View + +class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { + +} diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index b6db534a7..6a675d81c 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -23,6 +23,15 @@ app:cropBackgroundColor="@color/crop_image_view_background" app:cropInitialCropWindowPaddingRatio="0"/> + +