idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
152,400
public BoxRequestsFile . GetCollaborations getCollaborationsRequest ( String id ) { BoxRequestsFile . GetCollaborations request = new BoxRequestsFile . GetCollaborations ( id , getFileCollaborationsUrl ( id ) , mSession ) ; return request ; }
Gets a request that gets the collaborations of a file
152,401
public BoxRequestsFile . GetFileVersions getVersionsRequest ( String id ) { BoxRequestsFile . GetFileVersions request = new BoxRequestsFile . GetFileVersions ( id , getFileVersionsUrl ( id ) , mSession ) ; return request ; }
Gets a request that retrieves the versions of a file
152,402
public BoxRequestsFile . DeleteFileVersion getDeleteVersionRequest ( String id , String versionId ) { BoxRequestsFile . DeleteFileVersion request = new BoxRequestsFile . DeleteFileVersion ( versionId , getDeleteFileVersionUrl ( id , versionId ) , mSession ) ; return request ; }
Gets a request that deletes a version of a file
152,403
public BoxRequestsFile . AddFileToCollection getAddToCollectionRequest ( String fileId , String collectionId ) { BoxRequestsFile . AddFileToCollection request = new BoxRequestsFile . AddFileToCollection ( fileId , collectionId , getFileInfoUrl ( fileId ) , mSession ) ; return request ; }
Gets a request that adds a file to a collection
152,404
public BoxRequestsFile . DeleteFileFromCollection getDeleteFromCollectionRequest ( String id ) { BoxRequestsFile . DeleteFileFromCollection request = new BoxRequestsFile . DeleteFileFromCollection ( id , getFileInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that removes a file from a collection
152,405
public BoxRequestsFile . FilePreviewed getFilePreviewedRequest ( String fileId ) { return new BoxRequestsFile . FilePreviewed ( fileId , getPreviewFileUrl ( ) , mSession ) ; }
Gets a request that inform the server that a file was previewed . This makes the file to be included on the recents list .
152,406
public BoxRequestsFile . GetUploadSession getUploadSession ( String uploadSessionId ) { return new BoxRequestsFile . GetUploadSession ( uploadSessionId , getUploadSessionInfoUrl ( uploadSessionId ) , mSession ) ; }
Gets a request to fetch the upload session using the upload session id . It contains the number of parts that are processed so far the total number of parts required for the commit and expiration date and time of the upload session .
152,407
public R setLimit ( final int limit ) { mQueryMap . put ( FIELD_LIMIT , Integer . toString ( limit ) ) ; return ( R ) this ; }
Sets the maximum number of events to return in the list of events .
152,408
public R setPreviousListEvents ( E listEvents ) { mListEvents = listEvents ; this . setStreamPosition ( ( ( IStreamPosition ) mListEvents ) . getNextStreamPosition ( ) . toString ( ) ) ; return ( R ) this ; }
Convenience method . When set the request will be set to the next stream position from the given event and will will aggregate the new results with the provided list .
152,409
private void writeObject ( java . io . ObjectOutputStream s ) throws java . io . IOException { s . defaultWriteObject ( ) ; }
Serialize object .
152,410
public static BoxFolder createFromIdAndName ( String folderId , String name ) { JsonObject object = new JsonObject ( ) ; object . add ( BoxItem . FIELD_ID , folderId ) ; object . add ( BoxItem . FIELD_TYPE , BoxFolder . TYPE ) ; if ( ! TextUtils . isEmpty ( name ) ) { object . add ( BoxItem . FIELD_NAME , name ) ; } re...
A convenience method to create an empty folder with just the id and type fields set . This allows the ability to interact with the content sdk in a more descriptive and type safe manner
152,411
public static BoxBookmark createFromId ( String bookmarkId ) { JsonObject object = new JsonObject ( ) ; object . add ( FIELD_ID , bookmarkId ) ; object . add ( FIELD_TYPE , TYPE ) ; return new BoxBookmark ( object ) ; }
A convenience method to create an empty bookmark with just the id and type fields set . This allows the ability to interact with the content sdk in a more descriptive and type safe manner
152,412
public BoxHttpRequest addHeader ( String key , String value ) { mUrlConnection . addRequestProperty ( key , value ) ; return this ; }
Adds an HTTP header to the request .
152,413
public BoxHttpRequest setBody ( InputStream body ) throws IOException { mUrlConnection . setDoOutput ( true ) ; OutputStream output = mUrlConnection . getOutputStream ( ) ; int b = body . read ( ) ; while ( b != - 1 ) { output . write ( b ) ; b = body . read ( ) ; } output . close ( ) ; return this ; }
Sets the body for the HTTP request to the contents of an InputStream .
152,414
public BoxRequestsUser . GetUserInfo getCurrentUserInfoRequest ( ) { BoxRequestsUser . GetUserInfo request = new BoxRequestsUser . GetUserInfo ( getUserInformationUrl ( "me" ) , mSession ) ; return request ; }
Gets a request that gets information about the current user
152,415
public BoxRequestsUser . GetUserInfo getUserInfoRequest ( String id ) { BoxRequestsUser . GetUserInfo request = new BoxRequestsUser . GetUserInfo ( getUserInformationUrl ( id ) , mSession ) ; return request ; }
Gets a request that gets information about a user
152,416
public BoxRequestsUser . GetEnterpriseUsers getEnterpriseUsersRequest ( ) { BoxRequestsUser . GetEnterpriseUsers request = new BoxRequestsUser . GetEnterpriseUsers ( getUsersUrl ( ) , mSession ) ; return request ; }
Gets a request that gets all the users of an enterprise The session provided must be associated with an enterprise admin user
152,417
public BoxRequestsUser . CreateEnterpriseUser getCreateEnterpriseUserRequest ( String login , String name ) { BoxRequestsUser . CreateEnterpriseUser request = new BoxRequestsUser . CreateEnterpriseUser ( getUsersUrl ( ) , mSession , login , name ) ; return request ; }
Gets a request that creates an enterprise user The session provided must be associated with an enterprise admin user
152,418
public BoxRequestsUser . DeleteEnterpriseUser getDeleteEnterpriseUserRequest ( String userId ) { BoxRequestsUser . DeleteEnterpriseUser request = new BoxRequestsUser . DeleteEnterpriseUser ( getUserInformationUrl ( userId ) , mSession , userId ) ; return request ; }
Gets a request that deletes an enterprise user The session provided must be associated with an enterprise admin user
152,419
public BoxRequestsFile . DownloadAvatar getDownloadAvatarRequest ( File target , String userId ) throws IOException { if ( ! target . exists ( ) ) { throw new FileNotFoundException ( ) ; } BoxRequestsFile . DownloadAvatar request = new BoxRequestsFile . DownloadAvatar ( userId , target , getAvatarDownloadUrl ( userId )...
Gets a request that downloads an avatar of the target user id .
152,420
public BoxRequestsFile . DownloadFile getDownloadAvatarRequest ( OutputStream outputStream , String userId ) { BoxRequestsFile . DownloadFile request = new BoxRequestsFile . DownloadFile ( userId , outputStream , getAvatarDownloadUrl ( userId ) , mSession ) ; return request ; }
Gets a request that downloads the given avatar to the provided outputStream . Developer is responsible for closing the outputStream provided .
152,421
public R setName ( String name ) { mBodyMap . put ( BoxUser . FIELD_NAME , name ) ; return ( R ) this ; }
Sets the new name for the user in the request .
152,422
public R setRole ( BoxUser . Role role ) { mBodyMap . put ( BoxUser . FIELD_ROLE , role ) ; return ( R ) this ; }
Sets the new role for the user .
152,423
public R setJobTitle ( String jobTitle ) { mBodyMap . put ( BoxUser . FIELD_JOB_TITLE , jobTitle ) ; return ( R ) this ; }
Sets the job title for the user in the request .
152,424
public R setPhone ( String phone ) { mBodyMap . put ( BoxUser . FIELD_PHONE , phone ) ; return ( R ) this ; }
Sets the phone number of the user in the request .
152,425
public R setAddress ( String address ) { mBodyMap . put ( BoxUser . FIELD_ADDRESS , address ) ; return ( R ) this ; }
Sets the address of the user in the request .
152,426
public R setStatus ( BoxUser . Status status ) { mBodyMap . put ( BoxUser . FIELD_STATUS , status ) ; return ( R ) this ; }
Sets the status for the user in the request .
152,427
public R setTimezone ( String timezone ) { mBodyMap . put ( BoxUser . FIELD_TIMEZONE , timezone ) ; return ( R ) this ; }
Sets the timezone for the user in the request .
152,428
public BoxRequestRecentItems . GetRecentItems getRecentItemsRequest ( ) { BoxRequestRecentItems . GetRecentItems request = new BoxRequestRecentItems . GetRecentItems ( getRecentItemsUrl ( ) , mSession ) ; return request ; }
Gets a request that gets users recent items
152,429
public boolean isEmbedLinkUrlExpired ( ) { Long urlCreationTime = getUrlCreationTime ( ) ; if ( urlCreationTime == null ) { return true ; } return ( System . currentTimeMillis ( ) - urlCreationTime ) < ( 60 * 1000 ) ; }
Convenience method to check if 60 seconds has passed since the time this link was created .
152,430
public boolean isPreviewSessionExpired ( ) { Long urlCreationTime = getUrlCreationTime ( ) ; if ( urlCreationTime == null ) { return true ; } return ( System . currentTimeMillis ( ) - urlCreationTime ) < ( 60 * 60 * 1000 ) ; }
Convenience method to check if 60 minutes has passed since the time this link was created .
152,431
public BoxRequestsBookmark . GetBookmarkInfo getInfoRequest ( final String id ) { BoxRequestsBookmark . GetBookmarkInfo request = new BoxRequestsBookmark . GetBookmarkInfo ( id , getBookmarkInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that retrieves information on a bookmark
152,432
public BoxRequestsBookmark . CreateBookmark getCreateRequest ( String parentId , String url ) { BoxRequestsBookmark . CreateBookmark request = new BoxRequestsBookmark . CreateBookmark ( parentId , url , getBookmarksUrl ( ) , mSession ) ; return request ; }
Gets a request that creates a bookmark in a parent bookmark
152,433
public BoxRequestsBookmark . UpdateBookmark getUpdateRequest ( String id ) { BoxRequestsBookmark . UpdateBookmark request = new BoxRequestsBookmark . UpdateBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that updates a bookmark s information
152,434
public BoxRequestsBookmark . CopyBookmark getCopyRequest ( String id , String parentId ) { BoxRequestsBookmark . CopyBookmark request = new BoxRequestsBookmark . CopyBookmark ( id , parentId , getBookmarkCopyUrl ( id ) , mSession ) ; return request ; }
Gets a request that copies a bookmark
152,435
public BoxRequestsBookmark . UpdateBookmark getRenameRequest ( String id , String newName ) { BoxRequestsBookmark . UpdateBookmark request = new BoxRequestsBookmark . UpdateBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) ; request . setName ( newName ) ; return request ; }
Gets a request that renames a bookmark
152,436
public BoxRequestsBookmark . UpdateBookmark getMoveRequest ( String id , String parentId ) { BoxRequestsBookmark . UpdateBookmark request = new BoxRequestsBookmark . UpdateBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) ; request . setParentId ( parentId ) ; return request ; }
Gets a request that moves a bookmark to another folder
152,437
public BoxRequestsBookmark . DeleteBookmark getDeleteRequest ( String id ) { BoxRequestsBookmark . DeleteBookmark request = new BoxRequestsBookmark . DeleteBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that deletes a bookmark
152,438
public BoxRequestsBookmark . UpdateSharedBookmark getCreateSharedLinkRequest ( String id ) { BoxRequestsBookmark . UpdateSharedBookmark request = new BoxRequestsBookmark . UpdateSharedBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) . setAccess ( null ) ; return request ; }
Gets a request that creates a shared link for a bookmark
152,439
public BoxRequestsBookmark . UpdateBookmark getDisableSharedLinkRequest ( String id ) { BoxRequestsBookmark . UpdateBookmark request = new BoxRequestsBookmark . UpdateBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) . setSharedLink ( null ) ; return request ; }
Gets a request that disables a shared link for a bookmark
152,440
public BoxRequestsBookmark . AddCommentToBookmark getAddCommentRequest ( String bookmarkId , String message ) { BoxRequestsBookmark . AddCommentToBookmark request = new BoxRequestsBookmark . AddCommentToBookmark ( bookmarkId , message , getCommentUrl ( ) , mSession ) ; return request ; }
Gets a request that adds a comment to a bookmark
152,441
public BoxRequestsBookmark . GetTrashedBookmark getTrashedBookmarkRequest ( String id ) { BoxRequestsBookmark . GetTrashedBookmark request = new BoxRequestsBookmark . GetTrashedBookmark ( id , getTrashedBookmarkUrl ( id ) , mSession ) ; return request ; }
Gets a request that returns a bookmark in the trash
152,442
public BoxRequestsBookmark . DeleteTrashedBookmark getDeleteTrashedBookmarkRequest ( String id ) { BoxRequestsBookmark . DeleteTrashedBookmark request = new BoxRequestsBookmark . DeleteTrashedBookmark ( id , getTrashedBookmarkUrl ( id ) , mSession ) ; return request ; }
Gets a request that permanently deletes a bookmark from the trash
152,443
public BoxRequestsBookmark . RestoreTrashedBookmark getRestoreTrashedBookmarkRequest ( String id ) { BoxRequestsBookmark . RestoreTrashedBookmark request = new BoxRequestsBookmark . RestoreTrashedBookmark ( id , getBookmarkInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that restores a trashed bookmark
152,444
public BoxRequestsBookmark . GetBookmarkComments getCommentsRequest ( String id ) { BoxRequestsBookmark . GetBookmarkComments request = new BoxRequestsBookmark . GetBookmarkComments ( id , getBookmarkCommentsUrl ( id ) , mSession ) ; return request ; }
Gets a request that retrieves the comments on a bookmark
152,445
public BoxRequestsBookmark . AddBookmarkToCollection getAddToCollectionRequest ( String bookmarkId , String collectionId ) { BoxRequestsBookmark . AddBookmarkToCollection request = new BoxRequestsBookmark . AddBookmarkToCollection ( bookmarkId , collectionId , getBookmarkInfoUrl ( bookmarkId ) , mSession ) ; return req...
Gets a request that adds a bookmark to a collection
152,446
public BoxRequestsBookmark . DeleteBookmarkFromCollection getDeleteFromCollectionRequest ( String id ) { BoxRequestsBookmark . DeleteBookmarkFromCollection request = new BoxRequestsBookmark . DeleteBookmarkFromCollection ( id , getBookmarkInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that removes a bookmark from a collection
152,447
public BoxSimpleMessage connect ( ) { mRetries = 0 ; try { BoxIteratorRealTimeServers servers = ( BoxIteratorRealTimeServers ) mRequest . send ( ) ; mBoxRealTimeServer = servers . get ( 0 ) ; } catch ( BoxException e ) { mChangeListener . onException ( e , this ) ; return null ; } BoxRequestsEvent . LongPollMessageRequ...
Returns a message once a change has been detected or error occurs . Otherwise this method will continue reconnecting .
152,448
public void putField ( String key , Date value ) { this . fields . put ( key , BoxDateFormat . format ( value ) ) ; }
Adds or updates a multipart field in this request .
152,449
public void setFile ( InputStream inputStream , String filename , long fileSize ) { this . setFile ( inputStream , filename ) ; this . fileSize = fileSize ; }
Sets the file contents of this request .
152,450
public static String getRepresentationHintString ( String repType , String repSize ) { StringBuffer sb = new StringBuffer ( repType ) ; if ( TYPE_JPG . equals ( repType ) || TYPE_PNG . equals ( repType ) ) { if ( TextUtils . isEmpty ( repSize ) ) { throw new InvalidParameterException ( "Size is not optional when creati...
Helper method to generate representation hint string
152,451
public Long getNextStreamPosition ( ) { String longValue = getPropertyAsString ( FIELD_NEXT_STREAM_POSITION ) ; return Long . parseLong ( longValue . replace ( "\"" , "" ) ) ; }
Gets the next position in the event stream that you should request in order to get the next events .
152,452
public static BoxFile createFromIdAndName ( String fileId , String name ) { JsonObject object = new JsonObject ( ) ; object . add ( BoxItem . FIELD_ID , fileId ) ; object . add ( BoxItem . FIELD_TYPE , BoxFile . TYPE ) ; if ( ! TextUtils . isEmpty ( name ) ) { object . add ( BoxItem . FIELD_NAME , name ) ; } return new...
A convenience method to create an empty file with just the id and type fields set . This allows the ability to interact with the content sdk in a more descriptive and type safe manner
152,453
private void loadRootFolder ( ) { new Thread ( ) { public void run ( ) { try { final BoxIteratorItems folderItems = mFolderApi . getItemsRequest ( BoxConstants . ROOT_FOLDER_ID ) . send ( ) ; runOnUiThread ( new Runnable ( ) { public void run ( ) { mAdapter . clear ( ) ; for ( BoxItem boxItem : folderItems ) { mAdapter...
Method to demonstrate fetching folder items from the root folder
152,454
private void uploadSampleFile ( ) { mDialog = ProgressDialog . show ( MainActivity . this , getText ( R . string . boxsdk_Please_wait ) , getText ( R . string . boxsdk_Please_wait ) ) ; new Thread ( ) { public void run ( ) { try { String uploadFileName = "box_logo.png" ; InputStream uploadStream = getResources ( ) . ge...
Method demonstrates a sample file being uploaded using the file api
152,455
private void uploadNewVersion ( final BoxFile file ) { new Thread ( ) { public void run ( ) { try { String uploadFileName = "box_logo.png" ; InputStream uploadStream = getResources ( ) . getAssets ( ) . open ( uploadFileName ) ; BoxRequestsFile . UploadNewVersion request = mFileApi . getUploadNewVersionRequest ( upload...
Method demonstrates a new version of a file being uploaded using the file api
152,456
public static void copyStream ( final InputStream inputStream , final OutputStream outputStream ) throws IOException , InterruptedException { copyStream ( inputStream , outputStream , null ) ; }
Utility method to write given inputStream to given outputStream .
152,457
public static String copyStreamAndComputeSha1 ( final InputStream inputStream , final OutputStream outputStream ) throws NoSuchAlgorithmException , IOException , InterruptedException { MessageDigest md = MessageDigest . getInstance ( "SHA-1" ) ; copyStream ( inputStream , outputStream , md ) ; return new String ( encod...
Utility method to write given inputStream to given outputStream and compute the sha1 while transferring the bytes
152,458
private static void copyStream ( final InputStream inputStream , final OutputStream outputStream , MessageDigest messageDigest ) throws IOException , InterruptedException { final byte [ ] buffer = new byte [ BUFFER_SIZE ] ; int bufferLength = 0 ; Exception exception = null ; try { while ( ( bufferLength = inputStream ....
Utility method to write given inputStream to given outputStream and update the messageDigest while transferring the bytes
152,459
public static OutputStream createArrayOutputStream ( final OutputStream [ ] outputStreams ) { return new OutputStream ( ) { public void close ( ) throws IOException { for ( OutputStream o : outputStreams ) { o . close ( ) ; } super . close ( ) ; } public void flush ( ) throws IOException { for ( OutputStream o : output...
Helper method that wraps given arrays inside of a single outputstream .
152,460
public static String sha1 ( final InputStream inputStream ) throws IOException , NoSuchAlgorithmException { MessageDigest md = MessageDigest . getInstance ( "SHA-1" ) ; byte [ ] bytes = new byte [ 8192 ] ; int byteCount ; while ( ( byteCount = inputStream . read ( bytes ) ) > 0 ) { md . update ( bytes , 0 , byteCount )...
Utilitiy method to calculate sha1 based on given inputStream .
152,461
public static long parseJsonValueToLong ( JsonValue value ) { try { return value . asLong ( ) ; } catch ( UnsupportedOperationException e ) { String s = value . asString ( ) . replace ( "\"" , "" ) ; return Long . parseLong ( s ) ; } }
Parse a given JsonValue to a long regardless of whether that value is a String or a long .
152,462
public static long parseJsonValueToInteger ( JsonValue value ) { try { return value . asInt ( ) ; } catch ( UnsupportedOperationException e ) { String s = value . asString ( ) . replace ( "\"" , "" ) ; return Integer . parseInt ( s ) ; } }
Parse a given JsonValue to an int regardless of whether that value is a String or an int .
152,463
public static String concatStringWithDelimiter ( String [ ] strings , String delimiter ) { StringBuilder sbr = new StringBuilder ( ) ; int size = strings . length ; for ( int i = 0 ; i < size - 1 ; i ++ ) { sbr . append ( strings [ i ] ) . append ( delimiter ) ; } sbr . append ( strings [ size - 1 ] ) ; return sbr . to...
Utility method to create a large String with the given delimiter .
152,464
public static < T extends Object > T cloneSerializable ( T source ) { ByteArrayOutputStream baos = null ; ObjectOutputStream oos = null ; ByteArrayInputStream bais = null ; ObjectInputStream ois = null ; try { baos = new ByteArrayOutputStream ( ) ; oos = new ObjectOutputStream ( baos ) ; oos . writeObject ( source ) ; ...
Helper method to clone a serializable object .
152,465
public static String convertSerializableToString ( Serializable obj ) { ByteArrayOutputStream baos = null ; ObjectOutputStream oos = null ; try { baos = new ByteArrayOutputStream ( ) ; oos = new ObjectOutputStream ( baos ) ; oos . writeObject ( obj ) ; return new String ( baos . toByteArray ( ) ) ; } catch ( IOExceptio...
Helper method to write a serializable object into a String .
152,466
public static boolean deleteFolderRecursive ( final File f ) { if ( f . isDirectory ( ) ) { File [ ] files = f . listFiles ( ) ; if ( files == null ) { return false ; } for ( File c : files ) { deleteFolderRecursive ( c ) ; } } return f . delete ( ) ; }
Recursively delete a folder and all its subfolders and files .
152,467
public static boolean isInternetAvailable ( Context context ) { ConnectivityManager connectivityManager = ( ConnectivityManager ) context . getApplicationContext ( ) . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { return isInternetAvailable ...
Check for an internet connection .
152,468
public static String getAssetFile ( final Context context , final String assetName ) { AssetManager assetManager = context . getAssets ( ) ; BufferedReader in = null ; try { StringBuilder buf = new StringBuilder ( ) ; InputStream is = assetManager . open ( assetName ) ; in = new BufferedReader ( new InputStreamReader (...
Helper method for reading an asset file into a string .
152,469
public static void toastSafely ( final Context context , final int resId , final int duration ) { Long lastToastTime = LAST_TOAST_TIME . get ( resId ) ; if ( lastToastTime != null && ( lastToastTime + TOAST_MIN_REPEAT_DELAY ) < System . currentTimeMillis ( ) ) { return ; } Looper mainLooper = Looper . getMainLooper ( )...
Helper method for showing a toast message checking to see if user is on ui thread and not showing the same toast if it has already been shown within TOAST_MIN_REPEAT_DELAY time .
152,470
public static void setInitialsThumb ( Context context , TextView initialsView , String fullName ) { char initial1 = '\u0000' ; char initial2 = '\u0000' ; if ( fullName != null ) { String [ ] nameParts = fullName . split ( " " ) ; if ( nameParts [ 0 ] . length ( ) > 0 ) { initial1 = nameParts [ 0 ] . charAt ( 0 ) ; } if...
Helper method used to display initials into a given textview .
152,471
public static void setCollabNumberThumb ( Context context , TextView initialsView , int collabNumber ) { String collabNumberDisplay = ( collabNumber >= 100 ) ? "+99" : "+" + Integer . toString ( collabNumber ) ; setColorForCollabNumberThumb ( initialsView ) ; initialsView . setTextColor ( COLLAB_NUMBER_THUMB_COLOR ) ; ...
Helper method to display number of collaborators . If there are more than 99 collaborators it would show 99 + due to the width constraint in the view .
152,472
public static void setColorsThumb ( TextView initialsView , int backgroundColor , int strokeColor ) { GradientDrawable drawable = ( GradientDrawable ) initialsView . getResources ( ) . getDrawable ( R . drawable . boxsdk_thumb_background ) ; drawable . setColorFilter ( backgroundColor , PorterDuff . Mode . MULTIPLY ) ;...
Sets the the background thumb color for the account view to one of the material colors
152,473
public static void setColorForInitialsThumb ( TextView initialsView , int position ) { int backgroundColor = THUMB_COLORS [ ( position ) % THUMB_COLORS . length ] ; setColorsThumb ( initialsView , backgroundColor , Color . WHITE ) ; }
Sets the thumb color that displays users initials
152,474
public static String getLocalizedFileSize ( final Context context , double numSize ) { String localeLanguage = Locale . getDefault ( ) . getLanguage ( ) ; if ( ! SIZE_LANGUAGE . equals ( localeLanguage ) && context != null && context . getResources ( ) != null ) { Resources resources = context . getResources ( ) ; SIZE...
Java version of routine to turn a long into a short user readable string .
152,475
protected R setCollectionId ( String id ) { JsonArray jsonArray = new JsonArray ( ) ; if ( ! TextUtils . isEmpty ( id ) ) { BoxCollection col = BoxCollection . createFromId ( id ) ; jsonArray . add ( col . toJsonObject ( ) ) ; } mBodyMap . put ( FIELD_COLLECTIONS , jsonArray ) ; return ( R ) this ; }
Sets the id of the collection to update .
152,476
public BoxRequestsFolder . GetFolderInfo getInfoRequest ( String id ) { BoxRequestsFolder . GetFolderInfo request = new BoxRequestsFolder . GetFolderInfo ( id , getFolderInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that retrieves information on a folder
152,477
public BoxRequestsFolder . GetFolderItems getItemsRequest ( String id ) { BoxRequestsFolder . GetFolderItems request = new BoxRequestsFolder . GetFolderItems ( id , getFolderItemsUrl ( id ) , mSession ) ; return request ; }
Gets a request that retrieves the items of a folder
152,478
public BoxRequestsFolder . CreateFolder getCreateRequest ( String parentId , String name ) { BoxRequestsFolder . CreateFolder request = new BoxRequestsFolder . CreateFolder ( parentId , name , getFoldersUrl ( ) , mSession ) ; return request ; }
Gets a request that creates a folder in a parent folder
152,479
public BoxRequestsFolder . UpdateFolder getUpdateRequest ( String id ) { BoxRequestsFolder . UpdateFolder request = new BoxRequestsFolder . UpdateFolder ( id , getFolderInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that updates a folders information
152,480
public BoxRequestsFolder . UpdateFolder getRenameRequest ( String id , String newName ) { BoxRequestsFolder . UpdateFolder request = new BoxRequestsFolder . UpdateFolder ( id , getFolderInfoUrl ( id ) , mSession ) . setName ( newName ) ; return request ; }
Gets a request that renames a folder
152,481
public BoxRequestsFolder . UpdateFolder getMoveRequest ( String id , String parentId ) { BoxRequestsFolder . UpdateFolder request = new BoxRequestsFolder . UpdateFolder ( id , getFolderInfoUrl ( id ) , mSession ) . setParentId ( parentId ) ; return request ; }
Gets a request that moves a folder to another folder
152,482
public BoxRequestsFolder . CopyFolder getCopyRequest ( String id , String parentId ) { BoxRequestsFolder . CopyFolder request = new BoxRequestsFolder . CopyFolder ( id , parentId , getFolderCopyUrl ( id ) , mSession ) ; return request ; }
Gets a request that copies a folder
152,483
public BoxRequestsFolder . GetCollaborations getCollaborationsRequest ( String id ) { BoxRequestsFolder . GetCollaborations request = new BoxRequestsFolder . GetCollaborations ( id , getFolderCollaborationsUrl ( id ) , mSession ) ; return request ; }
Gets a request that gets the collaborations of a folder
152,484
public BoxRequestsFolder . UpdateSharedFolder getCreateSharedLinkRequest ( String id ) { BoxRequestsFolder . UpdateSharedFolder request = new BoxRequestsFolder . UpdateSharedFolder ( id , getFolderInfoUrl ( id ) , mSession ) . setAccess ( null ) ; return request ; }
Gets a request that creates a shared link for a folder
152,485
public BoxRequestsFolder . AddFolderToCollection getAddToCollectionRequest ( String folderId , String collectionId ) { BoxRequestsFolder . AddFolderToCollection request = new BoxRequestsFolder . AddFolderToCollection ( folderId , collectionId , getFolderInfoUrl ( folderId ) , mSession ) ; return request ; }
Gets a request that adds a folder to a collection
152,486
public BoxRequestsFolder . DeleteFolderFromCollection getDeleteFromCollectionRequest ( String id ) { BoxRequestsFolder . DeleteFolderFromCollection request = new BoxRequestsFolder . DeleteFolderFromCollection ( id , getFolderInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that removes a folder from a collection
152,487
public BoxRequestsFolder . GetTrashedItems getTrashedItemsRequest ( ) { BoxRequestsFolder . GetTrashedItems request = new BoxRequestsFolder . GetTrashedItems ( getTrashedItemsUrl ( ) , mSession ) ; return request ; }
Gets a request that returns the items in the trash
152,488
public BoxRequestsFolder . GetTrashedFolder getTrashedFolderRequest ( String id ) { BoxRequestsFolder . GetTrashedFolder request = new BoxRequestsFolder . GetTrashedFolder ( id , getTrashedFolderUrl ( id ) , mSession ) ; return request ; }
Gets a request that returns a folder in the trash
152,489
public BoxRequestsFolder . DeleteTrashedFolder getDeleteTrashedFolderRequest ( String id ) { BoxRequestsFolder . DeleteTrashedFolder request = new BoxRequestsFolder . DeleteTrashedFolder ( id , getTrashedFolderUrl ( id ) , mSession ) ; return request ; }
Gets a request that permanently deletes a folder from the trash
152,490
public BoxRequestsFolder . RestoreTrashedFolder getRestoreTrashedFolderRequest ( String id ) { BoxRequestsFolder . RestoreTrashedFolder request = new BoxRequestsFolder . RestoreTrashedFolder ( id , getFolderInfoUrl ( id ) , mSession ) ; return request ; }
Gets a request that restores a trashed folder
152,491
public BoxRequestsShare . GetCollaborationInfo getInfoRequest ( String collaborationId ) { BoxRequestsShare . GetCollaborationInfo collab = new BoxRequestsShare . GetCollaborationInfo ( collaborationId , getCollaborationInfoUrl ( collaborationId ) , mSession ) ; return collab ; }
A request to retrieve a collaboration of a given id .
152,492
public BoxRequestsShare . AddCollaboration getAddRequest ( BoxCollaborationItem collaborationItem , BoxCollaboration . Role role , String login ) { BoxRequestsShare . AddCollaboration collab = new BoxRequestsShare . AddCollaboration ( getCollaborationsUrl ( ) , createStubItem ( collaborationItem ) , role , login , mSes...
A request that adds a user as a collaborator to an item by using their login .
152,493
public BoxRequestsShare . GetPendingCollaborations getPendingCollaborationsRequest ( ) { BoxRequestsShare . GetPendingCollaborations request = new BoxRequestsShare . GetPendingCollaborations ( getCollaborationsUrl ( ) , mSession ) ; return request ; }
A request to retrieve a list of pending collaborations for the user .
152,494
public BoxRequestsShare . DeleteCollaboration getDeleteRequest ( String collaborationId ) { BoxRequestsShare . DeleteCollaboration collab = new BoxRequestsShare . DeleteCollaboration ( collaborationId , getCollaborationInfoUrl ( collaborationId ) , mSession ) ; return collab ; }
A request to delete a collaboration with given collaboration id .
152,495
public BoxRequestsShare . UpdateOwner getUpdateOwnerRequest ( String collaborationId ) { BoxRequestsShare . UpdateOwner collab = new BoxRequestsShare . UpdateOwner ( collaborationId , getCollaborationInfoUrl ( collaborationId ) , mSession ) ; return collab ; }
A request to change role to owner given a collaboration id .
152,496
public static String format ( Date date ) { String format = LOCAL_DATE_FORMAT . format ( date ) ; return format . substring ( 0 , 22 ) + ":" + format . substring ( 22 ) ; }
Formats a date as a string that can be sent to the Box API .
152,497
public static String getTimeRangeString ( Date fromDate , Date toDate ) { if ( fromDate == null && toDate == null ) { return null ; } StringBuilder sbr = new StringBuilder ( ) ; if ( fromDate != null ) { sbr . append ( format ( fromDate ) ) ; } sbr . append ( "," ) ; if ( toDate != null ) { sbr . append ( format ( toDa...
Get a String to represent a time range .
152,498
public BoxError getAsBoxError ( ) { try { BoxError error = new BoxError ( ) ; error . createFromJson ( getResponse ( ) ) ; return error ; } catch ( Exception e ) { return null ; } }
Gets the server response as a BoxError .
152,499
public String getDescription ( ) { return mBodyMap . containsKey ( BoxItem . FIELD_DESCRIPTION ) ? ( String ) mBodyMap . get ( BoxItem . FIELD_DESCRIPTION ) : null ; }
Returns the new description currently set for the item .