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
0328f573
Commit
0328f573
authored
Sep 13, 2017
by
Rafael Kellermann Streit
Committed by
GitHub
Sep 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #455 from RocketChat/feature/upload-any-file
[NEW] Action to upload any type of file
parents
bc6088d9
4fdf19ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
9 deletions
+52
-9
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+12
-9
FileUploadActionItem.java
...ayouthelper/extra_action/upload/FileUploadActionItem.java
+31
-0
ic_insert_drive_file_white_24dp.xml
...src/main/res/drawable/ic_insert_drive_file_white_24dp.xml
+9
-0
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
0328f573
...
...
@@ -21,9 +21,9 @@ import android.support.v7.widget.LinearLayoutManager;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
c
hat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
c
hat.rocket.android.widget.RoomToolbar
;
import
chat.rocket.core.models.User
;
import
c
om.hadisatrio.optional.Optional
;
import
c
om.jakewharton.rxbinding2.support.v4.widget.RxDrawerLayout
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -34,6 +34,7 @@ import chat.rocket.android.api.MethodCallHelper;
import
chat.rocket.android.fragment.chatroom.dialog.FileUploadProgressDialogFragment
;
import
chat.rocket.android.fragment.chatroom.dialog.MessageOptionsDialogFragment
;
import
chat.rocket.android.fragment.chatroom.dialog.UsersOfRoomDialogFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.helper.AbsoluteUrlHelper
;
import
chat.rocket.android.helper.FileUploadHelper
;
import
chat.rocket.android.helper.LoadMoreScrollListener
;
...
...
@@ -51,6 +52,7 @@ import chat.rocket.android.layouthelper.extra_action.AbstractExtraActionItem;
import
chat.rocket.android.layouthelper.extra_action.MessageExtraActionBehavior
;
import
chat.rocket.android.layouthelper.extra_action.upload.AbstractUploadActionItem
;
import
chat.rocket.android.layouthelper.extra_action.upload.AudioUploadActionItem
;
import
chat.rocket.android.layouthelper.extra_action.upload.FileUploadActionItem
;
import
chat.rocket.android.layouthelper.extra_action.upload.ImageUploadActionItem
;
import
chat.rocket.android.layouthelper.extra_action.upload.VideoUploadActionItem
;
import
chat.rocket.android.log.RCLog
;
...
...
@@ -58,6 +60,7 @@ 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.RoomToolbar
;
import
chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment
;
import
chat.rocket.android.widget.message.MessageFormLayout
;
import
chat.rocket.android.widget.message.autocomplete.AutocompleteManager
;
...
...
@@ -69,6 +72,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.core.models.User
;
import
chat.rocket.persistence.realm.RealmStore
;
import
chat.rocket.persistence.realm.repositories.RealmMessageRepository
;
import
chat.rocket.persistence.realm.repositories.RealmRoomRepository
;
...
...
@@ -77,9 +81,6 @@ 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
com.hadisatrio.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
;
...
...
@@ -248,10 +249,11 @@ public class RoomFragment extends AbstractChatRoomFragment implements
}
private
void
setupMessageActions
()
{
extraActionItems
=
new
ArrayList
<>(
3
);
// fixed number as of now
extraActionItems
=
new
ArrayList
<>(
4
);
// fixed number as of now
extraActionItems
.
add
(
new
ImageUploadActionItem
());
extraActionItems
.
add
(
new
AudioUploadActionItem
());
extraActionItems
.
add
(
new
VideoUploadActionItem
());
extraActionItems
.
add
(
new
FileUploadActionItem
());
}
private
void
scrollToLatestMessage
()
{
...
...
@@ -424,8 +426,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
);
}
},
throwable
->
{
}
Logger:
:
report
);
compositeDisposable
.
add
(
disposable
);
...
...
@@ -536,6 +537,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
try
{
inputContentInfo
.
requestPermission
();
}
catch
(
Exception
e
)
{
Logger
.
report
(
e
);
return
false
;
}
}
...
...
@@ -550,6 +552,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
try
{
inputContentInfo
.
releasePermission
();
}
catch
(
Exception
e
)
{
Logger
.
report
(
e
);
}
return
true
;
...
...
app/src/main/java/chat/rocket/android/layouthelper/extra_action/upload/FileUploadActionItem.java
0 → 100644
View file @
0328f573
package
chat
.
rocket
.
android
.
layouthelper
.
extra_action
.
upload
;
import
android.content.Intent
;
import
chat.rocket.android.R
;
public
class
FileUploadActionItem
extends
AbstractUploadActionItem
{
@Override
public
int
getItemId
()
{
return
13
;
}
@Override
protected
Intent
getIntentForPickFile
()
{
Intent
intent
=
new
Intent
();
intent
.
setType
(
"*/*"
);
intent
.
setAction
(
Intent
.
ACTION_GET_CONTENT
);
return
Intent
.
createChooser
(
intent
,
"Select File to Upload"
);
}
@Override
public
int
getIcon
()
{
return
R
.
drawable
.
ic_insert_drive_file_white_24dp
;
}
@Override
public
int
getTitle
()
{
return
R
.
string
.
doc_upload_message_spec_title
;
}
}
app/src/main/res/drawable/ic_insert_drive_file_white_24dp.xml
0 → 100644
View file @
0328f573
<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=
"#FFFFFFFF"
android:pathData=
"M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z"
/>
</vector>
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