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
89d4f617
Commit
89d4f617
authored
May 14, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes formatting issues on draw module classes and update gradle version.
parent
d34e779d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
13 deletions
+38
-13
build.gradle
build.gradle
+1
-1
DrawActivity.kt
...ain/java/chat/rocket/android/draw/main/ui/DrawActivity.kt
+21
-3
CustomDrawView.kt
...in/java/chat/rocket/android/draw/widget/CustomDrawView.kt
+14
-7
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+2
-2
No files found.
build.gradle
View file @
89d4f617
...
@@ -10,7 +10,7 @@ buildscript {
...
@@ -10,7 +10,7 @@ buildscript {
}
}
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:3.
3.2
'
classpath
'com.android.tools.build:gradle:3.
4.0
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath
"org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}"
classpath
"org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}"
classpath
'com.google.gms:google-services:4.2.0'
classpath
'com.google.gms:google-services:4.2.0'
...
...
draw/src/main/java/chat/rocket/android/draw/main/ui/DrawActivity.kt
View file @
89d4f617
...
@@ -45,6 +45,14 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
...
@@ -45,6 +45,14 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
}
}
private
fun
setupListeners
()
{
private
fun
setupListeners
()
{
custom_draw_view
.
setOnTouchListener
{
view
,
event
->
custom_draw_view
.
onTouch
(
event
,
draw_tools
,
::
toggleCompleteDrawTools
)
}
image_close_drawing
.
setOnClickListener
{
finish
()
}
image_close_drawing
.
setOnClickListener
{
finish
()
}
image_send_drawing
.
setOnClickListener
{
image_send_drawing
.
setOnClickListener
{
...
@@ -53,7 +61,7 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
...
@@ -53,7 +61,7 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
}
}
private
fun
setupDrawTools
()
{
private
fun
setupDrawTools
()
{
image_draw_eraser
.
setOnLongClickListener
{
image_draw_eraser
.
setOnLongClickListener
{
custom_draw_view
.
clearCanvas
()
custom_draw_view
.
clearCanvas
()
return
@setOnLongClickListener
true
return
@setOnLongClickListener
true
}
}
...
@@ -117,10 +125,19 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
...
@@ -117,10 +125,19 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
}
}
}
}
private
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
()
{
private
fun
colorSelector
()
{
image_color_black
.
setOnClickListener
{
image_color_black
.
setOnClickListener
{
custom_draw_view
.
setColor
(
custom_draw_view
.
setColor
(
ResourcesCompat
.
getColor
(
resources
,
R
.
color
.
color_black
,
null
)
ResourcesCompat
.
getColor
(
resources
,
R
.
color
.
color_black
,
null
)
)
)
scaleColorView
(
image_color_black
)
scaleColorView
(
image_color_black
)
}
}
...
@@ -232,6 +249,7 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
...
@@ -232,6 +249,7 @@ class DrawingActivity : DaggerAppCompatActivity(), DrawView {
})
})
}
}
private
val
Int
.
toPx
:
Float
private
val
Int
.
toPx
:
Float
get
()
=
(
this
*
Resources
.
getSystem
().
displayMetrics
.
density
)
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 @
89d4f617
...
@@ -79,7 +79,7 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
...
@@ -79,7 +79,7 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
}
}
fun
setAlpha
(
newAlpha
:
Int
)
{
fun
setAlpha
(
newAlpha
:
Int
)
{
val
alpha
=
(
newAlpha
*
255
)/
100
val
alpha
=
(
newAlpha
*
255
)
/
100
mPaintOptions
.
alpha
=
alpha
mPaintOptions
.
alpha
=
alpha
setColor
(
mPaintOptions
.
color
)
setColor
(
mPaintOptions
.
color
)
}
}
...
@@ -154,25 +154,32 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
...
@@ -154,25 +154,32 @@ class CustomDrawView(context: Context, attrs: AttributeSet) : View(context, attr
mPaths
.
put
(
mPath
,
mPaintOptions
)
mPaths
.
put
(
mPath
,
mPaintOptions
)
mPath
=
MyPath
()
mPath
=
MyPath
()
mPaintOptions
=
PaintOptions
(
mPaintOptions
.
color
,
mPaintOptions
.
strokeWidth
,
mPaintOptions
.
alpha
)
mPaintOptions
=
PaintOptions
(
mPaintOptions
.
color
,
mPaintOptions
.
strokeWidth
,
mPaintOptions
.
alpha
)
}
}
override
fun
onTouchEvent
(
event
:
MotionEvent
):
Boolean
{
fun
onTouch
(
event
:
MotionEvent
,
drawTools
:
View
,
toggleDrawTools
:
(
View
,
Boolean
)
->
Unit
):
Boolean
{
val
x
=
event
.
x
val
x
=
event
.
x
val
y
=
event
.
y
val
y
=
event
.
y
when
(
event
.
action
)
{
when
(
event
.
action
)
{
MotionEvent
.
ACTION_DOWN
->
{
MotionEvent
.
ACTION_DOWN
->
{
toggleDrawTools
(
drawTools
,
false
)
mStartX
=
x
mStartX
=
x
mStartY
=
y
mStartY
=
y
actionDown
(
x
,
y
)
actionDown
(
x
,
y
)
mUndonePaths
.
clear
()
mUndonePaths
.
clear
()
}
}
MotionEvent
.
ACTION_MOVE
->
actionMove
(
x
,
y
)
MotionEvent
.
ACTION_MOVE
->
actionMove
(
x
,
y
)
MotionEvent
.
ACTION_UP
->
actionUp
()
MotionEvent
.
ACTION_UP
->
{
toggleDrawTools
(
drawTools
,
true
)
actionUp
()
}
}
}
invalidate
()
invalidate
()
return
true
return
true
}
}
}
}
\ No newline at end of file
gradle/wrapper/gradle-wrapper.properties
View file @
89d4f617
#
Wed Oct 10 10:41:36 UYT 2018
#
Tue May 14 21:15:38 BRT 2019
distributionBase
=
GRADLE_USER_HOME
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
4.10.2
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
5.1.1
-all.zip
distributionSha256Sum
=
b7aedd369a26b177147bcb715f8b1fc4fe32b0a6ade0d7fd8ee5ed0c6f731f2c
distributionSha256Sum
=
b7aedd369a26b177147bcb715f8b1fc4fe32b0a6ade0d7fd8ee5ed0c6f731f2c
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