Commit 25a52161 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Implement upload any type of file action

parent d773477b
......@@ -22,6 +22,7 @@ import android.support.v7.widget.RecyclerView;
import android.view.View;
import chat.rocket.android.fragment.sidebar.SidebarMainFragment;
import chat.rocket.android.layouthelper.extra_action.upload.FileUploadActionItem;
import chat.rocket.android.widget.RoomToolbar;
import chat.rocket.core.models.User;
import java.lang.reflect.Field;
......@@ -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() {
......
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;
}
}
<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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment