idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
33,500 | public float fractionTraveled ( ) { float fractionTraveled = 1 ; if ( routeLeg ( ) . distance ( ) > 0 ) { fractionTraveled = ( float ) ( distanceTraveled ( ) / routeLeg ( ) . distance ( ) ) ; if ( fractionTraveled < 0 ) { fractionTraveled = 0 ; } } return fractionTraveled ; } | Get the fraction traveled along the current leg this is a float value between 0 and 1 and isn t guaranteed to reach 1 before the user reaches the next waypoint . |
33,501 | public void start ( DirectionsRoute route ) { if ( route != null ) { currentRouteInformation = buildRouteInformationFromRoute ( route ) ; } navigation . addProgressChangeListener ( progressChangeListener ) ; } | Called when beginning navigation with a route . |
33,502 | public void resume ( Location location ) { if ( location != null ) { currentRouteInformation = buildRouteInformationFromLocation ( location , null ) ; } navigation . addProgressChangeListener ( progressChangeListener ) ; } | Called during rotation to update route information . |
33,503 | public void showRouteOverview ( int [ ] padding ) { updateCameraTrackingMode ( NAVIGATION_TRACKING_MODE_NONE ) ; RouteInformation routeInformation = buildRouteInformationFromProgress ( currentRouteProgress ) ; animateCameraForRouteOverview ( routeInformation , padding ) ; } | This method stops the map camera from tracking the current location and then zooms out to an overview of the current route being traveled . |
33,504 | private boolean validSecondStep ( LegStep secondStep , RouteProgress routeProgress ) { return routeProgress . currentLegProgress ( ) . upComingStep ( ) != null && routeProgress . currentLegProgress ( ) . upComingStep ( ) . equals ( secondStep ) ; } | The second step of the new route is valid if it equals the current route upcoming step . |
33,505 | public void addRoute ( DirectionsRoute directionsRoute ) { List < DirectionsRoute > routes = new ArrayList < > ( ) ; routes . add ( directionsRoute ) ; addRoutes ( routes ) ; } | Allows adding a single primary route for the user to traverse along . No alternative routes will be drawn on top of the map . |
33,506 | public void showFeedbackSubmitted ( ) { if ( ! isEnabled ) { return ; } show ( getContext ( ) . getString ( R . string . feedback_submitted ) , THREE_SECOND_DELAY_IN_MILLIS , false ) ; } | Shows this alert view for when feedback is submitted |
33,507 | public void showReportProblem ( ) { if ( ! isEnabled ) { return ; } final Handler handler = new Handler ( ) ; handler . postDelayed ( new Runnable ( ) { public void run ( ) { show ( getContext ( ) . getString ( R . string . report_problem ) , NavigationConstants . ALERT_VIEW_PROBLEM_DURATION , true ) ; } } , THREE_SECOND_DELAY_IN_MILLIS ) ; } | Shows this alert view to let user report a problem for the given number of milliseconds |
33,508 | protected void parsePropertiesInKeyValueFormat ( List < GetValue > values ) { if ( values == null ) { return ; } for ( GetValue getValue : values ) { String key = getValue . getKey ( ) ; if ( ! StringUtils . endsWithIgnoreCase ( key , "/" ) ) { key = key . replace ( this . context , "" ) . replace ( '/' , '.' ) ; String value = getValue . getDecodedValue ( ) ; this . properties . put ( key , value ) ; } } } | Parses the properties in key value style i . e . values are expected to be either a sub key or a constant . |
33,509 | protected void parsePropertiesWithNonKeyValueFormat ( List < GetValue > values , ConsulConfigProperties . Format format ) { if ( values == null ) { return ; } for ( GetValue getValue : values ) { String key = getValue . getKey ( ) . replace ( this . context , "" ) ; if ( this . configProperties . getDataKey ( ) . equals ( key ) ) { parseValue ( getValue , format ) ; } } } | Parses the properties using the format which is not a key value style i . e . either java properties style or YAML style . |
33,510 | public void add ( String instanceId ) { ScheduledFuture task = this . scheduler . scheduleAtFixedRate ( new ConsulHeartbeatTask ( instanceId ) , this . configuration . computeHearbeatInterval ( ) . toStandardDuration ( ) . getMillis ( ) ) ; ScheduledFuture previousTask = this . serviceHeartbeats . put ( instanceId , task ) ; if ( previousTask != null ) { previousTask . cancel ( true ) ; } } | Add a service to the checks loop . |
33,511 | public void setMode ( int mode , boolean animation ) { if ( mMode != mode ) { mMode = mode ; if ( mOnTimeChangedListener != null ) mOnTimeChangedListener . onModeChanged ( mMode ) ; if ( animation ) startAnimation ( ) ; else invalidate ( ) ; } } | Set the select mode of this TimePicker . |
33,512 | public void setHour ( int hour ) { if ( m24Hour ) hour = Math . max ( hour , 0 ) % 24 ; else hour = Math . max ( hour , 0 ) % 12 ; if ( mHour != hour ) { int old = mHour ; mHour = hour ; if ( mOnTimeChangedListener != null ) mOnTimeChangedListener . onHourChanged ( old , mHour ) ; if ( mMode == MODE_HOUR ) invalidate ( ) ; } } | Set the selected hour value . |
33,513 | public void setMinute ( int minute ) { minute = Math . min ( Math . max ( minute , 0 ) , 59 ) ; if ( mMinute != minute ) { int old = mMinute ; mMinute = minute ; if ( mOnTimeChangedListener != null ) mOnTimeChangedListener . onMinuteChanged ( old , mMinute ) ; if ( mMode == MODE_MINUTE ) invalidate ( ) ; } } | Set the selected minute value . |
33,514 | public void set24Hour ( boolean b ) { if ( m24Hour != b ) { m24Hour = b ; if ( ! m24Hour && mHour > 11 ) setHour ( mHour - 12 ) ; calculateTextLocation ( ) ; } } | Set this TimePicker use 24 - hour format or not . |
33,515 | public void setCurrentItem ( int position ) { if ( mSelectedPosition != position ) { CheckedTextView tv = getTabView ( mSelectedPosition ) ; if ( tv != null ) tv . setChecked ( false ) ; } mSelectedPosition = position ; CheckedTextView tv = getTabView ( mSelectedPosition ) ; if ( tv != null ) tv . setChecked ( true ) ; animateToTab ( position ) ; } | Set the current page of this TabPageIndicator . |
33,516 | public Dialog clearContent ( ) { title ( 0 ) ; positiveAction ( 0 ) ; positiveActionClickListener ( null ) ; negativeAction ( 0 ) ; negativeActionClickListener ( null ) ; neutralAction ( 0 ) ; neutralActionClickListener ( null ) ; contentView ( null ) ; return this ; } | Clear the content of this Dialog . |
33,517 | public Dialog dimAmount ( float amount ) { Window window = getWindow ( ) ; if ( amount > 0f ) { window . addFlags ( WindowManager . LayoutParams . FLAG_DIM_BEHIND ) ; WindowManager . LayoutParams lp = window . getAttributes ( ) ; lp . dimAmount = amount ; window . setAttributes ( lp ) ; } else window . clearFlags ( WindowManager . LayoutParams . FLAG_DIM_BEHIND ) ; return this ; } | Set the dim amount of the region outside this Dialog . |
33,518 | public Dialog elevation ( float elevation ) { if ( mCardView . getMaxCardElevation ( ) < elevation ) mCardView . setMaxCardElevation ( elevation ) ; mCardView . setCardElevation ( elevation ) ; return this ; } | Set the elevation value of this Dialog . |
33,519 | public Dialog actionBackground ( Drawable drawable ) { positiveActionBackground ( drawable ) ; negativeActionBackground ( drawable ) ; neutralActionBackground ( drawable ) ; return this ; } | Set the background drawable of all action buttons . |
33,520 | public Dialog actionTextColor ( ColorStateList color ) { positiveActionTextColor ( color ) ; negativeActionTextColor ( color ) ; neutralActionTextColor ( color ) ; return this ; } | Sets the text color of all action buttons . |
33,521 | public Dialog positiveActionBackground ( int id ) { return positiveActionBackground ( id == 0 ? null : getContext ( ) . getResources ( ) . getDrawable ( id ) ) ; } | Set the background drawable of positive action button . |
33,522 | public Dialog positiveActionRipple ( int resId ) { RippleDrawable drawable = new RippleDrawable . Builder ( getContext ( ) , resId ) . build ( ) ; return positiveActionBackground ( drawable ) ; } | Set the RippleEffect of positive action button . |
33,523 | public Dialog negativeActionBackground ( int id ) { return negativeActionBackground ( id == 0 ? null : getContext ( ) . getResources ( ) . getDrawable ( id ) ) ; } | Set the background drawable of neagtive action button . |
33,524 | public Dialog negativeActionRipple ( int resId ) { RippleDrawable drawable = new RippleDrawable . Builder ( getContext ( ) , resId ) . build ( ) ; return negativeActionBackground ( drawable ) ; } | Set the RippleEffect of negative action button . |
33,525 | public Dialog neutralActionBackground ( int id ) { return neutralActionBackground ( id == 0 ? null : getContext ( ) . getResources ( ) . getDrawable ( id ) ) ; } | Set the background drawable of neutral action button . |
33,526 | public Dialog neutralActionRipple ( int resId ) { RippleDrawable drawable = new RippleDrawable . Builder ( getContext ( ) , resId ) . build ( ) ; return neutralActionBackground ( drawable ) ; } | Set the RippleEffect of neutral action button . |
33,527 | public Dialog contentView ( View v ) { if ( mContent != v ) { if ( mContent != null ) mCardView . removeView ( mContent ) ; mContent = v ; } if ( mContent != null ) mCardView . addView ( mContent ) ; return this ; } | Set the content view of this Dialog . |
33,528 | public Dialog contentMargin ( int left , int top , int right , int bottom ) { mCardView . setContentMargin ( left , top , right , bottom ) ; return this ; } | Set the margin between content view and Dialog border . |
33,529 | public void setValueRange ( int min , int max , boolean animation ) { if ( max < min || ( min == mMinValue && max == mMaxValue ) ) return ; float oldValue = getExactValue ( ) ; float oldPosition = getPosition ( ) ; mMinValue = min ; mMaxValue = max ; setValue ( oldValue , animation ) ; if ( mOnPositionChangeListener != null && oldPosition == getPosition ( ) && oldValue != getExactValue ( ) ) mOnPositionChangeListener . onPositionChanged ( this , false , oldPosition , oldPosition , Math . round ( oldValue ) , getValue ( ) ) ; } | Set the randge of selectable value . |
33,530 | public void setValue ( float value , boolean animation ) { value = Math . min ( mMaxValue , Math . max ( value , mMinValue ) ) ; setPosition ( ( value - mMinValue ) / ( mMaxValue - mMinValue ) , animation ) ; } | Set the selected value of this Slider . |
33,531 | public void setLineMorphingState ( int state , boolean animation ) { if ( mIcon != null && mIcon instanceof LineMorphingDrawable ) ( ( LineMorphingDrawable ) mIcon ) . switchLineState ( state , animation ) ; } | Set the line state of LineMorphingDrawable that is used as this button s icon . |
33,532 | public void setIcon ( Drawable icon , boolean animation ) { if ( icon == null ) return ; if ( animation ) { mSwitchIconAnimator . startAnimation ( icon ) ; invalidate ( ) ; } else { if ( mIcon != null ) { mIcon . setCallback ( null ) ; unscheduleDrawable ( mIcon ) ; } mIcon = icon ; float half = mIconSize / 2f ; mIcon . setBounds ( ( int ) ( mBackground . getCenterX ( ) - half ) , ( int ) ( mBackground . getCenterY ( ) - half ) , ( int ) ( mBackground . getCenterX ( ) + half ) , ( int ) ( mBackground . getCenterY ( ) + half ) ) ; mIcon . setCallback ( this ) ; invalidate ( ) ; } } | Set the drawable that is used as this button s icon . |
33,533 | public void setEnabledWeekday ( int dayOfWeek , boolean enable ) { if ( mRepeatMode != REPEAT_WEEKLY ) return ; if ( enable ) mRepeatSetting = mRepeatSetting | WEEKDAY_MASK [ dayOfWeek - 1 ] ; else mRepeatSetting = mRepeatSetting & ( ~ WEEKDAY_MASK [ dayOfWeek - 1 ] ) ; } | Enable repeat on a dayOfWeek . Only apply it repeat mode is REPEAT_WEEKLY . |
33,534 | public static int getWeekDayOrderNum ( Calendar cal ) { return cal . get ( Calendar . DAY_OF_MONTH ) + 7 > cal . getActualMaximum ( Calendar . DAY_OF_MONTH ) ? - 1 : ( cal . get ( Calendar . DAY_OF_MONTH ) - 1 ) / 7 ; } | Get the order number of weekday . 0 mean the first - 1 mean the last . |
33,535 | private static int getDay ( Calendar cal , int dayOfWeek , int orderNum ) { int day = cal . getActualMaximum ( Calendar . DAY_OF_MONTH ) ; cal . set ( Calendar . DAY_OF_MONTH , day ) ; int lastWeekday = cal . get ( Calendar . DAY_OF_WEEK ) ; int shift = lastWeekday >= dayOfWeek ? ( lastWeekday - dayOfWeek ) : ( lastWeekday + 7 - dayOfWeek ) ; day -= shift ; if ( orderNum < 0 ) return day ; cal . set ( Calendar . DAY_OF_MONTH , day ) ; int lastOrderNum = ( cal . get ( Calendar . DAY_OF_MONTH ) - 1 ) / 7 ; if ( orderNum >= lastOrderNum ) return day ; return day - ( lastOrderNum - orderNum ) * 7 ; } | Get the day in month of the current month of Calendar . |
33,536 | public void setCurrentTab ( int position ) { if ( mSelectedPosition != position ) { View v = mLayoutManager . findViewByPosition ( mSelectedPosition ) ; if ( v != null ) ( ( Checkable ) v ) . setChecked ( false ) ; } mSelectedPosition = position ; View v = mLayoutManager . findViewByPosition ( mSelectedPosition ) ; if ( v != null ) ( ( Checkable ) v ) . setChecked ( true ) ; animateToTab ( position ) ; } | Set the current tab of this TabIndicatorView . |
33,537 | public BottomSheetDialog heightParam ( int height ) { if ( mLayoutHeight != height ) { mLayoutHeight = height ; if ( isShowing ( ) && mContentView != null ) { mRunShowAnimation = true ; mContainer . forceLayout ( ) ; mContainer . requestLayout ( ) ; } } return this ; } | Set the height params of this BottomSheetDialog s content view . |
33,538 | public void dismissImmediately ( ) { super . dismiss ( ) ; if ( mAnimation != null ) mAnimation . cancel ( ) ; if ( mHandler != null ) mHandler . removeCallbacks ( mDismissAction ) ; } | Dismiss Dialog immediately without showing out animation . |
33,539 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) public int getCompoundPaddingEnd ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) return mInputView . getCompoundPaddingEnd ( ) ; return mInputView . getCompoundPaddingRight ( ) ; } | Returns the end padding of the view plus space for the end Drawable if any . |
33,540 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) public int getCompoundPaddingStart ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) return mInputView . getCompoundPaddingStart ( ) ; return mInputView . getCompoundPaddingLeft ( ) ; } | Returns the start padding of the view plus space for the start Drawable if any . |
33,541 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public boolean getIncludeFontPadding ( ) { return Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN && mInputView . getIncludeFontPadding ( ) ; } | Gets whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent . |
33,542 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public float getLineSpacingExtra ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getLineSpacingExtra ( ) ; return 0f ; } | Gets the line spacing extra space |
33,543 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public float getLineSpacingMultiplier ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getLineSpacingMultiplier ( ) ; return 0f ; } | Gets the line spacing multiplier |
33,544 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public int getMarqueeRepeatLimit ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getMarqueeRepeatLimit ( ) ; return - 1 ; } | Gets the number of times the marquee animation is repeated . Only meaningful if the TextView has marquee enabled . |
33,545 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public float getShadowRadius ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getShadowRadius ( ) ; return 0 ; } | Gets the radius of the shadow layer . |
33,546 | @ TargetApi ( Build . VERSION_CODES . LOLLIPOP ) public final boolean getShowSoftInputOnFocus ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) return mInputView . getShowSoftInputOnFocus ( ) ; return true ; } | Returns whether the soft input method will be made visible when this TextView gets focused . The default is true . |
33,547 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) public int getTotalPaddingEnd ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) return getPaddingEnd ( ) + mInputView . getTotalPaddingEnd ( ) ; return getTotalPaddingRight ( ) ; } | Returns the total end padding of the view including the end Drawable if any . |
33,548 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) public int getTotalPaddingStart ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) return getPaddingStart ( ) + mInputView . getTotalPaddingStart ( ) ; return getTotalPaddingLeft ( ) ; } | Returns the total start padding of the view including the start Drawable if any . |
33,549 | protected void onSelectionChanged ( int selStart , int selEnd ) { if ( mInputView == null ) return ; if ( mInputView instanceof InternalEditText ) ( ( InternalEditText ) mInputView ) . superOnSelectionChanged ( selStart , selEnd ) ; else if ( mInputView instanceof InternalAutoCompleteTextView ) ( ( InternalAutoCompleteTextView ) mInputView ) . superOnSelectionChanged ( selStart , selEnd ) ; else ( ( InternalMultiAutoCompleteTextView ) mInputView ) . superOnSelectionChanged ( selStart , selEnd ) ; if ( mOnSelectionChangedListener != null ) mOnSelectionChangedListener . onSelectionChanged ( this , selStart , selEnd ) ; } | This method is called when the selection has changed in case any subclasses would like to know . |
33,550 | @ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) public void setAllCaps ( boolean allCaps ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . ICE_CREAM_SANDWICH ) mInputView . setAllCaps ( allCaps ) ; } | Sets the properties of this field to transform input to ALL CAPS display . This may use a small caps formatting if available . This setting will be ignored if this field is editable or selectable . |
33,551 | public void setCompoundDrawablePadding ( int pad ) { mInputView . setCompoundDrawablePadding ( pad ) ; if ( mDividerCompoundPadding ) { mDivider . setPadding ( mInputView . getTotalPaddingLeft ( ) , mInputView . getTotalPaddingRight ( ) ) ; if ( mLabelEnable ) mLabelView . setPadding ( mDivider . getPaddingLeft ( ) , mLabelView . getPaddingTop ( ) , mDivider . getPaddingRight ( ) , mLabelView . getPaddingBottom ( ) ) ; if ( mSupportMode != SUPPORT_MODE_NONE ) mSupportView . setPadding ( mDivider . getPaddingLeft ( ) , mSupportView . getPaddingTop ( ) , mDivider . getPaddingRight ( ) , mSupportView . getPaddingBottom ( ) ) ; } } | Sets the size of the padding between the compound drawables and the text . |
33,552 | @ TargetApi ( Build . VERSION_CODES . HONEYCOMB ) public void setCustomSelectionActionModeCallback ( ActionMode . Callback actionModeCallback ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) mInputView . setCustomSelectionActionModeCallback ( actionModeCallback ) ; } | If provided this ActionMode . Callback will be used to create the ActionMode when text selection is initiated in this View . |
33,553 | @ TargetApi ( Build . VERSION_CODES . LOLLIPOP ) public void setElegantTextHeight ( boolean elegant ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) mInputView . setElegantTextHeight ( elegant ) ; } | Set the TextView s elegant height metrics flag . This setting selects font variants that have not been compacted to fit Latin - based vertical metrics and also increases top and bottom bounds to provide more space . |
33,554 | public final void setHint ( CharSequence hint ) { mInputView . setHint ( hint ) ; if ( mLabelView != null ) mLabelView . setText ( hint ) ; } | Sets the text to be displayed when the text of the TextView is empty . Null means to use the normal empty text . The hint does not currently participate in determining the size of the view . |
33,555 | public final void setHint ( int resid ) { mInputView . setHint ( resid ) ; if ( mLabelView != null ) mLabelView . setText ( resid ) ; } | Sets the text to be displayed when the text of the TextView is empty from a resource . |
33,556 | public void setLetterSpacing ( float letterSpacing ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) mInputView . setLetterSpacing ( letterSpacing ) ; } | Sets text letter - spacing . The value is in EM units . Typical values for slight expansion will be around 0 . 05 . Negative values tighten text . |
33,557 | public void goTo ( int month , int year ) { int position = mAdapter . positionOfMonth ( month , year ) ; postSetSelectionFromTop ( position , 0 ) ; } | Jump to the view of a specific month . |
33,558 | public void setDate ( int day , int month , int year ) { if ( mAdapter . getYear ( ) == year && mAdapter . getMonth ( ) == month && mAdapter . getDay ( ) == day ) return ; mAdapter . setDate ( day , month , year , false ) ; goTo ( month , year ) ; } | Set the selected date of this DatePicker . |
33,559 | public String getFormattedDate ( DateFormat formatter ) { mCalendar . set ( Calendar . YEAR , mAdapter . getYear ( ) ) ; mCalendar . set ( Calendar . MONTH , mAdapter . getMonth ( ) ) ; mCalendar . set ( Calendar . DAY_OF_MONTH , mAdapter . getDay ( ) ) ; return formatter . format ( mCalendar . getTime ( ) ) ; } | Get the formatted string of selected date . |
33,560 | public DatePickerDialog date ( int day , int month , int year ) { mDatePickerLayout . setDate ( day , month , year ) ; return this ; } | Set the selected date of this DatePickerDialog . |
33,561 | public void setCurrentGroup ( int groupId ) { if ( mCurrentGroup != groupId ) { int oldGroupId = mCurrentGroup ; mCurrentGroup = groupId ; mGroupChanged = true ; dispatchOnToolbarGroupChanged ( oldGroupId , mCurrentGroup ) ; animateOut ( ) ; } } | Set current group of the Toolbar . |
33,562 | public void createMenu ( int menuId ) { mToolbar . inflateMenu ( menuId ) ; mMenuDataChanged = true ; if ( mAppCompatDelegate == null ) onPrepareMenu ( ) ; } | This funcction should be called in onCreateOptionsMenu of Activity or Fragment to inflate a new menu . |
33,563 | public void setCheckedImmediately ( boolean checked ) { if ( getButtonDrawable ( ) instanceof CheckBoxDrawable ) { CheckBoxDrawable drawable = ( CheckBoxDrawable ) getButtonDrawable ( ) ; drawable . setAnimEnable ( false ) ; setChecked ( checked ) ; drawable . setAnimEnable ( true ) ; } else setChecked ( checked ) ; } | Change the checked state of this button immediately without showing animation . |
33,564 | public void setCheckedImmediately ( boolean checked ) { if ( mChecked != checked ) { mChecked = checked ; if ( mOnCheckedChangeListener != null ) mOnCheckedChangeListener . onCheckedChanged ( this , mChecked ) ; } mThumbPosition = mChecked ? 1f : 0f ; invalidate ( ) ; } | Change the checked state of this Switch immediately without showing animation . |
33,565 | public void goTo ( int year ) { int position = mAdapter . positionOfYear ( year ) - mPositionShift ; int offset = mDistanceShift ; if ( position < 0 ) { position = 0 ; offset = 0 ; } postSetSelectionFromTop ( position , offset ) ; } | Jump to a specific year . |
33,566 | public void setYear ( int year ) { if ( mAdapter . getYear ( ) == year ) return ; mAdapter . setYear ( year ) ; goTo ( year ) ; } | Set the selected year . |
33,567 | public SnackBar actionRipple ( int resId ) { if ( resId != 0 ) ViewUtil . setBackground ( mAction , new RippleDrawable . Builder ( getContext ( ) , resId ) . build ( ) ) ; return this ; } | Set the style of RippleEffect of the ActionButton . |
33,568 | public SnackBar horizontalPadding ( int padding ) { mText . setPadding ( padding , mText . getPaddingTop ( ) , padding , mText . getPaddingBottom ( ) ) ; mAction . setPadding ( padding , mAction . getPaddingTop ( ) , padding , mAction . getPaddingBottom ( ) ) ; return this ; } | Set the horizontal padding between this SnackBar and it s text and button . |
33,569 | public SnackBar verticalPadding ( int padding ) { mText . setPadding ( mText . getPaddingLeft ( ) , padding , mText . getPaddingRight ( ) , padding ) ; mAction . setPadding ( mAction . getPaddingLeft ( ) , padding , mAction . getPaddingRight ( ) , padding ) ; return this ; } | Set the vertical padding between this SnackBar and it s text and button . |
33,570 | public SnackBar padding ( int horizontalPadding , int verticalPadding ) { mText . setPadding ( horizontalPadding , verticalPadding , horizontalPadding , verticalPadding ) ; mAction . setPadding ( horizontalPadding , verticalPadding , horizontalPadding , verticalPadding ) ; return this ; } | Set the padding between this SnackBar and it s text and button . |
33,571 | public void show ( Activity activity ) { show ( ( ViewGroup ) activity . getWindow ( ) . findViewById ( Window . ID_ANDROID_CONTENT ) ) ; } | Show this SnackBar . It will auto attach to the activity s root view . |
33,572 | public void show ( ViewGroup parent ) { if ( mState == STATE_SHOWING || mState == STATE_DISMISSING ) return ; if ( getParent ( ) != parent ) { if ( getParent ( ) != null ) ( ( ViewGroup ) getParent ( ) ) . removeView ( this ) ; parent . addView ( this ) ; } show ( ) ; } | Show this SnackBar . It will auto attach to the parent view . |
33,573 | @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) public void show ( ) { ViewGroup parent = ( ViewGroup ) getParent ( ) ; if ( parent == null || mState == STATE_SHOWING || mState == STATE_DISMISSING ) return ; if ( parent instanceof android . widget . FrameLayout ) { LayoutParams params = ( LayoutParams ) getLayoutParams ( ) ; params . width = mWidth ; params . height = mHeight ; params . gravity = Gravity . START | Gravity . BOTTOM ; if ( mIsRtl ) params . rightMargin = mMarginStart ; else params . leftMargin = mMarginStart ; params . bottomMargin = mMarginBottom ; setLayoutParams ( params ) ; } else if ( parent instanceof android . widget . RelativeLayout ) { android . widget . RelativeLayout . LayoutParams params = ( android . widget . RelativeLayout . LayoutParams ) getLayoutParams ( ) ; params . width = mWidth ; params . height = mHeight ; params . addRule ( android . widget . RelativeLayout . ALIGN_PARENT_BOTTOM ) ; params . addRule ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ? android . widget . RelativeLayout . ALIGN_PARENT_START : android . widget . RelativeLayout . ALIGN_PARENT_LEFT ) ; if ( mIsRtl ) params . rightMargin = mMarginStart ; else params . leftMargin = mMarginStart ; params . bottomMargin = mMarginBottom ; setLayoutParams ( params ) ; } if ( mInAnimation != null && mState != STATE_SHOWN ) { mInAnimation . cancel ( ) ; mInAnimation . reset ( ) ; mInAnimation . setAnimationListener ( new Animation . AnimationListener ( ) { public void onAnimationStart ( Animation animation ) { setState ( STATE_SHOWING ) ; setVisibility ( View . VISIBLE ) ; } public void onAnimationRepeat ( Animation animation ) { } public void onAnimationEnd ( Animation animation ) { setState ( STATE_SHOWN ) ; startTimer ( ) ; } } ) ; clearAnimation ( ) ; startAnimation ( mInAnimation ) ; } else { setVisibility ( View . VISIBLE ) ; setState ( STATE_SHOWN ) ; startTimer ( ) ; } } | Show this SnackBar . Make sure it already attached to a parent view or this method will do nothing . |
33,574 | public static int getStyleId ( Context context , AttributeSet attrs , int defStyleAttr , int defStyleRes ) { TypedArray a = context . obtainStyledAttributes ( attrs , R . styleable . ThemableView , defStyleAttr , defStyleRes ) ; int styleId = a . getResourceId ( R . styleable . ThemableView_v_styleId , 0 ) ; a . recycle ( ) ; return styleId ; } | Get the styleId from attributes . |
33,575 | public static ThemeManager getInstance ( ) { if ( mInstance == null ) { synchronized ( ThemeManager . class ) { if ( mInstance == null ) mInstance = new ThemeManager ( ) ; } } return mInstance ; } | Get the singleton instance of ThemeManager . |
33,576 | public int getStyle ( int styleId , int theme ) { int [ ] styles = getStyleList ( styleId ) ; return styles == null ? 0 : styles [ theme ] ; } | Get a specific style of a styleId . |
33,577 | public SimpleDialog messageTextAppearance ( int resId ) { if ( mMessageTextAppearanceId != resId ) { mMessageTextAppearanceId = resId ; if ( mMessage != null ) mMessage . setTextAppearance ( getContext ( ) , mMessageTextAppearanceId ) ; } return this ; } | Sets the text color size style of the message view from the specified TextAppearance resource . |
33,578 | public SimpleDialog messageTextColor ( int color ) { if ( mMessageTextColor != color ) { mMessageTextColor = color ; if ( mMessage != null ) mMessage . setTextColor ( color ) ; } return this ; } | Sets the text color of the message view . |
33,579 | public SimpleDialog radioButtonStyle ( int resId ) { if ( mRadioButtonStyle != resId ) { mRadioButtonStyle = resId ; if ( mAdapter != null && mMode == MODE_ITEMS ) mAdapter . notifyDataSetChanged ( ) ; } return this ; } | Sets the style of radio button . |
33,580 | public SimpleDialog checkBoxStyle ( int resId ) { if ( mCheckBoxStyle != resId ) { mCheckBoxStyle = resId ; if ( mAdapter != null && mMode == MODE_MULTI_ITEMS ) mAdapter . notifyDataSetChanged ( ) ; } return this ; } | Sets the style of check box . |
33,581 | public SimpleDialog itemHeight ( int height ) { if ( mItemHeight != height ) { mItemHeight = height ; if ( mAdapter != null ) mAdapter . notifyDataSetChanged ( ) ; } return this ; } | Sets the height of item |
33,582 | public SimpleDialog itemTextAppearance ( int resId ) { if ( mItemTextAppearance != resId ) { mItemTextAppearance = resId ; if ( mAdapter != null ) mAdapter . notifyDataSetChanged ( ) ; } return this ; } | Sets the text color size style of the item view from the specified TextAppearance resource . |
33,583 | public SimpleDialog items ( CharSequence [ ] items , int selectedIndex ) { if ( mListView == null ) initListView ( ) ; mMode = MODE_ITEMS ; mAdapter . setItems ( items , selectedIndex ) ; super . contentView ( mListView ) ; return this ; } | Set the list of items in single - choice mode . |
33,584 | public SimpleDialog multiChoiceItems ( CharSequence [ ] items , int ... selectedIndexes ) { if ( mListView == null ) initListView ( ) ; mMode = MODE_MULTI_ITEMS ; mAdapter . setItems ( items , selectedIndexes ) ; super . contentView ( mListView ) ; return this ; } | Set the list of items in multi - choice mode . |
33,585 | public void setProgress ( float percent ) { if ( mCircular ) ( ( CircularProgressDrawable ) mProgressDrawable ) . setProgress ( percent ) ; else ( ( LinearProgressDrawable ) mProgressDrawable ) . setProgress ( percent ) ; } | Set the current progress of this view . |
33,586 | public void setSecondaryProgress ( float percent ) { if ( mCircular ) ( ( CircularProgressDrawable ) mProgressDrawable ) . setSecondaryProgress ( percent ) ; else ( ( LinearProgressDrawable ) mProgressDrawable ) . setSecondaryProgress ( percent ) ; } | Set the current secondary progress of this view . |
33,587 | public void setSelection ( int position ) { if ( mAdapter != null ) position = Math . max ( 0 , Math . min ( position , mAdapter . getCount ( ) - 1 ) ) ; if ( mSelectedPosition != position ) { mSelectedPosition = position ; if ( mOnItemSelectedListener != null ) mOnItemSelectedListener . onItemSelected ( this , getSelectedView ( ) , position , mAdapter == null ? - 1 : mAdapter . getItemId ( position ) ) ; onDataInvalidated ( ) ; } } | Set the selected position of this Spinner . |
33,588 | public void setAdapter ( SpinnerAdapter adapter ) { if ( mAdapter != null ) mAdapter . unregisterDataSetObserver ( mDataSetObserver ) ; mRecycler . clear ( ) ; mAdapter = adapter ; mAdapter . registerDataSetObserver ( mDataSetObserver ) ; onDataChanged ( ) ; if ( mPopup != null ) mPopup . setAdapter ( new DropDownAdapter ( adapter ) ) ; else mTempAdapter = new DropDownAdapter ( adapter ) ; } | Set an adapter for this Spinner . |
33,589 | public void dismiss ( ) { mPopup . dismiss ( ) ; removePromptView ( ) ; mPopup . setContentView ( null ) ; mDropDownList = null ; mHandler . removeCallbacks ( mResizePopupRunnable ) ; } | Dismiss the popup window . |
33,590 | public boolean performItemClick ( int position ) { if ( isShowing ( ) ) { if ( mItemClickListener != null ) { final DropDownListView list = mDropDownList ; final View child = list . getChildAt ( position - list . getFirstVisiblePosition ( ) ) ; final ListAdapter adapter = list . getAdapter ( ) ; mItemClickListener . onItemClick ( list , child , position , adapter . getItemId ( position ) ) ; } return true ; } return false ; } | Perform an item click operation on the specified list adapter position . |
33,591 | public boolean onKeyUp ( int keyCode , KeyEvent event ) { if ( isShowing ( ) && mDropDownList . getSelectedItemPosition ( ) >= 0 ) { boolean consumed = mDropDownList . onKeyUp ( keyCode , event ) ; if ( consumed && isConfirmKey ( keyCode ) ) { dismiss ( ) ; } return consumed ; } return false ; } | Filter key down events . By forwarding key up events to this function views using non - modal ListPopupWindow can have it handle key selection of items . |
33,592 | private static void applyStyle ( AutoCompleteTextView v , AttributeSet attrs , int defStyleAttr , int defStyleRes ) { TypedArray a = v . getContext ( ) . obtainStyledAttributes ( attrs , R . styleable . AutoCompleteTextView , defStyleAttr , defStyleRes ) ; int n = a . getIndexCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int attr = a . getIndex ( i ) ; if ( attr == R . styleable . AutoCompleteTextView_android_completionHint ) v . setCompletionHint ( a . getString ( attr ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_completionThreshold ) v . setThreshold ( a . getInteger ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownAnchor ) v . setDropDownAnchor ( a . getResourceId ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownHeight ) v . setDropDownHeight ( a . getLayoutDimension ( attr , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownWidth ) v . setDropDownWidth ( a . getLayoutDimension ( attr , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownHorizontalOffset ) v . setDropDownHorizontalOffset ( a . getDimensionPixelSize ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownVerticalOffset ) v . setDropDownVerticalOffset ( a . getDimensionPixelSize ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_popupBackground ) v . setDropDownBackgroundDrawable ( a . getDrawable ( attr ) ) ; } a . recycle ( ) ; } | Apply any AutoCompleteTextView style attributes to a view . |
33,593 | public static LinkedBuffer allocate ( int size , LinkedBuffer previous ) { if ( size < MIN_BUFFER_SIZE ) throw new IllegalArgumentException ( MIN_BUFFER_SIZE + " is the minimum buffer size." ) ; return new LinkedBuffer ( size , previous ) ; } | Allocates a new buffer with the specified size and appends it to the previous buffer . |
33,594 | public static LinkedBuffer wrap ( byte [ ] array , int offset , int length ) { return new LinkedBuffer ( array , offset , offset + length ) ; } | Wraps the byte array buffer as a read - only buffer . |
33,595 | public static LinkedBuffer use ( byte [ ] buffer , int start ) { assert start >= 0 ; if ( buffer . length - start < MIN_BUFFER_SIZE ) throw new IllegalArgumentException ( MIN_BUFFER_SIZE + " is the minimum buffer size." ) ; return new LinkedBuffer ( buffer , start , start ) ; } | Uses the existing byte array as the internal buffer . |
33,596 | public static StringTemplate getTemplateFrom ( StringTemplateGroup group , String template ) { try { return group . lookupTemplate ( template ) ; } catch ( IllegalArgumentException e ) { return null ; } } | Returns null if template is not found . |
33,597 | public static Proto loadFromClasspath ( String path , Proto importer ) throws Exception { URL resource = getResource ( path , DefaultProtoLoader . class ) ; if ( resource == null ) return null ; Proto proto = new Proto ( resource , DEFAULT_INSTANCE , importer ) ; ProtoUtil . loadFrom ( resource , proto ) ; return proto ; } | Loads a proto from the classpath . |
33,598 | public < T > boolean registerPojo ( Class < T > typeClass ) { assert typeClass != null ; final HasSchema < ? > last = pojoMapping . putIfAbsent ( typeClass . getName ( ) , new LazyRegister < T > ( typeClass , this ) ) ; return last == null || ( last instanceof LazyRegister ) ; } | Registers a pojo . Returns true if registration is successful or if the same exact schema was previously registered . |
33,599 | public < T extends Enum < T > > boolean registerEnum ( Class < T > enumClass ) { return null == enumMapping . putIfAbsent ( enumClass . getName ( ) , EnumIO . newEnumIO ( enumClass , this ) ) ; } | Registers an enum . Returns true if registration is successful . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.