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
b3382b08
Commit
b3382b08
authored
Jan 19, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PR based improvements
parent
0a926198
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
51 deletions
+55
-51
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+20
-11
UsersOfRoomDialogFragment.java
...d/fragment/chatroom/dialog/UsersOfRoomDialogFragment.java
+1
-1
MessageFormManager.java
...ket/android/layouthelper/chatroom/MessageFormManager.java
+4
-4
MessageRenderer.java
...in/java/chat/rocket/android/renderer/MessageRenderer.java
+6
-6
UserRenderer.java
.../main/java/chat/rocket/android/renderer/UserRenderer.java
+3
-3
ExtraActionPickerDialogFragment.java
...roid/widget/internal/ExtraActionPickerDialogFragment.java
+5
-9
MessageFormLayout.java
...chat/rocket/android/widget/message/MessageFormLayout.java
+16
-17
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
b3382b08
...
...
@@ -7,6 +7,7 @@ import android.os.Bundle;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.app.DialogFragment
;
import
android.support.v4.view.GravityCompat
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v4.widget.SlidingPaneLayout
;
...
...
@@ -66,7 +67,10 @@ import permissions.dispatcher.RuntimePermissions;
*/
@RuntimePermissions
public
class
RoomFragment
extends
AbstractChatRoomFragment
implements
OnBackPressListener
,
RealmModelListAdapter
.
OnItemClickListener
<
PairedMessage
>
{
implements
OnBackPressListener
,
ExtraActionPickerDialogFragment
.
Callback
,
RealmModelListAdapter
.
OnItemClickListener
<
PairedMessage
>
{
private
static
final
int
DIALOG_ID
=
1
;
private
String
serverConfigId
;
private
RealmHelper
realmHelper
;
...
...
@@ -199,6 +203,14 @@ public class RoomFragment extends AbstractChatRoomFragment
setupSideMenu
();
setupMessageComposer
();
setupMessageActions
();
}
private
void
setupMessageActions
()
{
extraActionItems
=
new
ArrayList
<>(
3
);
// fixed number as of now
extraActionItems
.
add
(
new
ImageUploadActionItem
());
extraActionItems
.
add
(
new
AudioUploadActionItem
());
extraActionItems
.
add
(
new
VideoUploadActionItem
());
}
private
void
scrollToLatestMessage
()
{
...
...
@@ -301,11 +313,6 @@ public class RoomFragment extends AbstractChatRoomFragment
}
private
void
setupMessageComposer
()
{
extraActionItems
=
new
ArrayList
<>(
3
);
// fixed number as of now
extraActionItems
.
add
(
new
ImageUploadActionItem
());
extraActionItems
.
add
(
new
AudioUploadActionItem
());
extraActionItems
.
add
(
new
VideoUploadActionItem
());
final
MessageFormLayout
messageFormLayout
=
(
MessageFormLayout
)
rootView
.
findViewById
(
R
.
id
.
message_composer
);
messageFormManager
=
...
...
@@ -343,7 +350,7 @@ public class RoomFragment extends AbstractChatRoomFragment
FileUploadProgressDialogFragment
.
create
(
serverConfigId
,
roomId
,
uplId
)
.
show
(
getFragmentManager
(),
FileUploadProgressDialogFragment
.
class
.
getSimpleName
());
}
else
{
//
show
error.
//
onClick
error.
}
}
...
...
@@ -450,12 +457,14 @@ public class RoomFragment extends AbstractChatRoomFragment
}
private
void
showExtraActionSelectionDialog
()
{
ExtraActionPickerDialogFragment
.
create
(
new
ArrayList
<>(
extraActionItems
),
this
::
onExtraItemSelected
)
.
show
(
getFragmentManager
(),
"ExtraActionPickerDialogFragment"
);
final
DialogFragment
fragment
=
ExtraActionPickerDialogFragment
.
create
(
new
ArrayList
<>(
extraActionItems
));
fragment
.
setTargetFragment
(
this
,
DIALOG_ID
);
fragment
.
show
(
getFragmentManager
(),
"ExtraActionPickerDialogFragment"
);
}
private
void
onExtraItemSelected
(
int
itemId
)
{
@Override
public
void
onItemSelected
(
int
itemId
)
{
for
(
AbstractExtraActionItem
extraActionItem
:
extraActionItems
)
{
if
(
extraActionItem
.
getItemId
()
==
itemId
)
{
RoomFragmentPermissionsDispatcher
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/dialog/UsersOfRoomDialogFragment.java
View file @
b3382b08
...
...
@@ -23,7 +23,7 @@ import chat.rocket.android.realm_helper.RealmObjectObserver;
import
chat.rocket.android.service.RocketChatService
;
/**
* Dialog to
show
members in a room.
* Dialog to
onClick
members in a room.
*/
public
class
UsersOfRoomDialogFragment
extends
AbstractChatRoomDialogFragment
{
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageFormManager.java
View file @
b3382b08
...
...
@@ -11,14 +11,14 @@ public class MessageFormManager {
private
SendMessageCallback
sendMessageCallback
;
public
MessageFormManager
(
MessageFormLayout
messageFormLayout
,
MessageFormLayout
.
ShowExtraActionSelectionCallback
callback
)
{
MessageFormLayout
.
ExtraActionSelectionClickListener
callback
)
{
this
.
messageFormLayout
=
messageFormLayout
;
init
(
callback
);
}
private
void
init
(
MessageFormLayout
.
ShowExtraActionSelectionCallback
callback
)
{
messageFormLayout
.
set
ShowExtraActionSelectionCallback
(
callback
);
messageFormLayout
.
setTextListener
(
this
::
sendMessage
);
private
void
init
(
MessageFormLayout
.
ExtraActionSelectionClickListener
listener
)
{
messageFormLayout
.
set
ExtraActionSelectionClickListener
(
listener
);
messageFormLayout
.
set
Submit
TextListener
(
this
::
sendMessage
);
}
public
void
setSendMessageCallback
(
SendMessageCallback
sendMessageCallback
)
{
...
...
app/src/main/java/chat/rocket/android/renderer/MessageRenderer.java
View file @
b3382b08
...
...
@@ -27,7 +27,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
/**
*
show
Avatar image.
*
onClick
Avatar image.
*/
public
MessageRenderer
avatarInto
(
ImageView
imageView
,
String
hostname
)
{
switch
(
object
.
getSyncState
())
{
...
...
@@ -42,7 +42,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
/**
*
show
Username in textView.
*
onClick
Username in textView.
*/
public
MessageRenderer
usernameInto
(
TextView
textView
)
{
userRenderer
.
usernameInto
(
textView
);
...
...
@@ -50,7 +50,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
/**
*
show
timestamp in textView.
*
onClick
timestamp in textView.
*/
public
MessageRenderer
timestampInto
(
TextView
textView
)
{
if
(!
shouldHandle
(
textView
))
{
...
...
@@ -71,7 +71,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
/**
*
show
body in RocketChatMessageLayout.
*
onClick
body in RocketChatMessageLayout.
*/
public
MessageRenderer
bodyInto
(
RocketChatMessageLayout
rocketChatMessageLayout
)
{
if
(!
shouldHandle
(
rocketChatMessageLayout
))
{
...
...
@@ -84,7 +84,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
/**
*
show
urls in RocketChatMessageUrlsLayout.
*
onClick
urls in RocketChatMessageUrlsLayout.
*/
public
MessageRenderer
urlsInto
(
RocketChatMessageUrlsLayout
urlsLayout
)
{
if
(!
shouldHandle
(
urlsLayout
))
{
...
...
@@ -103,7 +103,7 @@ public class MessageRenderer extends AbstractRenderer<Message> {
}
/**
*
show
urls in RocketChatMessageUrlsLayout.
*
onClick
urls in RocketChatMessageUrlsLayout.
*/
public
MessageRenderer
attachmentsInto
(
RocketChatMessageAttachmentsLayout
attachmentsLayout
,
String
hostname
,
String
userId
,
String
token
)
{
...
...
app/src/main/java/chat/rocket/android/renderer/UserRenderer.java
View file @
b3382b08
...
...
@@ -19,7 +19,7 @@ public class UserRenderer extends AbstractRenderer<User> {
}
/**
*
show
Avatar image.
*
onClick
Avatar image.
*/
public
UserRenderer
avatarInto
(
ImageView
imageView
,
String
hostname
)
{
if
(!
shouldHandle
(
imageView
))
{
...
...
@@ -33,7 +33,7 @@ public class UserRenderer extends AbstractRenderer<User> {
}
/**
*
show
Username in textView.
*
onClick
Username in textView.
*/
public
UserRenderer
usernameInto
(
TextView
textView
)
{
if
(!
shouldHandle
(
textView
))
{
...
...
@@ -45,7 +45,7 @@ public class UserRenderer extends AbstractRenderer<User> {
}
/**
*
show
user's status color into imageView.
*
onClick
user's status color into imageView.
*/
public
UserRenderer
statusColorInto
(
ImageView
imageView
)
{
if
(!
shouldHandle
(
imageView
))
{
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/internal/ExtraActionPickerDialogFragment.java
View file @
b3382b08
...
...
@@ -2,6 +2,7 @@ package chat.rocket.android.widget.internal;
import
android.app.Dialog
;
import
android.support.design.widget.BottomSheetDialogFragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.RecyclerView
;
import
java.util.List
;
...
...
@@ -12,13 +13,11 @@ import chat.rocket.android.widget.message.MessageExtraActionItemPresenter;
public
class
ExtraActionPickerDialogFragment
extends
BottomSheetDialogFragment
{
private
List
<
MessageExtraActionItemPresenter
>
actionItems
;
private
Callback
callback
;
public
static
ExtraActionPickerDialogFragment
create
(
List
<
MessageExtraActionItemPresenter
>
actionItems
,
Callback
callback
)
{
List
<
MessageExtraActionItemPresenter
>
actionItems
)
{
ExtraActionPickerDialogFragment
fragment
=
new
ExtraActionPickerDialogFragment
();
fragment
.
setActionItems
(
actionItems
);
fragment
.
setCallback
(
callback
);
return
fragment
;
}
...
...
@@ -27,10 +26,6 @@ public class ExtraActionPickerDialogFragment extends BottomSheetDialogFragment {
this
.
actionItems
=
actionItems
;
}
public
void
setCallback
(
Callback
callback
)
{
this
.
callback
=
callback
;
}
@Override
public
final
void
setupDialog
(
Dialog
dialog
,
int
style
)
{
super
.
setupDialog
(
dialog
,
style
);
...
...
@@ -51,8 +46,9 @@ public class ExtraActionPickerDialogFragment extends BottomSheetDialogFragment {
}
private
void
callbackOnItemSelected
(
int
itemId
)
{
if
(
callback
!=
null
)
{
callback
.
onItemSelected
(
itemId
);
final
Fragment
fragment
=
getTargetFragment
();
if
(
fragment
instanceof
Callback
)
{
((
Callback
)
fragment
).
onItemSelected
(
itemId
);
}
}
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/message/MessageFormLayout.java
View file @
b3382b08
...
...
@@ -14,7 +14,6 @@ import android.widget.EditText;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
java.util.ArrayList
;
import
chat.rocket.android.widget.R
;
public
class
MessageFormLayout
extends
LinearLayout
{
...
...
@@ -24,8 +23,8 @@ public class MessageFormLayout extends LinearLayout {
private
View
btnExtra
;
private
View
btnSubmit
;
private
ShowExtraActionSelectionCallback
showExtraActionSelectionCallback
;
private
TextListener
t
extListener
;
private
ExtraActionSelectionClickListener
extraActionSelectionClickListener
;
private
SubmitTextListener
submitT
extListener
;
public
MessageFormLayout
(
Context
context
)
{
super
(
context
);
...
...
@@ -57,7 +56,7 @@ public class MessageFormLayout extends LinearLayout {
btnExtra
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
showExtraActionSelectionDialog
();
onExtraActionSelectionClick
();
}
});
...
...
@@ -67,8 +66,8 @@ public class MessageFormLayout extends LinearLayout {
@Override
public
void
onClick
(
View
view
)
{
String
messageText
=
getText
();
if
(
messageText
.
length
()
>
0
&&
t
extListener
!=
null
)
{
t
extListener
.
onSubmitText
(
messageText
);
if
(
messageText
.
length
()
>
0
&&
submitT
extListener
!=
null
)
{
submitT
extListener
.
onSubmitText
(
messageText
);
}
}
});
...
...
@@ -101,18 +100,18 @@ public class MessageFormLayout extends LinearLayout {
addView
(
composer
);
}
public
void
set
ShowExtraActionSelectionCallback
(
ShowExtraActionSelectionCallback
showExtraActionSelectionCallback
)
{
this
.
showExtraActionSelectionCallback
=
showExtraActionSelectionCallback
;
public
void
set
ExtraActionSelectionClickListener
(
ExtraActionSelectionClickListener
extraActionSelectionClickListener
)
{
this
.
extraActionSelectionClickListener
=
extraActionSelectionClickListener
;
}
public
void
set
TextListener
(
TextListener
t
extListener
)
{
this
.
textListener
=
t
extListener
;
public
void
set
SubmitTextListener
(
SubmitTextListener
submitT
extListener
)
{
this
.
submitTextListener
=
submitT
extListener
;
}
private
void
showExtraActionSelectionDialog
()
{
if
(
showExtraActionSelectionCallback
!=
null
)
{
showExtraActionSelectionCallback
.
show
();
private
void
onExtraActionSelectionClick
()
{
if
(
extraActionSelectionClickListener
!=
null
)
{
extraActionSelectionClickListener
.
onClick
();
}
}
...
...
@@ -151,11 +150,11 @@ public class MessageFormLayout extends LinearLayout {
});
}
public
interface
ShowExtraActionSelectionCallback
{
void
show
();
public
interface
ExtraActionSelectionClickListener
{
void
onClick
();
}
public
interface
TextListener
{
public
interface
Submit
TextListener
{
void
onSubmitText
(
String
message
);
}
}
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