-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display files on Fragments not on BoxPreviewActivity #10
Comments
You can use the BoxPreviewViewPager and call the loadItem/s method on it. |
@doncung thank you so much. I will give it a try. |
Hi @doncung, I tried the BoxPreviewViewPager as advised. Added it to my layout and made sure that the activity implements BoxPreviewExecutorProvider and implemented the api required for it as done in the BoxPreviewActivity
And then after my service call returns the boxFile I want to preview, I called loadItem and implemented PreviewController that is serializable
// Preview Controller
However, it still throws the exception I used to get when I tried to load it using BoxPreviewFragment Process: com.ibm.cio.be.ppm, PID: 27130 Is there something that I am doing wrong? or Am I missing something? |
Alright I'm able to repro in my sample app. Will dig into why this is happening. |
So after some investigation this seems to be due to the way the layout is implemented. We'll evaluate a fix for this, but for now what you need to do is add a style to your activity that has at least the following:
You should be able to use your own colors if you want, but I tried the following and do not get the crash. |
New version of the SDK requires implementation of
|
Try returning |
@lupajz there are two more
What about these? |
What are you actually trying to build @omkarhande ? Are you trying to create a sample where you don't have to run an Activity to preview the BoxFile ? If that's the case I put up a fork that seems to work with documents (haven't tested rest) https://github.com/lupajz/box-android-preview-sdk/tree/no_activity If you could provide more details I could try to help. But to clarify those 2 methods:
|
@lupajz I am trying to open files in fragment using the |
@omkarhande so the sample I've linked above should work for your case. You can see the changes here |
@lupajz this is what I did, based on your sample code. Getting a blank screen with this.
|
@omkarhande Can I also see the xml layout please ? From just looking at your code I believe that issue is that you are trying to access views using kotlin synthetic reference, namely Anyway I've uploaded a video sample of what I'm getting from my example. |
Hi, I am trying to use box-android-preview-sdk, but I can't find any other way to display my files except using BoxPreviewActivity which pretty much handles everything yet my business case implies that I display the file inside an overlay which means I need to preview the selected file on a fragment not an activity.
What I am trying to do is to display the files using fragments on our application, but this is not possible through the SDK, or so I would think but I can't be sure because there is not enough documentation about this.
Is there any way that I can display the files on a fragment or not? I see that there is BoxPreviewFragment but I could not use it. Or is the only way to preview is using BoxPreviewActivity?
Another thing, we are displaying files that are stored on Box CMS, I already use BoxShareApi and pass the sharedLink to get the BoxItem so that I can use it with the preview SDK yet I always get the following error from the Preview SDK that the file is not found although I already got all its info using BoxShareApi
{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"item","message":"Invalid value 'f_157150080898'. 'item' with value 'f_157150080898' not found"}]},"help_url":"http://developers.box.com/docs/#errors","message":"Not Found","request_id":"number removed for privacy458fe9dce896a7"}
We tried this approach with Box IOS Preview SDK and it works just fine, I just don't understand what am I missing from Android side? Is there a limitation in the android preview SDK that does not allow me to preview files on CMS unless I at least have collaborator access to it?
The text was updated successfully, but these errors were encountered: