Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
ad9e42ed
Unverified
Commit
ad9e42ed
authored
May 14, 2019
by
Filipe Brito
Committed by
GitHub
May 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2084 from kareemhamdy100/develop
[IMPROVEMENT] Hide the drawing toolbar while drawing
parents
6642f154
67364d3e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
build.gradle
app/build.gradle
+1
-1
DrawActivity.kt
...ain/java/chat/rocket/android/draw/main/ui/DrawActivity.kt
+18
-0
CustomDrawView.kt
...in/java/chat/rocket/android/draw/widget/CustomDrawView.kt
+9
-5
No files found.
app/build.gradle
View file @
ad9e42ed
draw/src/main/java/chat/rocket/android/draw/main/ui/DrawActivity.kt
View file @
ad9e42ed
...
...
@@ -44,7 +44,15 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
.
show
()
}
private
fun
setupListeners
()
{
custom_draw_view
.
setOnTouchListener
{
view
,
event
->
custom_draw_view
.
onTouch
(
event
,
draw_tools
,
::
toggleCompleteDrawTools
)
}
image_close_drawing
.
setOnClickListener
{
finish
()
}
image_send_drawing
.
setOnClickListener
{
...
...
@@ -117,6 +125,15 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
}
}
fun
toggleCompleteDrawTools
(
view
:
View
,
showView
:
Boolean
=
true
)
{
if
(
view
.
translationY
==
(
112
).
toPx
&&
showView
)
{
toggleDrawTools
(
draw_tools
,
false
)
}
else
{
view
.
animate
().
translationY
((
112
).
toPx
)
}
}
private
fun
colorSelector
()
{
image_color_black
.
setOnClickListener
{
custom_draw_view
.
setColor
(
...
...
@@ -232,6 +249,7 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
})
}
private
val
Int
.
toPx
:
Float
get
()
=
(
this
*
Resources
.
getSystem
().
displayMetrics
.
density
)
}
\ No newline at end of file
draw/src/main/java/chat/rocket/android/draw/widget/CustomDrawView.kt
View file @
ad9e42ed
...
...
@@ -79,7 +79,7 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
}
fun
setAlpha
(
newAlpha
:
Int
)
{
val
alpha
=
(
newAlpha
*
255
)/
100
val
alpha
=
(
newAlpha
*
255
)
/
100
mPaintOptions
.
alpha
=
alpha
setColor
(
mPaintOptions
.
color
)
}
...
...
@@ -157,22 +157,26 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
mPaintOptions
=
PaintOptions
(
mPaintOptions
.
color
,
mPaintOptions
.
strokeWidth
,
mPaintOptions
.
alpha
)
}
override
fun
onTouchEvent
(
event
:
MotionEven
t
):
Boolean
{
fun
onTouch
(
event
:
MotionEvent
,
drawTools
:
View
,
toggleDrawTools
:
(
View
,
Boolean
)
->
Uni
t
):
Boolean
{
val
x
=
event
.
x
val
y
=
event
.
y
when
(
event
.
action
)
{
MotionEvent
.
ACTION_DOWN
->
{
toggleDrawTools
(
drawTools
,
false
)
mStartX
=
x
mStartY
=
y
actionDown
(
x
,
y
)
mUndonePaths
.
clear
()
}
MotionEvent
.
ACTION_MOVE
->
actionMove
(
x
,
y
)
MotionEvent
.
ACTION_UP
->
actionUp
()
MotionEvent
.
ACTION_UP
->
{
toggleDrawTools
(
drawTools
,
true
)
actionUp
()
}
}
invalidate
()
return
true
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment