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
625dbcaf
Commit
625dbcaf
authored
Jul 04, 2017
by
Leonardo Aramaki
Committed by
GitHub
Jul 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #334 from filipedelimabrito/develop
Fix #268
parents
cac8330a
db07be9b
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
70 additions
and
69 deletions
+70
-69
build.gradle
android-ddp/build.gradle
+1
-1
build.gradle
app/build.gradle
+1
-1
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+48
-50
OnBackPressListener.java
.../java/chat/rocket/android/helper/OnBackPressListener.java
+1
-1
MessageRenderer.java
...in/java/chat/rocket/android/renderer/MessageRenderer.java
+4
-3
NewMessageObserver.java
...t/rocket/android/service/observer/NewMessageObserver.java
+1
-2
fragment_room_main.xml
app/src/main/res/layout/fragment_room_main.xml
+10
-8
strings.xml
app/src/main/res/values/strings.xml
+1
-0
build.gradle
log-wrapper/build.gradle
+1
-1
build.gradle
persistence-realm/build.gradle
+1
-1
build.gradle
rocket-chat-android-widgets/build.gradle
+1
-1
No files found.
android-ddp/build.gradle
View file @
625dbcaf
...
...
@@ -6,7 +6,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.
2
'
classpath
'com.android.tools.build:gradle:2.3.
3
'
classpath
'me.tatarka:gradle-retrolambda:3.6.1'
classpath
'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
}
...
...
app/build.gradle
View file @
625dbcaf
...
...
@@ -10,7 +10,7 @@ buildscript {
mavenCentral
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.
2
'
classpath
'com.android.tools.build:gradle:2.3.
3
'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
625dbcaf
...
...
@@ -25,14 +25,10 @@ import android.view.ViewGroup;
import
com.fernandocejas.arrow.optional.Optional
;
import
com.jakewharton.rxbinding2.support.v4.widget.RxDrawerLayout
;
import
io.reactivex.Single
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.CompositeDisposable
;
import
io.reactivex.disposables.Disposable
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.R
;
import
chat.rocket.android.api.MethodCallHelper
;
...
...
@@ -50,6 +46,7 @@ import chat.rocket.android.helper.TextUtils;
import
chat.rocket.android.layouthelper.chatroom.AbstractNewMessageIndicatorManager
;
import
chat.rocket.android.layouthelper.chatroom.MessageFormManager
;
import
chat.rocket.android.layouthelper.chatroom.MessageListAdapter
;
import
chat.rocket.android.layouthelper.chatroom.ModelListAdapter
;
import
chat.rocket.android.layouthelper.chatroom.PairedMessage
;
import
chat.rocket.android.layouthelper.extra_action.AbstractExtraActionItem
;
import
chat.rocket.android.layouthelper.extra_action.MessageExtraActionBehavior
;
...
...
@@ -59,8 +56,11 @@ import chat.rocket.android.layouthelper.extra_action.upload.ImageUploadActionIte
import
chat.rocket.android.layouthelper.extra_action.upload.VideoUploadActionItem
;
import
chat.rocket.android.log.RCLog
;
import
chat.rocket.android.renderer.RocketChatUserStatusProvider
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.temp.DeafultTempSpotlightRoomCaller
;
import
chat.rocket.android.service.temp.DefaultTempSpotlightUserCaller
;
import
chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment
;
import
chat.rocket.android.widget.message.MessageFormLayout
;
import
chat.rocket.android.widget.message.autocomplete.AutocompleteManager
;
import
chat.rocket.android.widget.message.autocomplete.channel.ChannelSource
;
import
chat.rocket.android.widget.message.autocomplete.user.UserSource
;
...
...
@@ -70,6 +70,7 @@ import chat.rocket.core.interactors.MessageInteractor;
import
chat.rocket.core.interactors.SessionInteractor
;
import
chat.rocket.core.models.Message
;
import
chat.rocket.core.models.Room
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.repositories.RealmMessageRepository
;
import
chat.rocket.persistence.realm.repositories.RealmRoomRepository
;
import
chat.rocket.persistence.realm.repositories.RealmServerInfoRepository
;
...
...
@@ -77,11 +78,10 @@ import chat.rocket.persistence.realm.repositories.RealmSessionRepository;
import
chat.rocket.persistence.realm.repositories.RealmSpotlightRoomRepository
;
import
chat.rocket.persistence.realm.repositories.RealmSpotlightUserRepository
;
import
chat.rocket.persistence.realm.repositories.RealmUserRepository
;
import
chat.rocket.android.layouthelper.chatroom.ModelListAdapter
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment
;
import
chat.rocket.android.widget.message.MessageFormLayout
;
import
io.reactivex.Single
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.CompositeDisposable
;
import
io.reactivex.disposables.Disposable
;
import
permissions.dispatcher.NeedsPermission
;
import
permissions.dispatcher.RuntimePermissions
;
...
...
@@ -89,10 +89,12 @@ import permissions.dispatcher.RuntimePermissions;
* Chat room screen.
*/
@RuntimePermissions
public
class
RoomFragment
extends
AbstractChatRoomFragment
implements
OnBackPressListener
,
ExtraActionPickerDialogFragment
.
Callback
,
ModelListAdapter
.
OnItemClickListener
<
PairedMessage
>,
ModelListAdapter
.
OnItemLongClickListener
<
PairedMessage
>,
RoomContract
.
View
{
public
class
RoomFragment
extends
AbstractChatRoomFragment
implements
OnBackPressListener
,
ExtraActionPickerDialogFragment
.
Callback
,
ModelListAdapter
.
OnItemClickListener
<
PairedMessage
>,
ModelListAdapter
.
OnItemLongClickListener
<
PairedMessage
>,
RoomContract
.
View
{
private
static
final
int
DIALOG_ID
=
1
;
private
static
final
String
HOSTNAME
=
"hostname"
;
...
...
@@ -102,11 +104,11 @@ public class RoomFragment extends AbstractChatRoomFragment
private
String
roomId
;
private
LoadMoreScrollListener
scrollListener
;
private
MessageFormManager
messageFormManager
;
private
RecyclerViewAutoScrollManager
a
utoScrollManager
;
private
RecyclerViewAutoScrollManager
recyclerViewA
utoScrollManager
;
protected
AbstractNewMessageIndicatorManager
newMessageIndicatorManager
;
protected
Snackbar
unreadIndicator
;
private
boolean
previousUnreadMessageExists
;
private
MessageListAdapter
a
dapter
;
private
MessageListAdapter
messageListA
dapter
;
private
AutocompleteManager
autocompleteManager
;
private
List
<
AbstractExtraActionItem
>
extraActionItems
;
...
...
@@ -122,8 +124,7 @@ public class RoomFragment extends AbstractChatRoomFragment
private
Message
edittingMessage
=
null
;
public
RoomFragment
()
{
}
public
RoomFragment
()
{}
/**
* create fragment with roomId.
...
...
@@ -187,16 +188,17 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
protected
void
onSetupView
()
{
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
recyclerview
);
adapter
=
new
MessageListAdapter
(
getContext
());
listView
.
setAdapter
(
adapter
);
adapter
.
setOnItemClickListener
(
this
);
adapter
.
setOnItemLongClickListener
(
this
);
LinearLayoutManager
layoutManager
=
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
true
);
listView
.
setLayoutManager
(
layoutManager
);
autoScrollManager
=
new
RecyclerViewAutoScrollManager
(
layoutManager
)
{
RecyclerView
messageRecyclerView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
messageRecyclerView
);
messageListAdapter
=
new
MessageListAdapter
(
getContext
());
messageRecyclerView
.
setAdapter
(
messageListAdapter
);
messageListAdapter
.
setOnItemClickListener
(
this
);
messageListAdapter
.
setOnItemLongClickListener
(
this
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
true
);
messageRecyclerView
.
setLayoutManager
(
linearLayoutManager
);
recyclerViewAutoScrollManager
=
new
RecyclerViewAutoScrollManager
(
linearLayoutManager
)
{
@Override
protected
void
onAutoScrollMissed
()
{
if
(
newMessageIndicatorManager
!=
null
)
{
...
...
@@ -204,17 +206,17 @@ public class RoomFragment extends AbstractChatRoomFragment
}
}
};
adapter
.
registerAdapterDataObserver
(
a
utoScrollManager
);
messageListAdapter
.
registerAdapterDataObserver
(
recyclerViewA
utoScrollManager
);
scrollListener
=
new
LoadMoreScrollListener
(
layoutManager
,
40
)
{
scrollListener
=
new
LoadMoreScrollListener
(
l
inearL
ayoutManager
,
40
)
{
@Override
public
void
requestMoreItem
()
{
presenter
.
loadMoreMessages
();
}
};
list
View
.
addOnScrollListener
(
scrollListener
);
list
View
.
addOnScrollListener
(
new
RecyclerViewScrolledToBottomListener
(
layoutManager
,
1
,
this
::
markAsReadIfNeeded
));
messageRecycler
View
.
addOnScrollListener
(
scrollListener
);
messageRecycler
View
.
addOnScrollListener
(
new
RecyclerViewScrolledToBottomListener
(
l
inearL
ayoutManager
,
1
,
this
::
markAsReadIfNeeded
));
newMessageIndicatorManager
=
new
AbstractNewMessageIndicatorManager
()
{
@Override
...
...
@@ -247,7 +249,7 @@ public class RoomFragment extends AbstractChatRoomFragment
}
private
void
scrollToLatestMessage
()
{
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
recyclerv
iew
);
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
messageRecyclerV
iew
);
if
(
listView
!=
null
)
{
listView
.
scrollToPosition
(
0
);
}
...
...
@@ -264,11 +266,11 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
public
void
onDestroyView
()
{
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
recyclerv
iew
);
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
messageRecyclerV
iew
);
if
(
listView
!=
null
)
{
RecyclerView
.
Adapter
adapter
=
listView
.
getAdapter
();
if
(
adapter
!=
null
)
{
adapter
.
unregisterAdapterDataObserver
(
a
utoScrollManager
);
adapter
.
unregisterAdapterDataObserver
(
recyclerViewA
utoScrollManager
);
}
}
...
...
@@ -340,15 +342,12 @@ public class RoomFragment extends AbstractChatRoomFragment
}
private
void
setupMessageComposer
()
{
final
MessageFormLayout
messageFormLayout
=
(
MessageFormLayout
)
rootView
.
findViewById
(
R
.
id
.
message_composer
);
messageFormManager
=
new
MessageFormManager
(
messageFormLayout
,
this
::
showExtraActionSelectionDialog
);
final
MessageFormLayout
messageFormLayout
=
(
MessageFormLayout
)
rootView
.
findViewById
(
R
.
id
.
messageComposer
);
messageFormManager
=
new
MessageFormManager
(
messageFormLayout
,
this
::
showExtraActionSelectionDialog
);
messageFormManager
.
setSendMessageCallback
(
this
::
sendMessage
);
messageFormLayout
.
setEditTextCommitContentListener
(
this
::
onCommitContent
);
autocompleteManager
=
new
AutocompleteManager
((
ViewGroup
)
rootView
.
findViewById
(
R
.
id
.
message_list_root
));
autocompleteManager
=
new
AutocompleteManager
((
ViewGroup
)
rootView
.
findViewById
(
R
.
id
.
messageListRelativeLayout
));
autocompleteManager
.
registerSource
(
new
ChannelSource
(
...
...
@@ -452,8 +451,7 @@ public class RoomFragment extends AbstractChatRoomFragment
public
void
onItemSelected
(
int
itemId
)
{
for
(
AbstractExtraActionItem
extraActionItem
:
extraActionItems
)
{
if
(
extraActionItem
.
getItemId
()
==
itemId
)
{
RoomFragmentPermissionsDispatcher
.
onExtraActionSelectedWithCheck
(
RoomFragment
.
this
,
extraActionItem
);
RoomFragmentPermissionsDispatcher
.
onExtraActionSelectedWithCheck
(
RoomFragment
.
this
,
extraActionItem
);
return
;
}
}
...
...
@@ -529,7 +527,7 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
public
void
setupWith
(
RocketChatAbsoluteUrl
rocketChatAbsoluteUrl
)
{
a
dapter
.
setAbsoluteUrl
(
rocketChatAbsoluteUrl
);
messageListA
dapter
.
setAbsoluteUrl
(
rocketChatAbsoluteUrl
);
}
@Override
...
...
@@ -555,7 +553,7 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
public
void
updateHistoryState
(
boolean
hasNext
,
boolean
isLoaded
)
{
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
recyclerv
iew
);
RecyclerView
listView
=
(
RecyclerView
)
rootView
.
findViewById
(
R
.
id
.
messageRecyclerV
iew
);
if
(
listView
==
null
||
!(
listView
.
getAdapter
()
instanceof
MessageListAdapter
))
{
return
;
}
...
...
@@ -581,10 +579,10 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
public
void
showMessages
(
List
<
Message
>
messages
)
{
if
(
a
dapter
==
null
)
{
if
(
messageListA
dapter
==
null
)
{
return
;
}
a
dapter
.
updateData
(
messages
);
messageListA
dapter
.
updateData
(
messages
);
}
@Override
...
...
@@ -600,12 +598,12 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
public
void
autoloadImages
()
{
a
dapter
.
setAutoloadImages
(
true
);
messageListA
dapter
.
setAutoloadImages
(
true
);
}
@Override
public
void
manualLoadImages
()
{
a
dapter
.
setAutoloadImages
(
false
);
messageListA
dapter
.
setAutoloadImages
(
false
);
}
private
void
onEditMessage
(
Message
message
)
{
...
...
app/src/main/java/chat/rocket/android/helper/OnBackPressListener.java
View file @
625dbcaf
...
...
@@ -10,4 +10,4 @@ public interface OnBackPressListener {
* @return whether back is handled or not.
*/
boolean
onBackPressed
();
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.java
View file @
625dbcaf
...
...
@@ -40,8 +40,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
*/
public
MessageRenderer
avatarInto
(
RocketChatAvatar
rocketChatAvatar
,
AbsoluteUrl
absoluteUrl
)
{
if
(
object
.
getSyncState
()
==
SyncState
.
FAILED
)
{
rocketChatAvatar
.
loadImage
(
VectorDrawableCompat
.
create
(
context
.
getResources
(),
R
.
drawable
.
ic_error_outline_black_24dp
,
null
));
rocketChatAvatar
.
loadImage
(
VectorDrawableCompat
.
create
(
context
.
getResources
(),
R
.
drawable
.
ic_error_outline_black_24dp
,
null
));
}
else
if
(
TextUtils
.
isEmpty
(
object
.
getAvatar
()))
{
userRenderer
.
avatarInto
(
rocketChatAvatar
,
absoluteUrl
);
}
else
{
...
...
@@ -76,10 +75,12 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
switch
(
object
.
getSyncState
())
{
case
SyncState
.
NOT_SYNCED
:
case
SyncState
.
SYNCING
:
textView
.
setText
(
R
.
string
.
sending
);
break
;
case
SyncState
.
FAILED
:
textView
.
setText
(
R
.
string
.
failed_to_sync
);
break
;
default
:
textView
.
setText
(
DateTime
.
fromEpocMs
(
object
.
getTimestamp
(),
DateTime
.
Format
.
TIME
));
break
;
...
...
app/src/main/java/chat/rocket/android/service/observer/NewMessageObserver.java
View file @
625dbcaf
...
...
@@ -21,8 +21,7 @@ public class NewMessageObserver extends AbstractModelObserver<RealmMessage> {
private
final
MethodCallHelper
methodCall
;
public
NewMessageObserver
(
Context
context
,
String
hostname
,
RealmHelper
realmHelper
,
DDPClientRef
ddpClientRef
)
{
public
NewMessageObserver
(
Context
context
,
String
hostname
,
RealmHelper
realmHelper
,
DDPClientRef
ddpClientRef
)
{
super
(
context
,
hostname
,
realmHelper
,
ddpClientRef
);
methodCall
=
new
MethodCallHelper
(
realmHelper
,
ddpClientRef
);
...
...
app/src/main/res/layout/fragment_room_main.xml
View file @
625dbcaf
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/message_list_root"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/messageListRelativeLayout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
"chat.rocket.android.fragment.chatroom.RoomFragment"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/
recyclerv
iew"
android:id=
"@+id/
messageRecyclerV
iew"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_above=
"@+id/message
_c
omposer"
/>
android:layout_above=
"@+id/message
C
omposer"
/>
<chat.rocket.android.widget.message.MessageFormLayout
android:id=
"@+id/message
_c
omposer"
android:id=
"@+id/message
C
omposer"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:
theme=
"@style/Theme.AppCompat.Light
"
android:
layout_alignParentBottom=
"true
"
/>
android:
layout_alignParentBottom=
"true
"
android:
theme=
"@style/Theme.AppCompat.Light
"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
625dbcaf
...
...
@@ -16,6 +16,7 @@
<string
name=
"users_of_room_title"
>
Members List
</string>
<string
name=
"fmt_room_user_count"
>
Total: %,d users
</string>
<string
name=
"sending"
>
Sending…
</string>
<string
name=
"failed_to_sync"
>
Failed to send!
</string>
<string
name=
"resend"
>
Resend
</string>
<string
name=
"discard"
>
Discard
</string>
...
...
log-wrapper/build.gradle
View file @
625dbcaf
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.
2
'
classpath
'com.android.tools.build:gradle:2.3.
3
'
}
}
...
...
persistence-realm/build.gradle
View file @
625dbcaf
...
...
@@ -8,7 +8,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.
2
'
classpath
'com.android.tools.build:gradle:2.3.
3
'
classpath
'io.realm:realm-gradle-plugin:2.3.2'
classpath
'me.tatarka:gradle-retrolambda:3.5.0'
classpath
'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
...
...
rocket-chat-android-widgets/build.gradle
View file @
625dbcaf
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.
2
'
classpath
'com.android.tools.build:gradle:2.3.
3
'
}
}
...
...
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