当前位置: 首页>>代码示例>>Java>>正文


Java BoxFutureTask类代码示例

本文整理汇总了Java中com.box.androidsdk.content.BoxFutureTask的典型用法代码示例。如果您正苦于以下问题:Java BoxFutureTask类的具体用法?Java BoxFutureTask怎么用?Java BoxFutureTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BoxFutureTask类属于com.box.androidsdk.content包,在下文中一共展示了BoxFutureTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mController.getSupportedFeatures().addOnCompletedListener(new BoxFutureTask.OnCompletedListener<BoxFeatures>() {
        @Override
        public void onCompleted(BoxResponse<BoxFeatures> response) {
            if (response.isSuccess()) {
                mPasswordProtectedLinksSupported = response.getResult().hasPasswordProtectForSharedLinks();

            } else {
                mPasswordProtectedLinksSupported = true;
                //Defaulting to true - if they aren't indeed supported, this will fail later when attempting to set password.
            }
            if (mPasswordProtectedLinksSupported && getView() != null && checkIfHasRequiredFields(mShareItem)) {
                updateUi();
            }
        }
    });
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:20,代码来源:SharedLinkAccessFragment.java

示例2: fetchItemInfo

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Gets information about given box item
 *
 * @param boxItem Box item object passed by the caller (eg. file, folder and bookmark)
 * @return an instance of BoxFutureTask that asynchronously executes a request to obtain
 *         info about a box item
 */
