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
a21a9ec0
Commit
a21a9ec0
authored
Dec 20, 2016
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial clean up
parent
7418dce9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
105 deletions
+31
-105
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+11
-18
MessageComposerManager.java
...android/layouthelper/chatroom/MessageComposerManager.java
+1
-47
ic_attach_file_black_24dp.xml
app/src/main/res/drawable/ic_attach_file_black_24dp.xml
+9
-0
fragment_room_main.xml
app/src/main/res/layout/fragment_room_main.xml
+4
-28
message_composer.xml
...-android-widgets/src/main/res/layout/message_composer.xml
+6
-12
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
a21a9ec0
...
@@ -214,11 +214,9 @@ public class RoomFragment extends AbstractChatRoomFragment
...
@@ -214,11 +214,9 @@ public class RoomFragment extends AbstractChatRoomFragment
}
}
private
void
setupMessageComposer
()
{
private
void
setupMessageComposer
()
{
final
FloatingActionButton
fabCompose
=
(
FloatingActionButton
)
rootView
.
findViewById
(
R
.
id
.
fab_compose
);
final
MessageComposer
messageComposer
=
final
MessageComposer
messageComposer
=
(
MessageComposer
)
rootView
.
findViewById
(
R
.
id
.
message_composer
);
(
MessageComposer
)
rootView
.
findViewById
(
R
.
id
.
message_composer
);
messageComposerManager
=
new
MessageComposerManager
(
fabCompose
,
messageComposer
);
messageComposerManager
=
new
MessageComposerManager
(
messageComposer
);
messageComposerManager
.
setSendMessageCallback
(
messageText
->
messageComposerManager
.
setSendMessageCallback
(
messageText
->
realmHelper
.
executeTransaction
(
realm
->
realmHelper
.
executeTransaction
(
realm
->
realm
.
createOrUpdateObjectFromJson
(
Message
.
class
,
new
JSONObject
()
realm
.
createOrUpdateObjectFromJson
(
Message
.
class
,
new
JSONObject
()
...
@@ -227,23 +225,18 @@ public class RoomFragment extends AbstractChatRoomFragment
...
@@ -227,23 +225,18 @@ public class RoomFragment extends AbstractChatRoomFragment
.
put
(
"ts"
,
System
.
currentTimeMillis
())
.
put
(
"ts"
,
System
.
currentTimeMillis
())
.
put
(
"rid"
,
roomId
)
.
put
(
"rid"
,
roomId
)
.
put
(
"msg"
,
messageText
))));
.
put
(
"msg"
,
messageText
))));
messageComposerManager
.
setVisibilityChangedListener
(
shown
->
{
FloatingActionButton
fab
=
(
FloatingActionButton
)
rootView
.
findViewById
(
R
.
id
.
fab_upload_file
);
if
(
shown
)
{
fab
.
hide
();
}
else
{
fab
.
show
();
}
});
}
}
private
void
setupFileUploader
()
{
private
void
setupFileUploader
()
{
rootView
.
findViewById
(
R
.
id
.
fab_upload_file
).
setOnClickListener
(
view
->
{
// change this to a more actions chooser
Intent
intent
=
new
Intent
();
// uses bottom sheet to list options
intent
.
setType
(
"image/*"
);
// starts with only file upload (we already have it)
intent
.
setAction
(
Intent
.
ACTION_GET_CONTENT
);
// rootView.findViewById(R.id.fab_upload_file).setOnClickListener(view -> {
startActivityForResult
(
Intent
.
createChooser
(
intent
,
"Select Picture to Upload"
),
RC_UPL
);
// Intent intent = new Intent();
});
// intent.setType("image/*");
// intent.setAction(Intent.ACTION_GET_CONTENT);
// startActivityForResult(Intent.createChooser(intent, "Select Picture to Upload"), RC_UPL);
// });
}
}
@Override
@Override
...
@@ -366,6 +359,6 @@ public class RoomFragment extends AbstractChatRoomFragment
...
@@ -366,6 +359,6 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
@Override
public
boolean
onBackPressed
()
{
public
boolean
onBackPressed
()
{
return
closeSideMenuIfNeeded
()
||
messageComposerManager
.
hideMessageComposerIfNeeded
()
;
return
closeSideMenuIfNeeded
();
}
}
}
}
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageComposerManager.java
View file @
a21a9ec0
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
;
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
;
import
android.support.design.widget.FloatingActionButton
;
import
bolts.Task
;
import
bolts.Task
;
import
chat.rocket.android.widget.message.MessageComposer
;
import
chat.rocket.android.widget.message.MessageComposer
;
...
@@ -9,22 +7,15 @@ import chat.rocket.android.widget.message.MessageComposer;
...
@@ -9,22 +7,15 @@ import chat.rocket.android.widget.message.MessageComposer;
* handling visibility of FAB-compose and MessageComposer.
* handling visibility of FAB-compose and MessageComposer.
*/
*/
public
class
MessageComposerManager
{
public
class
MessageComposerManager
{
private
final
FloatingActionButton
fabCompose
;
private
final
MessageComposer
messageComposer
;
private
final
MessageComposer
messageComposer
;
private
SendMessageCallback
sendMessageCallback
;
private
SendMessageCallback
sendMessageCallback
;
private
VisibilityChangedListener
visibilityChangedListener
;
public
MessageComposerManager
(
FloatingActionButton
fabCompose
,
MessageComposer
messageComposer
)
{
public
MessageComposerManager
(
MessageComposer
messageComposer
)
{
this
.
fabCompose
=
fabCompose
;
this
.
messageComposer
=
messageComposer
;
this
.
messageComposer
=
messageComposer
;
init
();
init
();
}
}
private
void
init
()
{
private
void
init
()
{
fabCompose
.
setOnClickListener
(
view
->
{
setMessageComposerVisibility
(
true
);
});
messageComposer
.
setOnActionListener
(
new
MessageComposer
.
ActionListener
()
{
messageComposer
.
setOnActionListener
(
new
MessageComposer
.
ActionListener
()
{
@Override
@Override
public
void
onSubmit
(
String
message
)
{
public
void
onSubmit
(
String
message
)
{
...
@@ -42,56 +33,19 @@ public class MessageComposerManager {
...
@@ -42,56 +33,19 @@ public class MessageComposerManager {
@Override
@Override
public
void
onCancel
()
{
public
void
onCancel
()
{
setMessageComposerVisibility
(
false
);
}
}
});
});
setMessageComposerVisibility
(
false
);
}
}
public
void
setSendMessageCallback
(
SendMessageCallback
sendMessageCallback
)
{
public
void
setSendMessageCallback
(
SendMessageCallback
sendMessageCallback
)
{
this
.
sendMessageCallback
=
sendMessageCallback
;
this
.
sendMessageCallback
=
sendMessageCallback
;
}
}
public
void
setVisibilityChangedListener
(
VisibilityChangedListener
listener
)
{
this
.
visibilityChangedListener
=
listener
;
}
public
void
clearComposingText
()
{
public
void
clearComposingText
()
{
messageComposer
.
setText
(
""
);
messageComposer
.
setText
(
""
);
}
}
private
void
setMessageComposerVisibility
(
boolean
show
)
{
if
(
show
)
{
fabCompose
.
hide
();
messageComposer
.
show
(()
->
{
if
(
visibilityChangedListener
!=
null
)
{
visibilityChangedListener
.
onVisibilityChanged
(
true
);
}
});
}
else
{
messageComposer
.
hide
(()
->
{
fabCompose
.
show
();
if
(
visibilityChangedListener
!=
null
)
{
visibilityChangedListener
.
onVisibilityChanged
(
false
);
}
});
}
}
public
boolean
hideMessageComposerIfNeeded
()
{
if
(
messageComposer
.
isShown
())
{
setMessageComposerVisibility
(
false
);
return
true
;
}
return
false
;
}
public
interface
SendMessageCallback
{
public
interface
SendMessageCallback
{
Task
<
Void
>
onSubmit
(
String
messageText
);
Task
<
Void
>
onSubmit
(
String
messageText
);
}
}
public
interface
VisibilityChangedListener
{
void
onVisibilityChanged
(
boolean
shown
);
}
}
}
app/src/main/res/drawable/ic_attach_file_black_24dp.xml
0 → 100644
View file @
a21a9ec0
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M16.5,6v11.5c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4V5c0,-1.38 1.12,-2.5 2.5,-2.5s2.5,1.12 2.5,2.5v10.5c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1V6H10v9.5c0,1.38 1.12,2.5 2.5,2.5s2.5,-1.12 2.5,-2.5V5c0,-2.21 -1.79,-4 -4,-4S7,2.79 7,5v12.5c0,3.04 2.46,5.5 5.5,5.5s5.5,-2.46 5.5,-5.5V6h-1.5z"
/>
</vector>
app/src/main/res/layout/fragment_room_main.xml
View file @
a21a9ec0
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
>
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recyclerview"
android:id=
"@+id/recyclerview"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
/>
/>
<chat.rocket.android.widget.message.MessageComposer
<chat.rocket.android.widget.message.MessageComposer
android:id=
"@+id/message_composer"
android:id=
"@+id/message_composer"
...
@@ -18,25 +14,5 @@
...
@@ -18,25 +14,5 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:theme=
"@style/Theme.AppCompat.Light"
android:theme=
"@style/Theme.AppCompat.Light"
android:layout_gravity=
"bottom"
android:layout_gravity=
"bottom"
android:background=
"@android:color/white"
android:background=
"@android:color/white"
/>
/>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab_upload_file"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"start|bottom"
android:layout_margin=
"@dimen/margin_16"
app:fabSize=
"mini"
app:srcCompat=
"@drawable/ic_insert_photo_white_24dp"
/>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab_compose"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end|bottom"
android:layout_margin=
"@dimen/margin_16"
app:srcCompat=
"@drawable/ic_compose_white_24dp"
/>
</FrameLayout>
</FrameLayout>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/layout/message_composer.xml
View file @
a21a9ec0
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:orientation=
"vertical"
>
>
<chat.rocket.android.widget.DividerView
<chat.rocket.android.widget.DividerView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
/>
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:orientation=
"horizontal"
>
>
<EditText
<EditText
android:id=
"@+id/editor"
android:id=
"@+id/editor"
android:layout_width=
"0px"
android:layout_width=
"0px"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:maxLines=
"3"
android:maxLines=
"3"
/>
/>
<ImageButton
<ImageButton
android:id=
"@+id/btn_submit"
android:id=
"@+id/btn_submit"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
app:srcCompat=
"@drawable/ic_send_black_24dp"
app:srcCompat=
"@drawable/ic_send_black_24dp"
/>
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
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