mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 22:37:59 +01:00
show the editor draw canvas only when appropriate
This commit is contained in:
parent
8f3ddfffa9
commit
c44a884a95
3 changed files with 28 additions and 0 deletions
|
@ -180,6 +180,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
private fun loadDefaultImageView() {
|
private fun loadDefaultImageView() {
|
||||||
default_image_view.beVisible()
|
default_image_view.beVisible()
|
||||||
crop_image_view.beGone()
|
crop_image_view.beGone()
|
||||||
|
editor_draw_canvas.beGone()
|
||||||
|
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
|
@ -219,6 +220,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
|
|
||||||
private fun loadCropImageView() {
|
private fun loadCropImageView() {
|
||||||
default_image_view.beGone()
|
default_image_view.beGone()
|
||||||
|
editor_draw_canvas.beGone()
|
||||||
crop_image_view.apply {
|
crop_image_view.apply {
|
||||||
beVisible()
|
beVisible()
|
||||||
setOnCropImageCompleteListener(this@EditActivity)
|
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)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
private fun saveImage() {
|
private fun saveImage() {
|
||||||
var inputStream: InputStream? = null
|
var inputStream: InputStream? = null
|
||||||
|
@ -388,6 +396,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
loadCropImageView()
|
loadCropImageView()
|
||||||
} else if (default_image_view.isGone() && currPrimaryAction == PRIMARY_ACTION_FILTER) {
|
} else if (default_image_view.isGone() && currPrimaryAction == PRIMARY_ACTION_FILTER) {
|
||||||
loadDefaultImageView()
|
loadDefaultImageView()
|
||||||
|
} else if (editor_draw_canvas.isGone() && currPrimaryAction == PRIMARY_ACTION_DRAW) {
|
||||||
|
loadDrawCanvas()
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayOf(bottom_primary_filter, bottom_primary_crop_rotate, bottom_primary_draw).forEach {
|
arrayOf(bottom_primary_filter, bottom_primary_crop_rotate, bottom_primary_draw).forEach {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
||||||
|
}
|
|
@ -23,6 +23,15 @@
|
||||||
app:cropBackgroundColor="@color/crop_image_view_background"
|
app:cropBackgroundColor="@color/crop_image_view_background"
|
||||||
app:cropInitialCropWindowPaddingRatio="0"/>
|
app:cropInitialCropWindowPaddingRatio="0"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.gallery.pro.views.EditorDrawCanvas
|
||||||
|
android:id="@+id/editor_draw_canvas"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_above="@+id/bottom_editor_crop_rotate_actions"
|
||||||
|
android:layout_marginBottom="@dimen/activity_margin"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/bottom_editor_actions_background"
|
android:id="@+id/bottom_editor_actions_background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue