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" ... | 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 (... | 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 , GitlabNot... | 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... | 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 || positionBaseSh... | 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... | 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 + GitlabNo... | 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 ) || ( bodyHasVa... | 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 .... | 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 = di... | 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 = re... | 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/... | 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 ( ) + Gitl... | 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 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 , ... | 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 ) ; requ... | 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... | 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" , n... | 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" ... | 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 createMile... | 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 , Voi... | 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 )... | 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 [... | 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 , Gitl... | 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... | 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 ) ... | 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 + Gi... | 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 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 = ... | 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 ( ) + GitlabTrig... | 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 ( ap... | 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 (... | 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 ) ) . a... | 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" , shareWithGroupLoc... | 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 ; ... | 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 fl... | 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 ( ) ;... | 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 { triggerOnReleaseActionsWhileVer... | 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... | 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 ( ) && ! draggableVie... | 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 ( ... | 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 . closeToLe... | 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 ) { ... | 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 ) ; moviePosterFragme... | 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 )... | 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 ( ) { resetAc... | 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 ( episodeRendere... | 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 ( nu... | 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 . ... | 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 )... | 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 ,... | 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... | 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_... | 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 , ... | 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 (... | 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 .... | 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.