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
53ce8603
Commit
53ce8603
authored
Nov 21, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change TextView to EditText since TextView extends EditText and we are using both.
parent
28c34fa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
DrawableHelper.kt
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
+10
-10
No files found.
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
View file @
53ce8603
...
...
@@ -3,6 +3,7 @@ import android.graphics.drawable.Drawable
import
android.support.v4.content.ContextCompat
import
android.support.v4.graphics.drawable.DrawableCompat
import
android.widget.EditText
import
android.widget.TextView
/**
* @author Filipe de Lima Brito (filipedelimabrito@gmail.com)
...
...
@@ -40,7 +41,6 @@ object DrawableHelper {
*/
fun
wrapDrawable
(
drawable
:
Drawable
)
=
DrawableCompat
.
wrap
(
drawable
)
/**
* Tints an array of Drawable.
*
...
...
@@ -72,30 +72,30 @@ object DrawableHelper {
fun
tintDrawable
(
drawable
:
Drawable
,
context
:
Context
,
resId
:
Int
)
=
DrawableCompat
.
setTint
(
drawable
,
ContextCompat
.
getColor
(
context
,
resId
))
/**
* Compounds an array of Drawable (to appear to the left of the text) into an array of
EditText
.
* Compounds an array of Drawable (to appear to the left of the text) into an array of
TextView
.
*
* REMARK: the number of elements in both array of Drawable and EditText MUST be equal.
*
* @param
editTexts The array of EditText
.
* @param
textView The array of TextView
.
* @param drawables The array of Drawable.
* @see compoundDrawable
*/
fun
compoundDrawables
(
editTexts
:
Array
<
EditText
>,
drawables
:
Array
<
Drawable
>)
{
if
(
editTexts
.
size
!=
drawables
.
size
)
{
fun
compoundDrawables
(
textView
:
Array
<
EditText
>,
drawables
:
Array
<
Drawable
>)
{
if
(
textView
.
size
!=
drawables
.
size
)
{
return
}
else
{
for
(
i
in
editTexts
.
indices
)
{
editTexts
[
i
].
setCompoundDrawablesWithIntrinsicBounds
(
drawables
[
i
],
null
,
null
,
null
)
for
(
i
in
textView
.
indices
)
{
textView
[
i
].
setCompoundDrawablesWithIntrinsicBounds
(
drawables
[
i
],
null
,
null
,
null
)
}
}
}
/**
* Compounds a Drawable (to appear to the left of the text) into a
n EditText
.
* Compounds a Drawable (to appear to the left of the text) into a
TextView
.
*
* @param
editText The EditText
.
* @param
textView The TextView
.
* @param drawable The Drawable.
* @see compoundDrawables
*/
fun
compoundDrawable
(
editText
:
EditText
,
drawable
:
Drawable
)
=
editText
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
fun
compoundDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
}
\ 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