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
6318be9e
Commit
6318be9e
authored
Mar 05, 2019
by
kareemhamdy500
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make it draw_tools hide during drawing
parent
330098d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
28 deletions
+17
-28
DrawActivity.kt
...ain/java/chat/rocket/android/draw/main/ui/DrawActivity.kt
+9
-4
CustomDrawView.kt
...in/java/chat/rocket/android/draw/widget/CustomDrawView.kt
+8
-4
ic_draw_tools_shwoing_24dp.xml
draw/src/main/res/drawable/ic_draw_tools_shwoing_24dp.xml
+0
-5
activity_drawing.xml
draw/src/main/res/layout/activity_drawing.xml
+0
-15
No files found.
draw/src/main/java/chat/rocket/android/draw/main/ui/DrawActivity.kt
View file @
6318be9e
...
...
@@ -44,10 +44,14 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
.
show
()
}
private
fun
setupListeners
()
{
custom_draw_view
.
setOnClickListener
{
toggleCompleteDrawTools
(
draw_tools
,
false
)
}
image_show_drawing_tool
.
setOnClickListener
{
toggleCompleteDrawTools
(
draw_tools
)
}
private
fun
setupListeners
()
{
custom_draw_view
.
setOnTouchListener
{
view
,
event
->
custom_draw_view
.
onTouch
(
event
,
draw_tools
,
::
toggleCompleteDrawTools
)
}
image_close_drawing
.
setOnClickListener
{
finish
()
}
...
...
@@ -114,7 +118,7 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
}
}
private
fun
toggleCompleteDrawTools
(
view
:
View
,
showView
:
Boolean
=
true
)
{
fun
toggleCompleteDrawTools
(
view
:
View
,
showView
:
Boolean
=
true
)
{
if
(
view
.
translationY
==
(
112
).
toPx
&&
showView
)
{
toggleDrawTools
(
draw_tools
,
false
)
}
else
{
...
...
@@ -231,6 +235,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 @
6318be9e
...
...
@@ -80,7 +80,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
)
}
...
...
@@ -158,22 +158,26 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
mPaintOptions
=
PaintOptions
(
mPaintOptions
.
color
,
mPaintOptions
.
strokeWidth
,
mPaintOptions
.
alpha
)
}
override
fun
onTouchEvent
(
event
:
MotionEvent
):
Boolean
{
super
.
onTouchEvent
(
event
)
fun
onTouch
(
event
:
MotionEvent
,
drawTools
:
View
,
toggleDrawTools
:
(
View
,
Boolean
)
->
Unit
):
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
draw/src/main/res/drawable/ic_draw_tools_shwoing_24dp.xml
deleted
100644 → 0
View file @
330098d2
<vector
android:autoMirrored=
"true"
android:height=
"24dp"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"
/>
</vector>
draw/src/main/res/layout/activity_drawing.xml
View file @
6318be9e
...
...
@@ -28,21 +28,6 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/image_show_drawing_tool"
android:layout_width=
"56dp"
android:layout_height=
"56dp"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"8dp"
android:background=
"@color/color_white"
android:foreground=
"?selectableItemBackgroundBorderless"
android:padding=
"16dp"
android:src=
"@drawable/ic_draw_tools_shwoing_24dp"
android:tint=
"@color/icon_color"
app:layout_constraintEnd_toStartOf=
"@+id/image_send_drawing"
app:layout_constraintStart_toEndOf=
"@+id/image_close_drawing"
app:layout_constraintTop_toTopOf=
"@+id/custom_draw_view"
/>
<ImageView
android:id=
"@+id/image_send_drawing"
android:layout_width=
"56dp"
...
...
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