@Override
public BoxFutureTask<BoxItem> fetchItemInfo(BoxItem boxItem) {
    BoxRequest request = null;
    if (boxItem instanceof BoxFile) {
        request = mFileApi.getInfoRequest(boxItem.getId()).setFields(mFileShareFields);
    } else if (boxItem instanceof BoxFolder) {
        request = mFolderApi.getInfoRequest(boxItem.getId()).setFields(mFolderShareFields);
    } else if (boxItem instanceof BoxBookmark) {
        request = mBookmarkApi.getInfoRequest(boxItem.getId()).setFields(mBookmarkShareFields);
    }

    BoxFutureTask<BoxItem> task = new BoxFutureTask<BoxItem>(BoxItem.class, request);
    getApiExecutor().submit(task);
    return task;
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:23,代码来源:BoxShareController.java

示例3: fetchCollaborations

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Gets the collaborations on a box item
 *
 * @param boxCollaborationItem Box item for which collaborations need to be fetched
 * @return instance of BoxFutureTask that asynchronously executes a request to fetch
 *         collaborations on box folder
 */
@Override
public BoxFutureTask<BoxIteratorCollaborations> fetchCollaborations(BoxCollaborationItem boxCollaborationItem) {

    BoxFutureTask<BoxIteratorCollaborations> task = null;
    if (boxCollaborationItem instanceof BoxFolder) {
        task = mFolderApi
                .getCollaborationsRequest(boxCollaborationItem.getId()).toTask();
    } else if (boxCollaborationItem instanceof BoxFile){
        task = mFileApi.getCollaborationsRequest(boxCollaborationItem.getId()).toTask();
    }
    if (task == null){
        BoxLogUtils.nonFatalE("BoxShareConteroller","unhandled type " + boxCollaborationItem, new RuntimeException("bad argument"));
        return null;
    }
    getApiExecutor().submit(task);
    return task;
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:25,代码来源:BoxShareController.java

示例4: fetchRoles

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Gets a list of roles allowed for item collaboration invitees
 *
 * @param boxCollaborationItem Box item for which roles need to be fetched
 * @return instance of BoxFutureTask that asynchronously executes a request to fetch roles
 *         of invitees for folder collaboration
 */
@Override
public BoxFutureTask<BoxCollaborationItem> fetchRoles(BoxCollaborationItem boxCollaborationItem) {
    BoxRequest request = null;
    if (boxCollaborationItem instanceof BoxFile) {
        request = mFileApi.getInfoRequest(boxCollaborationItem.getId()).setFields(BoxFolder.FIELD_ALLOWED_INVITEE_ROLES);

    }
    if (boxCollaborationItem instanceof BoxFolder){
        request = mFolderApi.getInfoRequest(boxCollaborationItem.getId()).setFields(BoxFolder.FIELD_ALLOWED_INVITEE_ROLES);
    }
    if (request == null){
        BoxLogUtils.nonFatalE("BoxShareConteroller","unhandled type " + boxCollaborationItem, new RuntimeException("bad argument"));
        return null;
    }
    BoxFutureTask<BoxCollaborationItem> task = new BoxFutureTask<BoxCollaborationItem>(BoxCollaborationItem.class, request);
    getApiExecutor().submit(task);

    return task;
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:27,代码来源:BoxShareController.java

示例5: refresh

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Refresh authentication information associated with this session.
 *
 * @return a task that can be used to block until the information associated with this session has been refreshed.
 */
public BoxFutureTask<BoxSession> refresh() {
    if (mRefreshTask != null && mRefreshTask.get() != null){
        BoxFutureTask<BoxSession> lastRefreshTask = mRefreshTask.get();
        if (!(lastRefreshTask.isCancelled() || lastRefreshTask.isDone())){
            return lastRefreshTask;
        }
    }
    final BoxFutureTask<BoxSession> task = (new BoxSessionRefreshRequest(this)).toTask();
    new Thread(){
        @Override
        public void run() {
            task.run();
        }
    }.start();
    mRefreshTask = new WeakReference<BoxFutureTask<BoxSession>>(task);
    return task;
}
 
开发者ID:box,项目名称:box-android-sdk,代码行数:23,代码来源:BoxSession.java

示例6: doUserRefresh

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
private BoxFutureTask<BoxUser> doUserRefresh(final Context context, final BoxAuthenticationInfo info){
    BoxSession tempSession = new BoxSession(context, info.accessToken(), null);
    BoxApiUser apiUser = new BoxApiUser(tempSession);
    BoxFutureTask<BoxUser> task = apiUser.getCurrentUserInfoRequest().setFields(MINIMUM_USER_FIELDS).toTask();
    task.addOnCompletedListener(new BoxFutureTask.OnCompletedListener<BoxUser>() {
        @Override
        public void onCompleted(BoxResponse<BoxUser> response) {
            if (response.isSuccess()) {
                info.setUser(response.getResult());
                BoxAuthentication.getInstance().onAuthenticated(info, context);
            } else {
                BoxAuthentication.getInstance().onAuthenticationFailure(info, response.getException());
            }
        }
    });
    AUTH_EXECUTOR.execute(task);
    return task;
}
 
开发者ID:box,项目名称:box-android-sdk,代码行数:19,代码来源:BoxAuthentication.java

示例7: disableShareLink

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Disables share link for a box item
 *
 * @param boxItem Box item object passed by the caller (eg. file, folder and bookmark)
 * @return instance of BoxFutureTask that asynchronously executes a request to disable
 *         the shared link
 */
@Override
public BoxFutureTask<BoxItem> disableShareLink(BoxItem boxItem) {
    BoxRequest request = null;
    if (boxItem instanceof BoxFile) {
        request = mFileApi.getDisableSharedLinkRequest(boxItem.getId()).setFields(mFileShareFields);
    } else if (boxItem instanceof BoxFolder) {
        request = mFolderApi.getDisableSharedLinkRequest(boxItem.getId()).setFields(mFolderShareFields);
    } else if (boxItem instanceof BoxBookmark) {
        request = mBookmarkApi.getDisableSharedLinkRequest(boxItem.getId()).setFields(mBookmarkShareFields);
    }

    return executeRequest(BoxItem.class, request);
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:21,代码来源:BoxShareController.java

示例8: addCollaborations

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Adds a list of users as collaborators to a folder by using their emails
 *
 * @param boxCollaborationItem Box Folder to be collaborated upon
 * @param selectedRole Role for folder collaboration
 * @param emails Emails of collaborators
 * @return instance of BoxFutureTask that asynchronously executes a batch request to add
 *         collaborators on a given folder
 */
@Override
public BoxFutureTask<BoxResponseBatch> addCollaborations(BoxCollaborationItem boxCollaborationItem, BoxCollaboration.Role selectedRole, String[] emails) {
    BoxRequestBatch batchRequest = new BoxRequestBatch();
    for (String email: emails) {
        String trimmedEmail = email.trim();
        if (!SdkUtils.isBlank(trimmedEmail)) {
            batchRequest.addRequest(mCollabApi.getAddRequest(boxCollaborationItem, selectedRole, trimmedEmail));
        }
    }

    BoxFutureTask<BoxResponseBatch> task = batchRequest.toTask();
    getApiExecutor().submit(task);
    return task;
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:24,代码来源:BoxShareController.java

示例9: getSupportedFeatures

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Get a list of supported features for the user
 *
 * @return instance of BoxFutureTask that asynchronously executes a request to fetch the supported features
 */
@Override
public BoxFutureTask<BoxFeatures> getSupportedFeatures() {
    BoxFutureTask<BoxFeatures> task = mFeaturesApi.getSupportedFeatures().toTask();
    getApiExecutor().submit(task);
    return task;
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:12,代码来源:BoxShareController.java

示例10: logout

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Logout the currently authenticated user.
 *
 * @return a task that can be used to block until the user associated with this session has been logged out.
 */
public BoxFutureTask<BoxSession> logout() {
    final BoxFutureTask<BoxSession> task = (new BoxSessionLogoutRequest(this)).toTask();
    new Thread(){
        @Override
        public void run() {
            task.run();
        }
    }.start();

    return task;
}
 
开发者ID:box,项目名称:box-android-sdk,代码行数:17,代码来源:BoxSession.java

示例11: handleToTaskForCachedResult

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
/**
 * Default implementation for getting a task to execute the request.
 * @param <R> A BoxRequest that implements BoxCaceableRequest
 * @return The task used to get data from cache implementation.
 * @throws BoxException thrown if there is no cache implementation set in BoxConfig.
 */
protected <R extends BoxRequest & BoxCacheableRequest> BoxFutureTask<T> handleToTaskForCachedResult() throws BoxException {
    BoxCache cache = BoxConfig.getCache();
    if (cache == null) {
        throw new BoxException.CacheImplementationNotFound();
    }

    return new BoxCacheFutureTask<T, R>(mClazz, (R) getCacheableRequest(), cache);
}
 
开发者ID:box,项目名称:box-android-sdk,代码行数:15,代码来源:BoxRequest.java

示例12: execute

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
@Override
public void execute(BoxRequest request) {
    if (request == null) {
        return;
    }
    if (BoxConfig.getCache() != null && request instanceof BoxCacheableRequest){
        try {
            BoxFutureTask cacheTask = ((BoxCacheableRequest) request).toTaskForCachedResult();
            if (mListener != null){
                cacheTask.addOnCompletedListener(mListener);
            }
            getApiExecutor().execute(cacheTask);
        } catch (BoxException e){
            BoxLogUtils.e("cache task error ", e);
        }

    }
    BoxFutureTask task = request.toTask();
    if (mListener != null) {
        task.addOnCompletedListener(mListener);
    }

    // Thumbnail request should be executed in their own executor pool
    ThreadPoolExecutor executor = request instanceof BoxRequestsFile.DownloadThumbnail ?
            getThumbnailExecutor() :
            getApiExecutor();
    executor.submit(task);
}
 
开发者ID:box,项目名称:box-android-browse-sdk,代码行数:29,代码来源:BoxBrowseController.java

示例13: toTaskForCachedResult

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
@Override
public BoxFutureTask<BoxIteratorInvitees> toTaskForCachedResult() throws BoxException {
    return handleToTaskForCachedResult();
}
 
开发者ID:box,项目名称:box-android-share-sdk,代码行数:5,代码来源:BoxRequestsInvitee.java

示例14: executeAvatarDownloadRequest

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
@Override
public BoxFutureTask<BoxDownload> executeAvatarDownloadRequest(String userId, BoxAvatarView avatarView) {
    return null;
}
 
开发者ID:box,项目名称:box-android-sdk,代码行数:5,代码来源:OfflineAvatarController.java

示例15: executeTask

import com.box.androidsdk.content.BoxFutureTask; //导入依赖的package包/类
protected void executeTask(final BoxFutureTask task){
    if (mExecutor == null){
        mExecutor = SdkUtils.createDefaultThreadPoolExecutor(2, 2, 3600, TimeUnit.SECONDS);
    }
    mExecutor.execute(task);
}
 
开发者ID:box,项目名称:box-android-sdk,代码行数:7,代码来源:DefaultAvatarController.java


注:本文中的com.box.androidsdk.content.BoxFutureTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。