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
b53054f2
Unverified
Commit
b53054f2
authored
May 03, 2019
by
Filipe de Lima Brito
Committed by
GitHub
May 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into strings
parents
1c0f9b61
a8d9ec30
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
38 deletions
+55
-38
DrawableHelper.kt
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
+38
-21
RegisterUsernameFragment.kt
...ntication/registerusername/ui/RegisterUsernameFragment.kt
+1
-1
ChatDetailsFragment.kt
...chat/rocket/android/chatdetails/ui/ChatDetailsFragment.kt
+1
-1
ChatRoomActivity.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
+1
-1
DirectoryFragment.kt
...ava/chat/rocket/android/directory/ui/DirectoryFragment.kt
+2
-2
DirectorySortingBottomSheetFragment.kt
...droid/directory/ui/DirectorySortingBottomSheetFragment.kt
+6
-6
SortingAndGroupingBottomSheetFragment.kt
...ngandgrouping/ui/SortingAndGroupingBottomSheetFragment.kt
+6
-6
No files found.
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
View file @
b53054f2
import
android.content.Context
import
android.graphics.drawable.Drawable
import
android.view.View
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.core.graphics.drawable.DrawableCompat
...
...
@@ -60,7 +61,7 @@ object DrawableHelper {
/**
* Tints a Drawable.
*
* REMARK: you MUST always wrap the Drawable before tint it.
* REMARK: you MUST always wrap the Drawable before tint
ing
it.
*
* @param drawable The Drawable to tint.
* @param context The context.
...
...
@@ -72,58 +73,74 @@ object DrawableHelper {
DrawableCompat
.
setTint
(
drawable
,
ContextCompat
.
getColor
(
context
,
resId
))
/**
* Compounds an array of Drawable (to appear
to the left of the
text) into an array of TextView.
* Compounds an array of Drawable (to appear
on the start side of a
text) into an array of TextView.
*
* REMARK: the number of elements in both array
of Drawable and EditText
MUST be equal.
* REMARK: the number of elements in both array
s of Drawable and TextView
MUST be equal.
*
* @param textView The array of TextView.
* @param drawables The array of Drawable.
* @see compound
Lef
tDrawable
* @see compound
Star
tDrawable
*/
fun
compoundDrawables
(
textView
:
Array
<
TextView
>,
drawables
:
Array
<
Drawable
>)
{
if
(
textView
.
size
!=
drawables
.
size
)
{
return
}
else
{
for
(
i
in
textView
.
indices
)
{
textView
[
i
].
setCompoundDrawablesWithIntrinsicBounds
(
drawables
[
i
],
null
,
null
,
null
)
if
(
textView
[
i
].
resources
.
configuration
.
layoutDirection
==
View
.
LAYOUT_DIRECTION_LTR
)
{
textView
[
i
].
setCompoundDrawablesWithIntrinsicBounds
(
drawables
[
i
],
null
,
null
,
null
)
}
else
{
textView
[
i
].
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
drawables
[
i
],
null
)
}
}
}
}
/**
* Compounds a Drawable (to appear on the
lef
t side of a text) into a TextView.
* Compounds a Drawable (to appear on the
star
t side of a text) into a TextView.
*
* @param textView The TextView.
* @param drawable The Drawable.
* @see compoundDrawables
*/
fun
compoundLeftDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
fun
compoundStartDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
if
(
textView
.
resources
.
configuration
.
layoutDirection
==
View
.
LAYOUT_DIRECTION_LTR
)
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
}
else
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
drawable
,
null
)
}
/**
* Compounds a Drawable (to appear on the
right
side of a text) into a TextView.
* Compounds a Drawable (to appear on the
end
side of a text) into a TextView.
*
* @param textView The TextView.
* @param drawable The Drawable.
* @see compound
Lef
tDrawable
* @see compound
Star
tDrawable
*/
fun
compoundRightDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
drawable
,
null
)
fun
compoundEndDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
if
(
textView
.
resources
.
configuration
.
layoutDirection
==
View
.
LAYOUT_DIRECTION_LTR
)
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
drawable
,
null
)
}
else
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
}
/**
* Compounds a Drawable (to appear on the
left and right
side of a text) into a TextView.
* Compounds a Drawable (to appear on the
start and end
side of a text) into a TextView.
*
* @param textView The TextView.
* @param
leftDrawable The lef
t Drawable.
* @param
rightDrawable The right
Drawable.
* @see compound
Lef
tDrawable
* @param
startDrawable The star
t Drawable.
* @param
endDrawable The end
Drawable.
* @see compound
Star
tDrawable
*/
fun
compound
LeftAndRight
Drawable
(
fun
compound
StartAndEnd
Drawable
(
textView
:
TextView
,
lef
tDrawable
:
Drawable
,
right
Drawable
:
Drawable
star
tDrawable
:
Drawable
,
end
Drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
leftDrawable
,
null
,
rightDrawable
,
null
)
if
(
textView
.
resources
.
configuration
.
layoutDirection
==
View
.
LAYOUT_DIRECTION_LTR
)
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
startDrawable
,
null
,
endDrawable
,
null
)
}
else
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
endDrawable
,
null
,
startDrawable
,
null
)
}
/**
* Returns the user status drawable.
...
...
@@ -141,4 +158,4 @@ object DrawableHelper {
else
->
getDrawableFromId
(
R
.
drawable
.
ic_status_invisible_12dp
,
context
)
}
}
}
\ No newline at end of file
}
app/src/main/java/chat/rocket/android/authentication/registerusername/ui/RegisterUsernameFragment.kt
View file @
b53054f2
...
...
@@ -140,7 +140,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
val
atDrawable
=
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_at_black_20dp
,
it
)
DrawableHelper
.
wrapDrawable
(
atDrawable
)
DrawableHelper
.
tintDrawable
(
atDrawable
,
it
,
R
.
color
.
colorDrawableTintGrey
)
DrawableHelper
.
compound
Lef
tDrawable
(
text_username
,
atDrawable
)
DrawableHelper
.
compound
Star
tDrawable
(
text_username
,
atDrawable
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatdetails/ui/ChatDetailsFragment.kt
View file @
b53054f2
...
...
@@ -195,7 +195,7 @@ class ChatDetailsFragment : Fragment(), ChatDetailsView {
val
wrappedDrawable
=
DrawableHelper
.
wrapDrawable
(
it
)
val
mutableDrawable
=
wrappedDrawable
.
mutate
()
DrawableHelper
.
tintDrawable
(
mutableDrawable
,
context
!!
,
R
.
color
.
colorPrimary
)
DrawableHelper
.
compound
Lef
tDrawable
(
name
,
mutableDrawable
)
DrawableHelper
.
compound
Star
tDrawable
(
name
,
mutableDrawable
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
View file @
b53054f2
...
...
@@ -139,7 +139,7 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
}
fun
setupExpandMoreForToolbar
(
listener
:
(
View
)
->
Unit
)
{
DrawableHelper
.
compound
Right
Drawable
(
DrawableHelper
.
compound
End
Drawable
(
text_toolbar_title
,
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_chatroom_toolbar_expand_more_20dp
,
this
)
)
...
...
app/src/main/java/chat/rocket/android/directory/ui/DirectoryFragment.kt
View file @
b53054f2
...
...
@@ -233,14 +233,14 @@ class DirectoryFragment : Fragment(), DirectoryView {
private
fun
updateSortByTitle
()
{
if
(
isSortByChannels
)
{
text_sort_by
.
text
=
getString
(
R
.
string
.
msg_channels
)
DrawableHelper
.
compound
LeftAndRight
Drawable
(
DrawableHelper
.
compound
StartAndEnd
Drawable
(
text_sort_by
,
hashtagDrawable
,
arrowDownDrawable
)
}
else
{
text_sort_by
.
text
=
getString
(
R
.
string
.
msg_users
)
DrawableHelper
.
compound
LeftAndRight
Drawable
(
DrawableHelper
.
compound
StartAndEnd
Drawable
(
text_sort_by
,
userDrawable
,
arrowDownDrawable
...
...
app/src/main/java/chat/rocket/android/directory/ui/DirectorySortingBottomSheetFragment.kt
View file @
b53054f2
...
...
@@ -100,21 +100,21 @@ class DirectorySortingBottomSheetFragment : BottomSheetDialogFragment() {
}
}
private
fun
checkSelection
(
textView
:
TextView
,
lef
tDrawable
:
Drawable
)
{
private
fun
checkSelection
(
textView
:
TextView
,
star
tDrawable
:
Drawable
)
{
context
?.
let
{
DrawableHelper
.
compound
LeftAndRight
Drawable
(
DrawableHelper
.
compound
StartAndEnd
Drawable
(
textView
,
lef
tDrawable
,
star
tDrawable
,
checkDrawable
)
}
}
private
fun
uncheckSelection
(
textView
:
TextView
,
lef
tDrawable
:
Drawable
)
{
private
fun
uncheckSelection
(
textView
:
TextView
,
star
tDrawable
:
Drawable
)
{
context
?.
let
{
DrawableHelper
.
compound
Lef
tDrawable
(
DrawableHelper
.
compound
Star
tDrawable
(
textView
,
lef
tDrawable
star
tDrawable
)
}
}
...
...
app/src/main/java/chat/rocket/android/sortingandgrouping/ui/SortingAndGroupingBottomSheetFragment.kt
View file @
b53054f2
...
...
@@ -143,21 +143,21 @@ class SortingAndGroupingBottomSheetFragment : BottomSheetDialogFragment(), Sorti
text_sort_by
.
text
=
getString
(
R
.
string
.
msg_sort_by_placeholder
,
text
.
toLowerCase
())
}
private
fun
checkSelection
(
textView
:
TextView
,
@DrawableRes
lef
tDrawable
:
Int
)
{
private
fun
checkSelection
(
textView
:
TextView
,
@DrawableRes
star
tDrawable
:
Int
)
{
context
?.
let
{
DrawableHelper
.
compound
LeftAndRight
Drawable
(
DrawableHelper
.
compound
StartAndEnd
Drawable
(
textView
,
DrawableHelper
.
getDrawableFromId
(
lef
tDrawable
,
it
),
DrawableHelper
.
getDrawableFromId
(
star
tDrawable
,
it
),
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_check
,
it
)
)
}
}
private
fun
uncheckSelection
(
textView
:
TextView
,
@DrawableRes
lef
tDrawable
:
Int
)
{
private
fun
uncheckSelection
(
textView
:
TextView
,
@DrawableRes
star
tDrawable
:
Int
)
{
context
?.
let
{
DrawableHelper
.
compound
Lef
tDrawable
(
DrawableHelper
.
compound
Star
tDrawable
(
textView
,
DrawableHelper
.
getDrawableFromId
(
lef
tDrawable
,
it
)
DrawableHelper
.
getDrawableFromId
(
star
tDrawable
,
it
)
)
}
}
...
...
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