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
b575b920
Commit
b575b920
authored
May 27, 2017
by
Matheus Jardim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes to AbstractRenderer.shouldHandle
parent
9064f843
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
build.gradle
app/build.gradle
+1
-1
AbstractRenderer.java
...n/java/chat/rocket/android/renderer/AbstractRenderer.java
+15
-13
UserViewHolder.java
...roid/widget/message/autocomplete/user/UserViewHolder.java
+3
-0
No files found.
app/build.gradle
View file @
b575b920
...
...
@@ -79,7 +79,7 @@ ext {
playLibVersion
=
'10.2.6'
stethoVersion
=
'1.4.2'
rxbindingVersion
=
'2.0.0'
rxlifecycleVersion
=
'2.
0.1
'
rxlifecycleVersion
=
'2.
1.0
'
icepickVersion
=
'3.2.0'
permissionsdispatcherVersion
=
'2.4.0'
}
...
...
app/src/main/java/chat/rocket/android/renderer/AbstractRenderer.java
View file @
b575b920
package
chat
.
rocket
.
android
.
renderer
;
import
android.content.Context
;
import
android.support.annotation.Nullable
;
import
android.view.View
;
import
chat.rocket.android.renderer.optional.Condition
;
...
...
@@ -15,27 +16,28 @@ abstract class AbstractRenderer<T> {
this
.
object
=
object
;
}
// TODO should we get rid of this simpler version of 'shouldHandle'?
protected
boolean
shouldHandle
(
View
view
)
{
return
object
!=
null
&&
view
!=
null
;
}
protected
boolean
shouldHandle
(
View
target
,
Condition
additionalCondition
,
Optional
optional
,
String
key
)
{
if
(
target
==
null
||
object
==
null
)
{
if
(
optional
!=
null
)
{
optional
.
onNoData
(
key
);
}
protected
boolean
shouldHandle
(
View
target
,
@Nullable
Condition
additionalCondition
,
Optional
optional
,
@Nullable
String
key
)
{
if
(
target
==
null
)
{
return
false
;
}
if
(
optional
!=
null
)
{
if
(!
additionalCondition
.
isOK
())
{
optional
.
onNoData
(
key
);
return
false
;
}
else
{
if
(
object
==
null
)
{
optional
.
onNoData
(
key
);
}
else
{
if
(
additionalCondition
==
null
||
additionalCondition
.
isOK
())
{
optional
.
onDataExists
(
key
);
return
true
;
}
else
{
optional
.
onNoData
(
key
);
}
}
return
tru
e
;
return
fals
e
;
}
}
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/message/autocomplete/user/UserViewHolder.java
View file @
b575b920
...
...
@@ -4,6 +4,7 @@ import android.content.Context;
import
android.graphics.Typeface
;
import
android.graphics.drawable.Drawable
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
...
...
@@ -12,6 +13,7 @@ import com.amulyakhare.textdrawable.TextDrawable;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
chat.rocket.android.widget.AbsoluteUrl
;
import
chat.rocket.android.widget.R
;
import
chat.rocket.android.widget.RocketChatAvatar
;
...
...
@@ -81,6 +83,7 @@ public class UserViewHolder extends AutocompleteViewHolder<UserItem> {
//REMARK! this is often SVG image! (see: Rocket.Chat:server/startup/avatar.coffee)
try
{
final
String
avatarUrl
=
"/avatar/"
+
URLEncoder
.
encode
(
username
,
"UTF-8"
)
+
".jpg"
;
// TODO why absoluteUrl is nullable? By allowing that, the app tries to load non-existing images
if
(
absoluteUrl
==
null
)
{
return
avatarUrl
;
}
...
...
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