Merge pull request #248 from Naveen3Singh/ux_improvements
UI/UX improvements
This commit is contained in:
commit
47c707a733
|
@ -12,6 +12,7 @@ import android.os.Bundle
|
|||
import android.provider.MediaStore
|
||||
import android.view.WindowManager
|
||||
import android.webkit.MimeTypeMap
|
||||
import android.widget.ImageView
|
||||
import android.widget.SeekBar
|
||||
import android.widget.Toast
|
||||
import androidx.print.PrintHelper
|
||||
|
@ -137,6 +138,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
|
|||
|
||||
requestedOrientation = if (config.forcePortraitMode) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|
||||
refreshMenuItems()
|
||||
updateButtonStates()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
@ -348,6 +350,8 @@ class MainActivity : SimpleActivity(), CanvasListener {
|
|||
private fun eraserClicked() {
|
||||
if (isEyeDropperOn) {
|
||||
eyeDropperClicked()
|
||||
} else if (isBucketFillOn) {
|
||||
bucketFillClicked()
|
||||
}
|
||||
|
||||
isEraserOn = !isEraserOn
|
||||
|
@ -355,13 +359,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
|
|||
}
|
||||
|
||||
private fun updateEraserState() {
|
||||
val iconId = if (isEraserOn) {
|
||||
R.drawable.ic_eraser_off_vector
|
||||
} else {
|
||||
R.drawable.ic_eraser_on_vector
|
||||
}
|
||||
|
||||
eraser.setImageResource(iconId)
|
||||
updateButtonStates()
|
||||
my_canvas.toggleEraser(isEraserOn)
|
||||
}
|
||||
|
||||
|
@ -382,6 +380,8 @@ class MainActivity : SimpleActivity(), CanvasListener {
|
|||
private fun eyeDropperClicked() {
|
||||
if (isEraserOn) {
|
||||
eraserClicked()
|
||||
} else if (isBucketFillOn) {
|
||||
bucketFillClicked()
|
||||
}
|
||||
|
||||
isEyeDropperOn = !isEyeDropperOn
|
||||
|
@ -391,28 +391,44 @@ class MainActivity : SimpleActivity(), CanvasListener {
|
|||
eyeDropper.stop()
|
||||
}
|
||||
|
||||
val iconId = if (isEyeDropperOn) {
|
||||
R.drawable.ic_colorize_off_vector
|
||||
} else {
|
||||
R.drawable.ic_colorize_on_vector
|
||||
}
|
||||
|
||||
eye_dropper.setImageResource(iconId)
|
||||
updateButtonStates()
|
||||
}
|
||||
|
||||
private fun bucketFillClicked() {
|
||||
isBucketFillOn = !isBucketFillOn
|
||||
|
||||
val iconId = if (isBucketFillOn) {
|
||||
R.drawable.ic_bucket_fill_off_vector
|
||||
} else {
|
||||
R.drawable.ic_bucket_fill_on_vector
|
||||
if (isEraserOn) {
|
||||
eraserClicked()
|
||||
} else if (isEyeDropperOn) {
|
||||
eyeDropperClicked()
|
||||
}
|
||||
|
||||
bucket_fill.setImageResource(iconId)
|
||||
isBucketFillOn = !isBucketFillOn
|
||||
|
||||
updateButtonStates()
|
||||
my_canvas.toggleBucketFill(isBucketFillOn)
|
||||
}
|
||||
|
||||
private fun updateButtonStates() {
|
||||
hideBrushSettings(isEyeDropperOn || isBucketFillOn)
|
||||
|
||||
updateButtonColor(eraser, isEraserOn)
|
||||
updateButtonColor(eye_dropper, isEyeDropperOn)
|
||||
updateButtonColor(bucket_fill, isBucketFillOn)
|
||||
}
|
||||
|
||||
private fun updateButtonColor(view: ImageView, enabled: Boolean) {
|
||||
if (enabled) {
|
||||
view.applyColorFilter(getProperPrimaryColor())
|
||||
} else {
|
||||
view.applyColorFilter(config.canvasBackgroundColor.getContrastColor())
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideBrushSettings(hide: Boolean) {
|
||||
arrayOf(stroke_width_bar, stroke_width_preview).forEach {
|
||||
it.beGoneIf(hide)
|
||||
}
|
||||
}
|
||||
|
||||
private fun confirmImage() {
|
||||
when {
|
||||
isEditIntent -> {
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.draw.pro.extensions
|
|||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
|
||||
|
||||
val View.boundingBox: Rect
|
||||
get() {
|
||||
val rect = Rect()
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.os.Parcel
|
|||
import android.os.Parcelable
|
||||
import android.view.View
|
||||
|
||||
|
||||
internal class MyParcelable : View.BaseSavedState {
|
||||
var operations = ArrayList<CanvasOp>()
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
|
|||
private val MIN_ERASER_WIDTH = 20f
|
||||
private val MAX_HISTORY_COUNT = 1000
|
||||
private val BITMAP_MAX_HISTORY_COUNT = 60
|
||||
private val DEFAULT_FLOOD_FILL_TOLERANCE = 200
|
||||
private val DEFAULT_FLOOD_FILL_TOLERANCE = 190
|
||||
|
||||
private val mScaledTouchSlop = ViewConfiguration.get(context).scaledTouchSlop
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59C17.95 14.89 18 14.45 18 14zm-0.88 3.12L12.5 12.5 5.27 5.27 4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6 1.52 0 2.9-0.57 3.96-1.5l2.63 2.63 1.27-1.27-2.74-2.74z"/>
|
||||
</vector>
|
|
@ -1,4 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M10.266 8.976L3 16.25V21h4.75l7.27-7.27zM6.92 19L5 17.08l6.665-6.673c3.355 3.323 1.973 1.946 1.973 1.946zm11.174-5.497l1.41-1.41-1.92-1.92 3.12-3.12c0.4-0.4 0.4-1.03 0.01-1.42l-2.34-2.34c-0.2-0.19-0.45-0.29-0.7-0.29-0.26 0-0.51 0.1-0.71 0.29l-3.12 3.12-1.93-1.91-1.41 1.41"/>
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M3.186 3.03c-0.39 0.39-0.39 1.02 0 1.41l16.32 16.33c0.39 0.39 1.02 0.39 1.41 0 0.39-0.39 0.39-1.02 0-1.41L4.606 3.03c-0.39-0.39-1.03-0.39-1.42 0z"/>
|
||||
</vector>
|
|
@ -1,18 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="m16.782,14.8731 l-5.0471,5.0471c-1.56,1.56 -4.09,1.56 -5.66,0l-3.53,-3.53c-0.78,-0.79 -0.78,-2.05 0,-2.84L9.0007,7.0944m-5.0458,7.8758 l3.54,3.53c0.78,0.79 2.04,0.79 2.83,0l3.53,-3.53 -4.95,-4.95z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="m7.8687,20.0909c0.0003,0.5515 0.4461,0.9968 0.9976,0.9964l11.646,-0.0069c0.5515,-0.0003 0.9968,-0.4461 0.9964,-0.9976 -0.0003,-0.5515 -0.4461,-0.9968 -0.9976,-0.9964L8.8722,19.0862c-0.5515,0.0003 -1.0038,0.4532 -1.0035,1.0047z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="m2.3788,2.019c-0.4314,0.4314 -0.4314,1.1282 0,1.5596L20.4315,21.6414c0.4314,0.4314 1.1283,0.4314 1.5597,0 0.4314,-0.4314 0.4314,-1.1282 0,-1.5596L3.9495,2.019c-0.4314,-0.4314 -1.1394,-0.4314 -1.5708,0z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="m15.9748,2.9503 l4.95,4.94c0.78,0.79 0.78,2.05 0,2.84l-2.7176,2.7176c-7.7808,-7.7792 0,0 -7.7808,-7.7792l2.7184,-2.7184c0.79,-0.78 2.05,-0.78 2.83,0" />
|
||||
</vector>
|
|
@ -45,6 +45,7 @@
|
|||
android:layout_width="@dimen/normal_icon_size"
|
||||
android:layout_height="@dimen/normal_icon_size"
|
||||
android:layout_toStartOf="@+id/bucket_fill"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:contentDescription="@string/redo"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_redo_vector"
|
||||
|
@ -57,7 +58,7 @@
|
|||
android:layout_toStartOf="@+id/eraser"
|
||||
android:contentDescription="@string/bucket_fill"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_bucket_fill_on_vector" />
|
||||
android:src="@drawable/ic_bucket_fill_vector" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/eraser"
|
||||
|
@ -66,7 +67,7 @@
|
|||
android:layout_toStartOf="@+id/eye_dropper"
|
||||
android:contentDescription="@string/eraser"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_eraser_on_vector" />
|
||||
android:src="@drawable/ic_eraser_vector" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/eye_dropper"
|
||||
|
@ -75,7 +76,7 @@
|
|||
android:layout_toStartOf="@+id/color_picker"
|
||||
android:contentDescription="@string/eyedropper"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_colorize_on_vector"
|
||||
android:src="@drawable/ic_colorize_vector"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
|
@ -91,6 +92,7 @@
|
|||
android:layout_height="@dimen/normal_icon_size"
|
||||
android:layout_below="@id/color_picker"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="?actionBarItemBackground"
|
||||
android:contentDescription="@string/undo"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_undo_vector"
|
||||
|
|
Loading…
Reference in New Issue