Box Android Preview SDK


License

License

GroupId

GroupId

com.box
ArtifactId

ArtifactId

box-android-preview-sdk
Last Version

Last Version

3.0.4
Release Date

Release Date

Type

Type

aar
Description

Description

Box Android Preview SDK
Box Android Preview SDK
Project URL

Project URL

https://github.com/box/box-android-preview-sdk
Source Code Management

Source Code Management

https://github.com/box/box-android-preview-sdk

Download box-android-preview-sdk

How to add to project

<!-- https://jarcasting.com/artifacts/com.box/box-android-preview-sdk/ -->
<dependency>
    <groupId>com.box</groupId>
    <artifactId>box-android-preview-sdk</artifactId>
    <version>3.0.4</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.box/box-android-preview-sdk/
implementation 'com.box:box-android-preview-sdk:3.0.4'
// https://jarcasting.com/artifacts/com.box/box-android-preview-sdk/
implementation ("com.box:box-android-preview-sdk:3.0.4")
'com.box:box-android-preview-sdk:aar:3.0.4'
<dependency org="com.box" name="box-android-preview-sdk" rev="3.0.4">
  <artifact name="box-android-preview-sdk" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.box', module='box-android-preview-sdk', version='3.0.4')
)
libraryDependencies += "com.box" % "box-android-preview-sdk" % "3.0.4"
[com.box/box-android-preview-sdk "3.0.4"]

Dependencies

compile (19)

Group / Artifact Type Version
com.box : box-android-browse-sdk jar 2.1.0
androidx.core » core jar 1.0.1
androidx.appcompat » appcompat jar 1.0.2
androidx.cardview » cardview jar 1.0.0
androidx.recyclerview » recyclerview jar 1.0.0
com.google.android.material » material jar 1.1.0-alpha02
androidx.lifecycle » lifecycle-extensions jar 2.0.0
androidx.lifecycle » lifecycle-viewmodel jar 2.0.0
androidx.lifecycle » lifecycle-livedata jar 2.0.0
androidx.lifecycle » lifecycle-runtime jar 2.0.0
com.google.android.exoplayer » exoplayer-core jar 2.9.0
com.google.android.exoplayer » exoplayer-ui jar 2.9.0
com.google.android.exoplayer » exoplayer-dash jar 2.9.0
org.jetbrains.kotlin : kotlin-stdlib jar 1.3.20
com.github.chrisbanes.photoview : library jar 1.2.3
com.facebook.device.yearclass : yearclass jar 2.0.0
io.reactivex.rxjava2 : rxjava jar 2.2.4
io.reactivex.rxjava2 : rxandroid jar 2.1.0
com.getkeepsafe.relinker : relinker jar 1.3.1

Project Modules

There are no modules declared in this project.

Box Android Preview SDK

This SDK enables you to support previewing Box files within your application.

Types of files supported:

  • images
  • PDFs
  • audio/video files
  • markdown/text/code files
  • Office documents

Currently not supported:

  • Box Notes

Developer Setup

The box preview sdk is currently private, and distributed as an aar file through maven:

    implementation 'com.box:box-android-preview-sdk:3.0.3'

Please refer to the build.gradle file in box-preview-sample for setting up your gradle dependencies.

Quickstart

Refer to box-content-sdk for details on how to set your client id, and secret; and authenticate the user.

You can get a BoxFile instance using the box-content-sdk or the box-browse-sdk

The simplest way to preview a single file, is to start a BoxPreviewActivity, the intent for which can be created using the createIntentBuilder factory method.

     BoxPreviewActivity.IntentBuilder builder = BoxPreviewActivity.createIntentBuilder(this, boxSession, boxFile);

Modifying visibility of document preview menu items

It's possible to modify visibility of specific menu items in document preview by overriding bool resource value in consuming application. Options available for modification with their default values:

<!-- sets visibility of the grid menu option -->
<bool name="box_previewsdk_document_menu_grid_visible">true</bool> 
<!-- sets visibility of the outline menu option -->
<bool name="box_previewsdk_document_menu_outline_visible">true</bool> 

Example code is provided in the sample app repository.

Paging through multiple images, audio or video files

Passing the BoxFolder to the intent builder BoxPreviewActivity allows the sdk to also load other files of the same type from the parent folder into a custom ViewPager called the BoxPreviewViewPager. Another way of doing this, is to directly pass a BoxItems collection to the builder.

     builder.setBoxFolder(boxFolder);

Precaching files:

To preload files into the cache, without presenting them, make use of com.box.androidsdk.preview.BoxPreviewViewPager.getCacheFileRequest api.

     FutureTask task = BoxPreviewViewPager.getCacheFileRequest(boxSession, previewStorage, boxFile);

Customizing cache policy:

You can customize the max cache size (default 500MB), and cache age (default 90 days) by defining

com.box.androidsdk.preview.PreviewStorage.MAX_CACHE_SIZE 
com.box.androidsdk.preview.PreviewStorage.MAX_CACHE_AGE

Cache age defines how long an unaccessed file will stay in the cache, if it hasn't been cleared out of the LRU cache for memory.

Sample App

A sample app can be found in the box-preview-sample folder.

Copyright and License

Copyright 2015 Box, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

com.box

Box

Box, Inc.

Versions

Version
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.1.0
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.0.0