idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
29,900 | public GitlabMergeRequest createMergeRequest ( Serializable projectId , String sourceBranch , String targetBranch , Integer assigneeId , String title ) throws IOException { Query query = new Query ( ) . appendIf ( "target_branch" , targetBranch ) . appendIf ( "source_branch" , sourceBranch ) . appendIf ( "assignee_id" , assigneeId ) . appendIf ( "title" , title ) ; String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabMergeRequest . URL + query . toString ( ) ; return dispatch ( ) . to ( tailUrl , GitlabMergeRequest . class ) ; } | Create a new MergeRequest |
29,901 | public GitlabMergeRequest updateMergeRequest ( Serializable projectId , Integer mergeRequestIid , String targetBranch , Integer assigneeId , String title , String description , String stateEvent , String labels ) throws IOException { Query query = new Query ( ) . appendIf ( "target_branch" , targetBranch ) . appendIf ( "assignee_id" , assigneeId ) . appendIf ( "title" , title ) . appendIf ( "description" , description ) . appendIf ( "state_event" , stateEvent ) . appendIf ( "labels" , labels ) ; String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabMergeRequest . URL + "/" + mergeRequestIid + query . toString ( ) ; return retrieve ( ) . method ( PUT ) . to ( tailUrl , GitlabMergeRequest . class ) ; } | Updates a Merge Request |
29,902 | public GitlabNote getNote ( GitlabMergeRequest mergeRequest , Integer noteId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabNote . URL + "/" + noteId ; return retrieve ( ) . to ( tailUrl , GitlabNote . class ) ; } | Get a Note from a Merge Request . |
29,903 | public GitlabDiscussion createDiscussion ( GitlabMergeRequest mergeRequest , String body , String positionBaseSha , String positionStartSha , String positionHeadSha ) throws IOException { return createTextDiscussion ( mergeRequest , body , null , positionBaseSha , positionStartSha , positionHeadSha , null , null , null , null ) ; } | Create a discussion just with the required arguments . |
29,904 | private void checkRequiredCreateDiscussionArguments ( String body , String positionBaseSha , String positionStartSha , String positionHeadSha ) { if ( body == null || body . isEmpty ( ) ) { throw new IllegalArgumentException ( "Missing required argument 'body'!" ) ; } else if ( positionBaseSha == null || positionBaseSha . isEmpty ( ) ) { throw new IllegalArgumentException ( "Missing required argument 'positionBaseSha'!" ) ; } else if ( positionStartSha == null || positionStartSha . isEmpty ( ) ) { throw new IllegalArgumentException ( "Missing required argument 'positionStartSha'!" ) ; } else if ( positionHeadSha == null || positionHeadSha . isEmpty ( ) ) { throw new IllegalArgumentException ( "Missing required argument 'positionHeadSha'!" ) ; } } | Check if the required arguments to create a discussion are present and contain values . |
29,905 | public GitlabDiscussion resolveDiscussion ( GitlabMergeRequest mergeRequest , int discussionId , boolean resolved ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabDiscussion . URL + "/" + discussionId ; return retrieve ( ) . method ( PUT ) . with ( "resolved" , resolved ) . to ( tailUrl , GitlabDiscussion . class ) ; } | Resolve or unresolve a whole discussion of a merge request . |
29,906 | public GitlabNote addDiscussionNote ( GitlabMergeRequest mergeRequest , int discussionId , String body ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabDiscussion . URL + "/" + discussionId + GitlabNote . URL ; return dispatch ( ) . with ( "body" , body ) . to ( tailUrl , GitlabNote . class ) ; } | Add a note to existing merge request discussion . |
29,907 | public GitlabNote modifyDiscussionNote ( GitlabMergeRequest mergeRequest , int discussionId , int noteId , String body , Boolean resolved ) throws IOException { boolean bodyHasValue = false ; if ( body != null && ! body . isEmpty ( ) ) { bodyHasValue = true ; } if ( ( ! bodyHasValue && resolved == null ) || ( bodyHasValue && resolved != null ) ) { throw new IllegalArgumentException ( "Exactly one of body or resolved must be set!" ) ; } String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabDiscussion . URL + "/" + discussionId + GitlabNote . URL + "/" + noteId ; return retrieve ( ) . method ( PUT ) . with ( "body" , body ) . with ( "resolved" , resolved ) . to ( tailUrl , GitlabNote . class ) ; } | Modify or resolve an existing discussion note of the given merge request . |
29,908 | public void deleteDiscussionNote ( GitlabMergeRequest mergeRequest , int discussionId , int noteId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabDiscussion . URL + "/" + discussionId + GitlabNote . URL + "/" + noteId ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete a discussion note of a merge request . |
29,909 | public GitlabSimpleRepositoryFile createRepositoryFile ( GitlabProject project , String path , String branchName , String commitMsg , String content ) throws IOException { String tailUrl = GitlabProject . URL + "/" + project . getId ( ) + "/repository/files/" + sanitizePath ( path ) ; GitlabHTTPRequestor requestor = dispatch ( ) ; return requestor . with ( "branch" , branchName ) . with ( "encoding" , "base64" ) . with ( "commit_message" , commitMsg ) . with ( "content" , content ) . to ( tailUrl , GitlabSimpleRepositoryFile . class ) ; } | Creates a new file in the repository |
29,910 | public GitlabSimpleRepositoryFile updateRepositoryFile ( GitlabProject project , String path , String branchName , String commitMsg , String content ) throws IOException { String tailUrl = GitlabProject . URL + "/" + project . getId ( ) + "/repository/files/" + sanitizePath ( path ) ; GitlabHTTPRequestor requestor = retrieve ( ) . method ( PUT ) ; return requestor . with ( "branch" , branchName ) . with ( "encoding" , "base64" ) . with ( "commit_message" , commitMsg ) . with ( "content" , content ) . to ( tailUrl , GitlabSimpleRepositoryFile . class ) ; } | Updates the content of an existing file in the repository |
29,911 | public void deleteRepositoryFile ( GitlabProject project , String path , String branchName , String commitMsg ) throws IOException { Query query = new Query ( ) . append ( "branch" , branchName ) . append ( "commit_message" , commitMsg ) ; String tailUrl = GitlabProject . URL + "/" + project . getId ( ) + "/repository/files/" + sanitizePath ( path ) + query . toString ( ) ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Deletes an existing file in the repository |
29,912 | public GitlabNote updateNote ( GitlabMergeRequest mergeRequest , Integer noteId , String body ) throws IOException { Query query = new Query ( ) . appendIf ( "body" , body ) ; String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabNote . URL + "/" + noteId + query . toString ( ) ; return retrieve ( ) . method ( PUT ) . to ( tailUrl , GitlabNote . class ) ; } | Update a Merge Request Note |
29,913 | public void deleteNote ( GitlabMergeRequest mergeRequest , GitlabNote noteToDelete ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabNote . URL + "/" + noteToDelete . getId ( ) ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , GitlabNote . class ) ; } | Delete a Merge Request Note |
29,914 | public void deleteBranch ( Serializable projectId , String branchName ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabBranch . URL + '/' + sanitizePath ( branchName ) ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete Branch . |
29,915 | public GitlabBadge getProjectBadge ( Serializable projectId , Integer badgeId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabBadge . URL + "/" + badgeId ; return retrieve ( ) . to ( tailUrl , GitlabBadge . class ) ; } | Get project badge |
29,916 | public GitlabBadge addProjectBadge ( Serializable projectId , String linkUrl , String imageUrl ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabBadge . URL ; return dispatch ( ) . with ( "link_url" , linkUrl ) . with ( "image_url" , imageUrl ) . to ( tailUrl , GitlabBadge . class ) ; } | Add project badge |
29,917 | public GitlabBadge editProjectBadge ( Serializable projectId , Integer badgeId , String linkUrl , String imageUrl ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabBadge . URL + "/" + badgeId ; GitlabHTTPRequestor requestor = retrieve ( ) . method ( PUT ) ; requestor . with ( "link_url" , linkUrl ) . with ( "image_url" , imageUrl ) ; return requestor . to ( tailUrl , GitlabBadge . class ) ; } | Edit project badge |
29,918 | public void deleteProjectBadge ( Serializable projectId , Integer badgeId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabBadge . URL + "/" + badgeId ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete project badge |
29,919 | public GitlabBadge getGroupBadge ( Integer groupId , Integer badgeId ) throws IOException { String tailUrl = GitlabGroup . URL + "/" + groupId + GitlabBadge . URL + "/" + badgeId ; return retrieve ( ) . to ( tailUrl , GitlabBadge . class ) ; } | Get group badge |
29,920 | public GitlabBadge addGroupBadge ( Integer groupId , String linkUrl , String imageUrl ) throws IOException { String tailUrl = GitlabGroup . URL + "/" + groupId + GitlabBadge . URL ; return dispatch ( ) . with ( "link_url" , linkUrl ) . with ( "image_url" , imageUrl ) . to ( tailUrl , GitlabBadge . class ) ; } | Add group badge |
29,921 | public GitlabBadge editGroupBadge ( Integer groupId , Integer badgeId , String linkUrl , String imageUrl ) throws IOException { String tailUrl = GitlabGroup . URL + "/" + groupId + GitlabBadge . URL + "/" + badgeId ; GitlabHTTPRequestor requestor = retrieve ( ) . method ( PUT ) ; requestor . with ( "link_url" , linkUrl ) . with ( "image_url" , imageUrl ) ; return requestor . to ( tailUrl , GitlabBadge . class ) ; } | Edit group badge |
29,922 | public void deleteGroupBadge ( Integer groupId , Integer badgeId ) throws IOException { String tailUrl = GitlabGroup . URL + "/" + groupId + GitlabBadge . URL + "/" + badgeId ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete group badge |
29,923 | public List < GitlabLabel > getLabels ( Serializable projectId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabLabel . URL ; GitlabLabel [ ] labels = retrieve ( ) . to ( tailUrl , GitlabLabel [ ] . class ) ; return Arrays . asList ( labels ) ; } | Gets labels associated with a project . |
29,924 | public GitlabLabel updateLabel ( Serializable projectId , String name , String newName , String newColor ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabLabel . URL ; GitlabHTTPRequestor requestor = retrieve ( ) . method ( PUT ) ; requestor . with ( "name" , name ) ; if ( newName != null ) { requestor . with ( "new_name" , newName ) ; } if ( newColor != null ) { requestor = requestor . with ( "color" , newColor ) ; } return requestor . to ( tailUrl , GitlabLabel . class ) ; } | Updates an existing label . |
29,925 | public GitlabMilestone createMilestone ( Serializable projectId , String title , String description , Date dueDate , Date startDate ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabMilestone . URL ; GitlabHTTPRequestor requestor = dispatch ( ) . with ( "title" , title ) ; SimpleDateFormat formatter = new SimpleDateFormat ( "yyyy-MM-dd" ) ; if ( description != null ) { requestor = requestor . with ( "description" , description ) ; } if ( dueDate != null ) { requestor = requestor . with ( "due_date" , formatter . format ( dueDate ) ) ; } if ( startDate != null ) { requestor = requestor . with ( "start_date" , formatter . format ( startDate ) ) ; } return requestor . to ( tailUrl , GitlabMilestone . class ) ; } | Cretaes a new project milestone . |
29,926 | public GitlabMilestone createMilestone ( Serializable projectId , GitlabMilestone milestone ) throws IOException { String title = milestone . getTitle ( ) ; String description = milestone . getDescription ( ) ; Date dateDue = milestone . getDueDate ( ) ; Date dateStart = milestone . getStartDate ( ) ; return createMilestone ( projectId , title , description , dateDue , dateStart ) ; } | Creates a new project milestone . |
29,927 | public List < GitlabProjectMember > getNamespaceMembers ( Integer namespaceId ) throws IOException { String tailUrl = GitlabGroup . URL + "/" + namespaceId + GitlabProjectMember . URL ; return Arrays . asList ( retrieve ( ) . to ( tailUrl , GitlabProjectMember [ ] . class ) ) ; } | This will fail if the given namespace is a user and not a group |
29,928 | public void transfer ( Integer namespaceId , Integer projectId ) throws IOException { Query query = new Query ( ) . append ( "namespace" , String . valueOf ( namespaceId ) ) ; String tailUrl = GitlabProject . URL + "/" + projectId + "/transfer" + query . toString ( ) ; retrieve ( ) . method ( PUT ) . to ( tailUrl , Void . class ) ; } | Transfer a project to the given namespace |
29,929 | public GitlabSSHKey createDeployKey ( Integer targetProjectId , String title , String key ) throws IOException { return createDeployKey ( targetProjectId , title , key , false ) ; } | Create a new deploy key for the project |
29,930 | public GitlabSSHKey createPushDeployKey ( Integer targetProjectId , String title , String key ) throws IOException { return createDeployKey ( targetProjectId , title , key , true ) ; } | Create a new deploy key for the project which can push . |
29,931 | public void deleteDeployKey ( Integer targetProjectId , Integer targetKeyId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + targetProjectId + GitlabSSHKey . DEPLOY_KEYS_URL + "/" + targetKeyId ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete a deploy key for a project |
29,932 | public List < GitlabSSHKey > getDeployKeys ( Integer targetProjectId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + targetProjectId + GitlabSSHKey . DEPLOY_KEYS_URL ; return Arrays . asList ( retrieve ( ) . to ( tailUrl , GitlabSSHKey [ ] . class ) ) ; } | Gets all deploy keys for a project |
29,933 | public List < GitlabSystemHook > getSystemHooks ( ) throws IOException { String tailUrl = GitlabSystemHook . URL ; return Arrays . asList ( retrieve ( ) . to ( tailUrl , GitlabSystemHook [ ] . class ) ) ; } | Get list of system hooks |
29,934 | public GitlabSystemHook addSystemHook ( String url ) throws IOException { String tailUrl = GitlabSystemHook . URL ; return dispatch ( ) . with ( "url" , url ) . to ( tailUrl , GitlabSystemHook . class ) ; } | Add new system hook hook |
29,935 | public GitlabSystemHook deleteSystemHook ( Integer hookId ) throws IOException { String tailUrl = GitlabSystemHook . URL + "/" + hookId ; return retrieve ( ) . method ( DELETE ) . to ( tailUrl , GitlabSystemHook . class ) ; } | Delete system hook |
29,936 | public CommitComment createCommitComment ( Serializable projectId , String sha , String note , String path , String line , String line_type ) throws IOException { Query query = new Query ( ) . append ( "id" , projectId . toString ( ) ) . appendIf ( "sha" , sha ) . appendIf ( "note" , note ) . appendIf ( "path" , path ) . appendIf ( "line" , line ) . appendIf ( "line_type" , line_type ) ; String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + "/repository/commits/" + sha + CommitComment . URL + query . toString ( ) ; return dispatch ( ) . to ( tailUrl , CommitComment . class ) ; } | Post comment to commit |
29,937 | public List < CommitComment > getCommitComments ( Integer projectId , String sha ) throws IOException { String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + "/repository/commits/" + sha + CommitComment . URL ; return Arrays . asList ( retrieve ( ) . to ( tailUrl , CommitComment [ ] . class ) ) ; } | Get the comments of a commit |
29,938 | public GitlabTag getTag ( GitlabProject project , String tagName ) throws IOException { String tailUrl = GitlabProject . URL + "/" + project . getId ( ) + GitlabTag . URL + "/" + tagName ; return retrieve ( ) . to ( tailUrl , GitlabTag . class ) ; } | Get a single repository tag in a specific project |
29,939 | public List < GitlabAward > getAllAwards ( GitlabMergeRequest mergeRequest ) { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabAward . URL + PARAM_MAX_ITEMS_PER_PAGE ; return retrieve ( ) . getAll ( tailUrl , GitlabAward [ ] . class ) ; } | Get all awards for a merge request |
29,940 | public GitlabAward getAward ( GitlabMergeRequest mergeRequest , Integer awardId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabAward . URL + "/" + awardId ; return retrieve ( ) . to ( tailUrl , GitlabAward . class ) ; } | Get a specific award for a merge request |
29,941 | public GitlabAward createAward ( GitlabMergeRequest mergeRequest , String awardName ) throws IOException { Query query = new Query ( ) . append ( "name" , awardName ) ; String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabAward . URL + query . toString ( ) ; return dispatch ( ) . to ( tailUrl , GitlabAward . class ) ; } | Create an award for a merge request |
29,942 | public void deleteAward ( GitlabMergeRequest mergeRequest , GitlabAward award ) throws IOException { String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabAward . URL + "/" + award . getId ( ) ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete an award for a merge request |
29,943 | public List < GitlabAward > getAllAwards ( GitlabIssue issue ) { String tailUrl = GitlabProject . URL + "/" + issue . getProjectId ( ) + GitlabIssue . URL + "/" + issue . getId ( ) + GitlabAward . URL + PARAM_MAX_ITEMS_PER_PAGE ; return retrieve ( ) . getAll ( tailUrl , GitlabAward [ ] . class ) ; } | Get all awards for an issue |
29,944 | public GitlabAward getAward ( GitlabIssue issue , Integer awardId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + issue . getProjectId ( ) + GitlabIssue . URL + "/" + issue . getId ( ) + GitlabAward . URL + "/" + awardId ; return retrieve ( ) . to ( tailUrl , GitlabAward . class ) ; } | Get a specific award for an issue |
29,945 | public GitlabAward createAward ( GitlabIssue issue , Integer noteId , String awardName ) throws IOException { Query query = new Query ( ) . append ( "name" , awardName ) ; String tailUrl = GitlabProject . URL + "/" + issue . getProjectId ( ) + GitlabIssue . URL + "/" + issue . getId ( ) + GitlabNote . URL + noteId + GitlabAward . URL + query . toString ( ) ; return dispatch ( ) . to ( tailUrl , GitlabAward . class ) ; } | Create an award for an issue note |
29,946 | public void deleteAward ( GitlabIssue issue , Integer noteId , GitlabAward award ) throws IOException { String tailUrl = GitlabProject . URL + "/" + issue . getProjectId ( ) + GitlabIssue . URL + "/" + issue . getId ( ) + GitlabNote . URL + noteId + GitlabAward . URL + "/" + award . getId ( ) ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; } | Delete an award for an issue note |
29,947 | public List < GitlabBuildVariable > getBuildVariables ( Integer projectId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + projectId + GitlabBuildVariable . URL ; GitlabBuildVariable [ ] variables = retrieve ( ) . to ( tailUrl , GitlabBuildVariable [ ] . class ) ; return Arrays . asList ( variables ) ; } | Gets build variables associated with a project . |
29,948 | public GitlabBuildVariable createBuildVariable ( Integer projectId , String key , String value ) throws IOException { String tailUrl = GitlabProject . URL + "/" + projectId + GitlabBuildVariable . URL ; return dispatch ( ) . with ( "key" , key ) . with ( "value" , value ) . to ( tailUrl , GitlabBuildVariable . class ) ; } | Creates a new build variable . |
29,949 | public GitlabBuildVariable createBuildVariable ( Integer projectId , GitlabBuildVariable variable ) throws IOException { String key = variable . getKey ( ) ; String value = variable . getValue ( ) ; return createBuildVariable ( projectId , key , value ) ; } | Creates a new variable . |
29,950 | public GitlabBuildVariable updateBuildVariable ( Integer projectId , String key , String newValue ) throws IOException { String tailUrl = GitlabProject . URL + "/" + projectId + GitlabBuildVariable . URL + "/" + key ; GitlabHTTPRequestor requestor = retrieve ( ) . method ( PUT ) ; if ( newValue != null ) { requestor = requestor . with ( "value" , newValue ) ; } return requestor . to ( tailUrl , GitlabBuildVariable . class ) ; } | Updates an existing variable . |
29,951 | public List < GitlabTrigger > getPipelineTriggers ( GitlabProject project ) { if ( ! project . isJobsEnabled ( ) ) { throw new IllegalStateException ( "Jobs are not enabled for " + project . getNameWithNamespace ( ) ) ; } else { return retrieve ( ) . getAll ( GitlabProject . URL + "/" + project . getId ( ) + GitlabTrigger . URL + PARAM_MAX_ITEMS_PER_PAGE , GitlabTrigger [ ] . class ) ; } } | Returns the list of build triggers for a project . |
29,952 | public GitlabServiceEmailOnPush getEmailsOnPush ( Integer projectId ) throws IOException { String tailUrl = GitlabProject . URL + "/" + projectId + GitlabServiceEmailOnPush . URL ; return retrieve ( ) . to ( tailUrl , GitlabServiceEmailOnPush . class ) ; } | Gets email - on - push service setup for a projectId . |
29,953 | public boolean updateEmailsOnPush ( Integer projectId , String emailAddress ) throws IOException { GitlabServiceEmailOnPush emailOnPush = this . getEmailsOnPush ( projectId ) ; GitlabEmailonPushProperties properties = emailOnPush . getProperties ( ) ; String appendedRecipients = properties . getRecipients ( ) ; if ( appendedRecipients != "" ) { if ( appendedRecipients . contains ( emailAddress ) ) return true ; appendedRecipients = appendedRecipients + " " + emailAddress ; } else appendedRecipients = emailAddress ; Query query = new Query ( ) . appendIf ( "active" , true ) . appendIf ( "recipients" , appendedRecipients ) ; String tailUrl = GitlabProject . URL + "/" + projectId + GitlabServiceEmailOnPush . URL + query . toString ( ) ; return retrieve ( ) . method ( PUT ) . to ( tailUrl , Boolean . class ) ; } | Update recipients for email - on - push service for a projectId . |
29,954 | public List < GitlabProject > searchProjects ( String search ) throws IOException { Query query = new Query ( ) . append ( "search" , search ) ; String tailUrl = GitlabProject . URL + query . toString ( ) ; GitlabProject [ ] response = retrieve ( ) . to ( tailUrl , GitlabProject [ ] . class ) ; return Arrays . asList ( response ) ; } | Get a list of projects accessible by the authenticated user by search . |
29,955 | public void shareProjectWithGroup ( GitlabAccessLevel accessLevel , String expiration , GitlabGroup group , GitlabProject project ) throws IOException { Query query = new Query ( ) . append ( "group_id" , group . getId ( ) . toString ( ) ) . append ( "group_access" , String . valueOf ( accessLevel . accessValue ) ) . appendIf ( "expires_at" , expiration ) ; String tailUrl = GitlabProject . URL + "/" + project . getId ( ) + "/share" + query . toString ( ) ; dispatch ( ) . to ( tailUrl , Void . class ) ; } | Share a project with a group . |
29,956 | public List < GitlabRunner > getRunners ( GitlabRunner . RunnerScope scope ) throws IOException { return getRunnersWithPagination ( scope , null ) ; } | Returns a List of GitlabRunners . |
29,957 | public GitlabRunner getRunnerDetail ( int id ) throws IOException { String tailUrl = String . format ( "%s/%d" , GitlabRunner . URL , id ) ; return retrieve ( ) . to ( tailUrl , GitlabRunner . class ) ; } | Get details information of the runner with the specified id . |
29,958 | public Query append ( final String name , final String value ) throws UnsupportedEncodingException { params . add ( new Tuple < String , Tuple < String , String > > ( name , new Tuple < String , String > ( value , URLEncoder . encode ( value , "UTF-8" ) ) ) ) ; return this ; } | Appends a parameter to the query |
29,959 | public Query toQuery ( ) throws UnsupportedEncodingException { return new Query ( ) . append ( "name" , name ) . append ( "path" , path ) . appendIf ( "ldap_cn" , ldapCn ) . appendIf ( "description" , description ) . appendIf ( "membershipLock" , membershipLock ) . appendIf ( "share_with_group_lock" , shareWithGroupLock ) . appendIf ( "visibility" , visibility != null ? visibility . toString ( ) : null ) . appendIf ( "lfs_enabled" , lfsEnabled ) . appendIf ( "request_access_enabled" , requestAccessEnabled ) . appendIf ( "parent_id" , parentId ) ; } | Generates query representing this request s properties . |
29,960 | private void setDecodedBitmap ( Bitmap bitmap ) { if ( mState != State . DECODING ) { mBitmap = null ; return ; } mBitmap = bitmap ; mState = State . DECODED ; mDrawingView . setDirty ( ) ; } | otherwise set bitmap update state send to memory cache and notify drawing view |
29,961 | public void destroy ( boolean removeFromQueue ) { if ( mState == State . IDLE ) { return ; } if ( removeFromQueue ) { mThreadPoolExecutor . remove ( this ) ; } if ( mState == State . DECODED ) { mMemoryCache . put ( getCacheKey ( ) , mBitmap ) ; } mBitmap = null ; mDrawingOptions . inBitmap = null ; mCacheKey = null ; mState = State . IDLE ; mListener . onTileDestroyed ( this ) ; } | we use this signature to call from the Executor so it can remove tiles via iterator |
29,962 | public boolean onGenericMotionEvent ( MotionEvent event ) { if ( ( event . getSource ( ) & InputDevice . SOURCE_CLASS_POINTER ) != 0 ) { switch ( event . getAction ( ) ) { case MotionEvent . ACTION_SCROLL : { if ( ! mIsBeingDragged ) { final float vscroll = event . getAxisValue ( MotionEvent . AXIS_VSCROLL ) ; final float hscroll = event . getAxisValue ( MotionEvent . AXIS_HSCROLL ) ; if ( vscroll != 0 ) { final int verticalScrollRange = getVerticalScrollRange ( ) ; final int horizontalScrollRange = getHorizontalScrollRange ( ) ; int oldScrollY = getScrollY ( ) ; int oldScrollX = getScrollX ( ) ; int newScrollY = ( int ) ( oldScrollY - vscroll ) ; int newScrollX = ( int ) ( oldScrollX - hscroll ) ; if ( newScrollY < 0 ) { newScrollY = 0 ; } else if ( newScrollY > verticalScrollRange ) { newScrollY = verticalScrollRange ; } if ( newScrollX < 0 ) { newScrollX = 0 ; } else if ( newScrollX > horizontalScrollRange ) { newScrollX = horizontalScrollRange ; } if ( newScrollY != oldScrollY || newScrollX != oldScrollX ) { super . scrollTo ( newScrollX , newScrollY ) ; return true ; } } } } } } return super . onGenericMotionEvent ( event ) ; } | INPUT & ACCESSIBILITY |
29,963 | public void updateScale ( float verticalDragOffset ) { ViewHelper . setScaleX ( getView ( ) , 1 - verticalDragOffset / getXScaleFactor ( ) ) ; ViewHelper . setScaleY ( getView ( ) , 1 - verticalDragOffset / getYScaleFactor ( ) ) ; } | Uses Nineoldandroids to change the scale . |
29,964 | public void updatePosition ( float verticalDragOffset ) { ViewHelper . setPivotX ( getView ( ) , getView ( ) . getWidth ( ) - getMarginRight ( ) ) ; ViewHelper . setPivotY ( getView ( ) , getView ( ) . getHeight ( ) - getMarginBottom ( ) ) ; } | Uses Nineoldandroids to change the position of the view . |
29,965 | public void onViewPositionChanged ( View changedView , int left , int top , int dx , int dy ) { if ( draggableView . isDragViewAtBottom ( ) ) { draggableView . changeDragViewViewAlpha ( ) ; } else { draggableView . restoreAlpha ( ) ; draggableView . changeDragViewScale ( ) ; draggableView . changeDragViewPosition ( ) ; draggableView . changeSecondViewAlpha ( ) ; draggableView . changeSecondViewPosition ( ) ; draggableView . changeBackgroundAlpha ( ) ; } } | Override method used to apply different scale and alpha effects while the view is being dragged . |
29,966 | public void onViewReleased ( View releasedChild , float xVel , float yVel ) { super . onViewReleased ( releasedChild , xVel , yVel ) ; if ( draggableView . isDragViewAtBottom ( ) && ! draggableView . isDragViewAtRight ( ) ) { triggerOnReleaseActionsWhileHorizontalDrag ( xVel ) ; } else { triggerOnReleaseActionsWhileVerticalDrag ( yVel ) ; } } | Override method used to apply different animations when the dragged view is released . The dragged view is going to be maximized or minimized if the view is above the middle of the custom view and the velocity is greater than a constant value . |
29,967 | public int clampViewPositionHorizontal ( View child , int left , int dx ) { int newLeft = draggedView . getLeft ( ) ; if ( ( draggableView . isMinimized ( ) && Math . abs ( dx ) > MINIMUM_DX_FOR_HORIZONTAL_DRAG ) || ( draggableView . isDragViewAtBottom ( ) && ! draggableView . isDragViewAtRight ( ) ) ) { newLeft = left ; } return newLeft ; } | Override method used to configure the horizontal drag . Restrict the motion of the dragged child view along the horizontal axis . |
29,968 | public int clampViewPositionVertical ( View child , int top , int dy ) { int newTop = draggableView . getHeight ( ) - draggableView . getDraggedViewHeightPlusMarginTop ( ) ; if ( draggableView . isMinimized ( ) && Math . abs ( dy ) >= MINIMUM_DY_FOR_VERTICAL_DRAG || ( ! draggableView . isMinimized ( ) && ! draggableView . isDragViewAtBottom ( ) ) ) { final int topBound = draggableView . getPaddingTop ( ) ; final int bottomBound = draggableView . getHeight ( ) - draggableView . getDraggedViewHeightPlusMarginTop ( ) - draggedView . getPaddingBottom ( ) ; newTop = Math . min ( Math . max ( top , topBound ) , bottomBound ) ; } return newTop ; } | Override method used to configure the vertical drag . Restrict the motion of the dragged child view along the vertical axis . |
29,969 | private void triggerOnReleaseActionsWhileVerticalDrag ( float yVel ) { if ( yVel < 0 && yVel <= - Y_MIN_VELOCITY ) { draggableView . maximize ( ) ; } else if ( yVel > 0 && yVel >= Y_MIN_VELOCITY ) { draggableView . minimize ( ) ; } else { if ( draggableView . isDragViewAboveTheMiddle ( ) ) { draggableView . maximize ( ) ; } else { draggableView . minimize ( ) ; } } } | Maximize or minimize the DraggableView using the draggableView position and the y axis velocity . |
29,970 | private void triggerOnReleaseActionsWhileHorizontalDrag ( float xVel ) { if ( xVel < 0 && xVel <= - X_MIN_VELOCITY ) { draggableView . closeToLeft ( ) ; } else if ( xVel > 0 && xVel >= X_MIN_VELOCITY ) { draggableView . closeToRight ( ) ; } else { if ( draggableView . isNextToLeftBound ( ) ) { draggableView . closeToLeft ( ) ; } else if ( draggableView . isNextToRightBound ( ) ) { draggableView . closeToRight ( ) ; } else { draggableView . minimize ( ) ; } } } | Close the view to the right to the left or minimize it using the draggableView position and the x axis velocity . |
29,971 | private void initializeYoutubeFragment ( ) { youtubeFragment = new YouTubePlayerSupportFragment ( ) ; youtubeFragment . initialize ( YOUTUBE_API_KEY , new YouTubePlayer . OnInitializedListener ( ) { public void onInitializationSuccess ( YouTubePlayer . Provider provider , YouTubePlayer player , boolean wasRestored ) { if ( ! wasRestored ) { youtubePlayer = player ; youtubePlayer . loadVideo ( VIDEO_KEY ) ; youtubePlayer . setShowFullscreenButton ( true ) ; } } public void onInitializationFailure ( YouTubePlayer . Provider provider , YouTubeInitializationResult error ) { } } ) ; } | Initialize the YouTubeSupportFrament attached as top fragment to the DraggablePanel widget and reproduce the YouTube video represented with a YouTube url . |
29,972 | private void initializeDraggablePanel ( ) { draggablePanel . setFragmentManager ( getSupportFragmentManager ( ) ) ; draggablePanel . setTopFragment ( youtubeFragment ) ; MoviePosterFragment moviePosterFragment = new MoviePosterFragment ( ) ; moviePosterFragment . setPoster ( VIDEO_POSTER_THUMBNAIL ) ; moviePosterFragment . setPosterTitle ( VIDEO_POSTER_TITLE ) ; draggablePanel . setBottomFragment ( moviePosterFragment ) ; draggablePanel . initializeView ( ) ; Picasso . with ( this ) . load ( SECOND_VIDEO_POSTER_THUMBNAIL ) . placeholder ( R . drawable . xmen_placeholder ) . into ( thumbnailImageView ) ; } | Initialize and configure the DraggablePanel widget with two fragments and some attributes . |
29,973 | private void hookDraggablePanelListeners ( ) { draggablePanel . setDraggableListener ( new DraggableListener ( ) { public void onMaximized ( ) { playVideo ( ) ; } public void onMinimized ( ) { } public void onClosedToLeft ( ) { pauseVideo ( ) ; } public void onClosedToRight ( ) { pauseVideo ( ) ; } } ) ; } | Hook the DraggableListener to DraggablePanel to pause or resume the video when the DragglabePanel is maximized or closed . |
29,974 | @ OnClick ( R . id . iv_thumbnail ) void onThubmnailClicked ( ) { Toast . makeText ( this , VIDEO_TITLE , Toast . LENGTH_SHORT ) . show ( ) ; } | Method triggered when the iv_thumbnail widget is clicked . This method shows a toast with the video title . |
29,975 | private void hookDraggableViewListener ( ) { draggableView . setDraggableListener ( new DraggableListener ( ) { public void onMaximized ( ) { startVideo ( ) ; } public void onMinimized ( ) { } public void onClosedToLeft ( ) { pauseVideo ( ) ; } public void onClosedToRight ( ) { pauseVideo ( ) ; } } ) ; } | Hook DraggableListener to draggableView to pause or resume VideoView . |
29,976 | private void initializeVideoView ( ) { Uri path = Uri . parse ( APPLICATION_RAW_PATH + R . raw . video ) ; videoView . setVideoURI ( path ) ; videoView . start ( ) ; } | Initialize ViedeoView with a video by default . |
29,977 | private void initializePoster ( ) { Picasso . with ( this ) . load ( VIDEO_POSTER ) . placeholder ( R . drawable . spiderman_placeholder ) . into ( posterImageView ) ; Picasso . with ( this ) . load ( VIDEO_THUMBNAIL ) . placeholder ( R . drawable . spiderman_placeholder ) . into ( thumbnailImageView ) ; } | Initialize some ImageViews with a video poster and a video thumbnail . |
29,978 | @ OnClick ( R . id . iv_fan_art ) void onFanArtClicked ( ) { Toast . makeText ( this , tvShowSelected . getTitle ( ) , Toast . LENGTH_LONG ) . show ( ) ; } | Method triggered when the iv_fan_art widget is clicked . This method shows a toast with the tv show selected . |
29,979 | private void initializeDraggableView ( ) { Handler handler = new Handler ( ) ; handler . postDelayed ( new Runnable ( ) { public void run ( ) { draggableView . setVisibility ( View . GONE ) ; draggableView . closeToRight ( ) ; } } , DELAY_MILLIS ) ; } | Initialize DraggableView . |
29,980 | private void initializeGridView ( ) { tvShowsGridView . setAdapter ( adapter ) ; tvShowsGridView . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > adapterView , View view , int position , long id ) { TvShowViewModel tvShow = adapter . getItem ( position ) ; tvShowSelected = tvShow ; Picasso . with ( getBaseContext ( ) ) . load ( tvShow . getFanArt ( ) ) . placeholder ( R . drawable . tv_show_placeholder ) . into ( fanArtImageView ) ; renderEpisodesHeader ( tvShow ) ; renderEpisodes ( tvShow ) ; draggableView . setVisibility ( View . VISIBLE ) ; draggableView . maximize ( ) ; } } ) ; } | Initialize GridView with some injected data and configure OnItemClickListener . |
29,981 | private void hookListeners ( ) { draggableView . setDraggableListener ( new DraggableListener ( ) { public void onMaximized ( ) { updateActionBarTitle ( ) ; } public void onMinimized ( ) { updateActionBarTitle ( ) ; } public void onClosedToLeft ( ) { resetActionBarTitle ( ) ; } public void onClosedToRight ( ) { resetActionBarTitle ( ) ; } } ) ; } | Hook DraggableListener to draggableView to modify action bar title with the tv show information . |
29,982 | private void renderEpisodes ( final TvShowViewModel tvShow ) { List < Renderer < EpisodeViewModel > > episodeRenderers = new LinkedList < Renderer < EpisodeViewModel > > ( ) ; episodeRenderers . add ( new EpisodeRenderer ( ) ) ; EpisodeRendererBuilder episodeRendererBuilder = new EpisodeRendererBuilder ( episodeRenderers ) ; EpisodeRendererAdapter episodesAdapter = new EpisodeRendererAdapter ( getLayoutInflater ( ) , episodeRendererBuilder , tvShow . getEpisodes ( ) ) ; episodesListView . setAdapter ( episodesAdapter ) ; } | Render a list of episodes using a tv show view model with the information . This method create an adapter with the episodes information to be inserted in the ListView . |
29,983 | private void renderEpisodesHeader ( TvShowViewModel tvShow ) { episodesListView . removeHeaderView ( header ) ; header = ( TextView ) getLayoutInflater ( ) . inflate ( R . layout . episode_header , null ) ; header . setText ( tvShow . getTitle ( ) . toUpperCase ( ) + " - SEASON 1" ) ; episodesListView . setAdapter ( null ) ; episodesListView . addHeaderView ( header ) ; episodesListView . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > adapterView , View view , int position , long id ) { if ( tvShowSelected != null ) { if ( position > 0 ) { EpisodeViewModel episodeViewModel = tvShowSelected . getEpisodes ( ) . get ( position - 1 ) ; Toast . makeText ( getBaseContext ( ) , tvShowSelected . getTitle ( ) + " - " + episodeViewModel . getTitle ( ) , Toast . LENGTH_LONG ) . show ( ) ; } } } } ) ; } | Configure a view as episodes ListView header with the name of the tv show and the season . |
29,984 | protected void render ( ) { PlaceViewModel place = getContent ( ) ; nameTextView . setText ( place . getName ( ) ) ; Picasso . with ( context ) . load ( place . getPhoto ( ) ) . placeholder ( R . drawable . maps_placeholder ) . into ( photoImageView ) ; } | Render the PlaceViewModel information . |
29,985 | public void closeToRight ( ) { if ( viewDragHelper . smoothSlideViewTo ( dragView , transformer . getOriginalWidth ( ) , getHeight ( ) - transformer . getMinHeightPlusMargin ( ) ) ) { ViewCompat . postInvalidateOnAnimation ( this ) ; notifyCloseToRightListener ( ) ; } } | Close the custom view applying an animation to close the view to the right side of the screen . |
29,986 | public void closeToLeft ( ) { if ( viewDragHelper . smoothSlideViewTo ( dragView , - transformer . getOriginalWidth ( ) , getHeight ( ) - transformer . getMinHeightPlusMargin ( ) ) ) { ViewCompat . postInvalidateOnAnimation ( this ) ; notifyCloseToLeftListener ( ) ; } } | Close the custom view applying an animation to close the view to the left side of the screen . |
29,987 | public boolean onInterceptTouchEvent ( MotionEvent ev ) { if ( ! isEnabled ( ) ) { return false ; } switch ( MotionEventCompat . getActionMasked ( ev ) & MotionEventCompat . ACTION_MASK ) { case MotionEvent . ACTION_CANCEL : case MotionEvent . ACTION_UP : viewDragHelper . cancel ( ) ; return false ; case MotionEvent . ACTION_DOWN : int index = MotionEventCompat . getActionIndex ( ev ) ; activePointerId = MotionEventCompat . getPointerId ( ev , index ) ; if ( activePointerId == INVALID_POINTER ) { return false ; } break ; default : break ; } boolean interceptTap = viewDragHelper . isViewUnder ( dragView , ( int ) ev . getX ( ) , ( int ) ev . getY ( ) ) ; return viewDragHelper . shouldInterceptTouchEvent ( ev ) || interceptTap ; } | Override method to intercept only touch events over the drag view and to cancel the drag when the action associated to the MotionEvent is equals to ACTION_CANCEL or ACTION_UP . |
29,988 | public boolean onTouchEvent ( MotionEvent ev ) { int actionMasked = MotionEventCompat . getActionMasked ( ev ) ; if ( ( actionMasked & MotionEventCompat . ACTION_MASK ) == MotionEvent . ACTION_DOWN ) { activePointerId = MotionEventCompat . getPointerId ( ev , actionMasked ) ; } if ( activePointerId == INVALID_POINTER ) { return false ; } viewDragHelper . processTouchEvent ( ev ) ; if ( isClosed ( ) ) { return false ; } boolean isDragViewHit = isViewHit ( dragView , ( int ) ev . getX ( ) , ( int ) ev . getY ( ) ) ; boolean isSecondViewHit = isViewHit ( secondView , ( int ) ev . getX ( ) , ( int ) ev . getY ( ) ) ; analyzeTouchToMaximizeIfNeeded ( ev , isDragViewHit ) ; if ( isMaximized ( ) ) { dragView . dispatchTouchEvent ( ev ) ; } else { dragView . dispatchTouchEvent ( cloneMotionEventWithAction ( ev , MotionEvent . ACTION_CANCEL ) ) ; } return isDragViewHit || isSecondViewHit ; } | Override method to dispatch touch event to the dragged view . |
29,989 | protected void onLayout ( boolean changed , int left , int top , int right , int bottom ) { if ( isInEditMode ( ) ) super . onLayout ( changed , left , top , right , bottom ) ; else if ( isDragViewAtTop ( ) ) { dragView . layout ( left , top , right , transformer . getOriginalHeight ( ) ) ; secondView . layout ( left , transformer . getOriginalHeight ( ) , right , bottom ) ; ViewHelper . setY ( dragView , top ) ; ViewHelper . setY ( secondView , transformer . getOriginalHeight ( ) ) ; } else { secondView . layout ( left , transformer . getOriginalHeight ( ) , right , bottom ) ; } } | Override method to configure the dragged view and secondView layout properly . |
29,990 | void changeBackgroundAlpha ( ) { Drawable background = getBackground ( ) ; if ( background != null ) { int newAlpha = ( int ) ( ONE_HUNDRED * ( 1 - getVerticalDragOffset ( ) ) ) ; background . setAlpha ( newAlpha ) ; } } | Modify the background alpha if has been configured to applying an alpha effect when the view is dragged . |
29,991 | void changeDragViewViewAlpha ( ) { if ( enableHorizontalAlphaEffect ) { float alpha = 1 - getHorizontalDragOffset ( ) ; if ( alpha == 0 ) { alpha = 1 ; } ViewHelper . setAlpha ( dragView , alpha ) ; } } | Modify dragged view alpha based on the horizontal position while the view is being horizontally dragged . |
29,992 | private boolean isViewHit ( View view , int x , int y ) { int [ ] viewLocation = new int [ 2 ] ; view . getLocationOnScreen ( viewLocation ) ; int [ ] parentLocation = new int [ 2 ] ; this . getLocationOnScreen ( parentLocation ) ; int screenX = parentLocation [ 0 ] + x ; int screenY = parentLocation [ 1 ] + y ; return screenX >= viewLocation [ 0 ] && screenX < viewLocation [ 0 ] + view . getWidth ( ) && screenY >= viewLocation [ 1 ] && screenY < viewLocation [ 1 ] + view . getHeight ( ) ; } | Calculate if one position is above any view . |
29,993 | private void addFragmentToView ( final int viewId , final Fragment fragment ) { fragmentManager . beginTransaction ( ) . replace ( viewId , fragment ) . commit ( ) ; } | Use FragmentManager to attach one fragment to one view using the viewId . |
29,994 | private void initializeAttributes ( AttributeSet attrs ) { TypedArray attributes = getContext ( ) . obtainStyledAttributes ( attrs , R . styleable . draggable_view ) ; this . enableHorizontalAlphaEffect = attributes . getBoolean ( R . styleable . draggable_view_enable_minimized_horizontal_alpha_effect , DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT ) ; this . enableClickToMaximize = attributes . getBoolean ( R . styleable . draggable_view_enable_click_to_maximize_view , DEFAULT_ENABLE_CLICK_TO_MAXIMIZE ) ; this . enableClickToMinimize = attributes . getBoolean ( R . styleable . draggable_view_enable_click_to_minimize_view , DEFAULT_ENABLE_CLICK_TO_MINIMIZE ) ; this . topViewResize = attributes . getBoolean ( R . styleable . draggable_view_top_view_resize , DEFAULT_TOP_VIEW_RESIZE ) ; this . topViewHeight = attributes . getDimensionPixelSize ( R . styleable . draggable_view_top_view_height , DEFAULT_TOP_VIEW_HEIGHT ) ; this . scaleFactorX = attributes . getFloat ( R . styleable . draggable_view_top_view_x_scale_factor , DEFAULT_SCALE_FACTOR ) ; this . scaleFactorY = attributes . getFloat ( R . styleable . draggable_view_top_view_y_scale_factor , DEFAULT_SCALE_FACTOR ) ; this . marginBottom = attributes . getDimensionPixelSize ( R . styleable . draggable_view_top_view_margin_bottom , DEFAULT_TOP_VIEW_MARGIN ) ; this . marginRight = attributes . getDimensionPixelSize ( R . styleable . draggable_view_top_view_margin_right , DEFAULT_TOP_VIEW_MARGIN ) ; this . dragViewId = attributes . getResourceId ( R . styleable . draggable_view_top_view_id , R . id . drag_view ) ; this . secondViewId = attributes . getResourceId ( R . styleable . draggable_view_bottom_view_id , R . id . second_view ) ; attributes . recycle ( ) ; } | Initialize XML attributes . |
29,995 | private boolean smoothSlideTo ( float slideOffset ) { final int topBound = getPaddingTop ( ) ; int x = ( int ) ( slideOffset * ( getWidth ( ) - transformer . getMinWidthPlusMarginRight ( ) ) ) ; int y = ( int ) ( topBound + slideOffset * getVerticalDragRange ( ) ) ; if ( viewDragHelper . smoothSlideViewTo ( dragView , x , y ) ) { ViewCompat . postInvalidateOnAnimation ( this ) ; return true ; } return false ; } | Realize an smooth slide to an slide offset passed as argument . This method is the base of maximize minimize and close methods . |
29,996 | protected void render ( ) { TvShowViewModel tvShow = getContent ( ) ; Picasso . with ( context ) . load ( tvShow . getPoster ( ) ) . placeholder ( R . drawable . tv_show_placeholder ) . into ( thumbnailImageView ) ; titleTextView . setText ( tvShow . getTitle ( ) . toUpperCase ( ) ) ; seasonsCounterTextView . setText ( tvShow . getNumberOfSeasons ( ) + " seasons" ) ; } | Render the TvShowViewModel information . |
29,997 | public void updateScale ( float verticalDragOffset ) { layoutParams . width = ( int ) ( getOriginalWidth ( ) * ( 1 - verticalDragOffset / getXScaleFactor ( ) ) ) ; layoutParams . height = ( int ) ( getOriginalHeight ( ) * ( 1 - verticalDragOffset / getYScaleFactor ( ) ) ) ; getView ( ) . setLayoutParams ( layoutParams ) ; } | Changes view scale using view s LayoutParam . |
29,998 | private void initializeAttrs ( AttributeSet attrs ) { TypedArray attributes = getContext ( ) . obtainStyledAttributes ( attrs , R . styleable . draggable_panel ) ; this . topFragmentHeight = attributes . getDimensionPixelSize ( R . styleable . draggable_panel_top_fragment_height , DEFAULT_TOP_FRAGMENT_HEIGHT ) ; this . xScaleFactor = attributes . getFloat ( R . styleable . draggable_panel_x_scale_factor , DEFAULT_SCALE_FACTOR ) ; this . yScaleFactor = attributes . getFloat ( R . styleable . draggable_panel_y_scale_factor , DEFAULT_SCALE_FACTOR ) ; this . topFragmentMarginRight = attributes . getDimensionPixelSize ( R . styleable . draggable_panel_top_fragment_margin_right , DEFAULT_TOP_FRAGMENT_MARGIN ) ; this . topFragmentMarginBottom = attributes . getDimensionPixelSize ( R . styleable . draggable_panel_top_fragment_margin_bottom , DEFAULT_TOP_FRAGMENT_MARGIN ) ; this . enableHorizontalAlphaEffect = attributes . getBoolean ( R . styleable . draggable_panel_enable_horizontal_alpha_effect , DEFAULT_ENABLE_HORIZONTAL_ALPHA_EFFECT ) ; this . enableClickToMaximize = attributes . getBoolean ( R . styleable . draggable_panel_enable_click_to_maximize_panel , DEFAULT_ENABLE_CLICK_TO_MAXIMIZE ) ; this . enableClickToMinimize = attributes . getBoolean ( R . styleable . draggable_panel_enable_click_to_minimize_panel , DEFAULT_ENABLE_CLICK_TO_MINIMIZE ) ; this . enableTouchListener = attributes . getBoolean ( R . styleable . draggable_panel_enable_touch_listener_panel , DEFAULT_ENABLE_TOUCH_LISTENER ) ; attributes . recycle ( ) ; } | Initialize the xml configuration based on styleable attributes |
29,999 | public void showPlace ( PlaceViewModel placeViewModel ) { this . placeViewModel = placeViewModel ; nameTextView . setText ( placeViewModel . getName ( ) ) ; Picasso . with ( getActivity ( ) ) . load ( placeViewModel . getPhoto ( ) ) . placeholder ( R . drawable . maps_placeholder ) . into ( photoImageView ) ; } | Use the PlaceViewModel information to render the place name and the place image inside the fragment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.