idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
30,200
public void removeArea ( final Section AREA ) { if ( null == AREA ) return ; areas . remove ( AREA ) ; Collections . sort ( areas , new SectionComparator ( ) ) ; fireUpdateEvent ( SECTION_EVENT ) ; }
Removes the given Section from the list of areas . Areas in the Medusa library usually are more eye - catching than Sections .
53
26
30,201
public void setTickMarkSections ( final List < Section > SECTIONS ) { tickMarkSections . setAll ( SECTIONS ) ; Collections . sort ( tickMarkSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Sets the tickmark sections to the given list of Section objects .
64
14
30,202
public void addTickMarkSection ( final Section SECTION ) { if ( null == SECTION ) return ; tickMarkSections . add ( SECTION ) ; Collections . sort ( tickMarkSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Adds the given Section to the list of tickmark sections .
62
12
30,203
public void removeTickMarkSection ( final Section SECTION ) { if ( null == SECTION ) return ; tickMarkSections . remove ( SECTION ) ; Collections . sort ( tickMarkSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Removes the given Section from the list of tickmark sections .
62
13
30,204
public void setTickLabelSections ( final List < Section > SECTIONS ) { tickLabelSections . setAll ( SECTIONS ) ; Collections . sort ( tickLabelSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Sets the ticklabel sections to the given list of Section objects .
64
14
30,205
public void addTickLabelSection ( final Section SECTION ) { if ( null == SECTION ) return ; tickLabelSections . add ( SECTION ) ; Collections . sort ( tickLabelSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Adds the given Section to the list of ticklabel sections .
62
12
30,206
public void removeTickLabelSection ( final Section SECTION ) { if ( null == SECTION ) return ; tickLabelSections . remove ( SECTION ) ; Collections . sort ( tickLabelSections , new SectionComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Removes the given Section from the list of ticklabel sections .
62
13
30,207
public void addMarker ( final Marker MARKER ) { if ( null == MARKER ) return ; markers . add ( MARKER ) ; Collections . sort ( markers , new MarkerComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Adds the given Marker to the list of markers .
57
11
30,208
public void removeMarker ( final Marker MARKER ) { if ( null == MARKER ) return ; markers . remove ( MARKER ) ; Collections . sort ( markers , new MarkerComparator ( ) ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Removes the given Marker from the list of markers .
57
12
30,209
public void setForegroundBaseColor ( final Color COLOR ) { if ( null == titleColor ) { _titleColor = COLOR ; } else { titleColor . set ( COLOR ) ; } if ( null == subTitleColor ) { _subTitleColor = COLOR ; } else { subTitleColor . set ( COLOR ) ; } if ( null == unitColor ) { _unitColor = COLOR ; } else { unitColor . set ( COLOR ) ; } if ( null == valueColor ) { _valueColor = COLOR ; } else { valueColor . set ( COLOR ) ; } if ( null == tickLabelColor ) { _tickLabelColor = COLOR ; } else { tickLabelColor . set ( COLOR ) ; } if ( null == zeroColor ) { _zeroColor = COLOR ; } else { zeroColor . set ( COLOR ) ; } if ( null == tickMarkColor ) { _tickMarkColor = COLOR ; } else { tickMarkColor . set ( COLOR ) ; } if ( null == majorTickMarkColor ) { _majorTickMarkColor = COLOR ; } else { majorTickMarkColor . set ( COLOR ) ; } if ( null == mediumTickMarkColor ) { _mediumTickMarkColor = COLOR ; } else { mediumTickMarkColor . set ( COLOR ) ; } if ( null == minorTickMarkColor ) { _minorTickMarkColor = COLOR ; } else { minorTickMarkColor . set ( COLOR ) ; } fireUpdateEvent ( REDRAW_EVENT ) ; }
A convenient method to set the color of foreground elements like title subTitle unit value tickLabel and tickMark to the given Color .
343
26
30,210
public void setZeroColor ( final Color COLOR ) { if ( null == zeroColor ) { _zeroColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { zeroColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the 0 tickmark and ticklabel when the gauge range has a negative min - and positive maxValue .
52
32
30,211
public void setKnobType ( final KnobType TYPE ) { if ( null == knobType ) { _knobType = null == TYPE ? KnobType . STANDARD : TYPE ; fireUpdateEvent ( RESIZE_EVENT ) ; } else { knobType . set ( TYPE ) ; } }
Defines the type of knob that will be used in the radial gauges . The values are STANDARD PLAIN METAL and FLAT .
64
29
30,212
public void setKnobVisible ( final boolean VISIBLE ) { if ( null == knobVisible ) { _knobVisible = VISIBLE ; fireUpdateEvent ( VISIBILITY_EVENT ) ; } else { knobVisible . set ( VISIBLE ) ; } }
Defines if the knob is visible .
59
8
30,213
public void setAngleRange ( final double RANGE ) { double tmpAngleRange = Helper . clamp ( 0.0 , 360.0 , RANGE ) ; if ( null == angleRange ) { _angleRange = tmpAngleRange ; setAngleStep ( tmpAngleRange / getRange ( ) ) ; if ( isAutoScale ( ) ) { calcAutoScale ( ) ; } fireUpdateEvent ( RECALC_EVENT ) ; } else { angleRange . set ( tmpAngleRange ) ; } }
Defines the angle range in degree that will be used to draw the scale of the radial gauge . The given range will be clamped in the range of 0 - 360 degrees . The range will start at the startAngle and will be drawn in the direction dependent on the scaleDirection .
113
59
30,214
public void setBarEffectEnabled ( final boolean ENABLED ) { if ( null == barEffectEnabled ) { _barEffectEnabled = ENABLED ; fireUpdateEvent ( VISIBILITY_EVENT ) ; } else { barEffectEnabled . set ( ENABLED ) ; } }
Defines if the the highlight effect on the gauges like the LinearSkin bar will be drawn . If you would like to have a more flat style you should set this to false .
63
37
30,215
public void setScaleDirection ( final ScaleDirection DIRECTION ) { if ( null == scaleDirection ) { _scaleDirection = null == DIRECTION ? ScaleDirection . CLOCKWISE : DIRECTION ; fireUpdateEvent ( RECALC_EVENT ) ; } else { scaleDirection . set ( DIRECTION ) ; } }
Defines the direction of the scale . The values are CLOCKWISE and COUNTER_CLOCKWISE . This property is needed to realize gauges like in QuarterSkin where the needle and knob should be placed on the upper right corner and the scale should start at the bottom . Here you need a counter - clockwise direction of the scale .
73
71
30,216
public void setTickLabelOrientation ( final TickLabelOrientation ORIENTATION ) { if ( null == tickLabelOrientation ) { _tickLabelOrientation = null == ORIENTATION ? TickLabelOrientation . HORIZONTAL : ORIENTATION ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { tickLabelOrientation . set ( ORIENTATION ) ; } }
Defines the orientation of the ticklabels . The values are HORIZONTAL ORTHOGONAL and TANGENT . Especially the ORTHOGONAL setting can be useful when using scales with big numbers .
89
45
30,217
public void setTickMarkColor ( final Color COLOR ) { if ( null == tickMarkColor ) { _tickMarkColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { tickMarkColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the tickmarks . This color will only be used if no tickmark section or major - medium - and minorTickMarkColor is defined at the position of the tickmark .
57
47
30,218
public void setMajorTickMarkColor ( final Color COLOR ) { if ( null == majorTickMarkColor ) { _majorTickMarkColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { majorTickMarkColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the major tickmarks . This color will only be used if no tickmark section is defined at the position of the tickmark .
64
37
30,219
public void setMajorTickMarkLengthFactor ( final double FACTOR ) { if ( null == majorTickMarkLengthFactor ) { _majorTickMarkLengthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { majorTickMarkLengthFactor . set ( FACTOR ) ; } }
The factor defines the length of the major tick mark . It can be in the range from 0 - 1 .
85
22
30,220
public void setMajorTickMarkWidthFactor ( final double FACTOR ) { if ( null == majorTickMarkWidthFactor ) { _majorTickMarkWidthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { majorTickMarkWidthFactor . set ( FACTOR ) ; } }
The factor defines the width of the major tick mark . It can be in the range from 0 - 1 .
85
22
30,221
public void setMediumTickMarkColor ( final Color COLOR ) { if ( null == mediumTickMarkColor ) { _mediumTickMarkColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { mediumTickMarkColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the medium tickmarks . This color will only be used if no tickmark section is defined at the position of the tickmark .
64
37
30,222
public void setMediumTickMarkLengthFactor ( final double FACTOR ) { if ( null == mediumTickMarkLengthFactor ) { _mediumTickMarkLengthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { mediumTickMarkLengthFactor . set ( FACTOR ) ; } }
The factor defines the length of the medium tick mark . It can be in the range from 0 - 1 .
85
22
30,223
public void setMediumTickMarkWidthFactor ( final double FACTOR ) { if ( null == mediumTickMarkWidthFactor ) { _mediumTickMarkWidthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { mediumTickMarkWidthFactor . set ( FACTOR ) ; } }
The factor defines the width of the medium tick mark . It can be in the range from 0 - 1 .
85
22
30,224
public void setMinorTickMarkColor ( final Color COLOR ) { if ( null == minorTickMarkColor ) { _minorTickMarkColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { minorTickMarkColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the minor tickmarks . This color will only be used if no tickmark section is defined at the position of the tickmark .
65
37
30,225
public void setMinorTickMarkLengthFactor ( final double FACTOR ) { if ( null == minorTickMarkLengthFactor ) { _minorTickMarkLengthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { minorTickMarkLengthFactor . set ( FACTOR ) ; } }
The factor defines the length of the minor tick mark . It can be in the range from 0 - 1 .
86
22
30,226
public void setMinorTickMarkWidthFactor ( final double FACTOR ) { if ( null == minorTickMarkWidthFactor ) { _minorTickMarkWidthFactor = Helper . clamp ( 0.0 , 1.0 , FACTOR ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { minorTickMarkWidthFactor . set ( FACTOR ) ; } }
The factor defines the width of the minor tick mark . It can be in the range from 0 - 1 .
86
22
30,227
public void setMajorTickMarkType ( final TickMarkType TYPE ) { if ( null == majorTickMarkType ) { _majorTickMarkType = null == TYPE ? TickMarkType . LINE : TYPE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { majorTickMarkType . set ( TYPE ) ; } }
Defines the shape that will be used to visualize the major tickmark . Values are LINE DOT TRAPEZOID BOX TICK_LABEL and PILL
73
33
30,228
public void setMediumTickMarkType ( final TickMarkType TYPE ) { if ( null == mediumTickMarkType ) { _mediumTickMarkType = null == TYPE ? TickMarkType . LINE : TYPE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { mediumTickMarkType . set ( TYPE ) ; } }
Defines the shape that will be used to visualize the medium tickmark . Values are LINE DOT TRAPEZOID BOX and PILL
73
28
30,229
public void setMinorTickMarkType ( final TickMarkType TYPE ) { if ( null == minorTickMarkType ) { _minorTickMarkType = null == TYPE ? TickMarkType . LINE : TYPE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { minorTickMarkType . set ( TYPE ) ; } }
Defines the shape that will be used to visualize the minor tickmark . Values are LINE DOT TRAPEZOID BOX and PILL
74
28
30,230
public void setNeedleSize ( final NeedleSize SIZE ) { if ( null == needleSize ) { _needleSize = null == SIZE ? NeedleSize . STANDARD : SIZE ; fireUpdateEvent ( RESIZE_EVENT ) ; } else { needleSize . set ( SIZE ) ; } }
Defines the thickness of the needle . The values are THIN STANDARD and THICK
68
18
30,231
public void setNeedleBehavior ( final NeedleBehavior BEHAVIOR ) { if ( null == needleBehavior ) { _needleBehavior = null == BEHAVIOR ? NeedleBehavior . STANDARD : BEHAVIOR ; } else { needleBehavior . set ( BEHAVIOR ) ; } }
Defines the behavior of the needle movement . The values are STANDARD and OPTIMIZED This is an experimental feature that only makes sense in gauges that use an angleRange of 360 degrees and where the needle should be able to use the shortest way to the target value . As an example one can think of a compass . If the value in a compass changes from 20 degrees to 290 degrees the needle will take the shortest way to the value in this case this means it will rotate counter - clockwise .
71
102
30,232
public void setNeedleColor ( final Color COLOR ) { if ( null == needleColor ) { _needleColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { needleColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the needle of the radial gauges .
54
19
30,233
public void setNeedleBorderColor ( final Color COLOR ) { if ( null == needleBorderColor ) { _needleBorderColor = null == COLOR ? Color . TRANSPARENT : COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { needleBorderColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the border of the needle .
70
17
30,234
public void setBarBorderColor ( final Color COLOR ) { if ( null == barBorderColor ) { _barBorderColor = null == COLOR ? Color . TRANSPARENT : COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { barBorderColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the border of the bar .
68
17
30,235
public void setLcdFont ( final LcdFont FONT ) { if ( null == lcdFont ) { _lcdFont = null == FONT ? LcdFont . DIGITAL_BOLD : FONT ; fireUpdateEvent ( RESIZE_EVENT ) ; } else { lcdFont . set ( FONT ) ; } }
Defines the font that will be used to visualize the LCD value if the gauge has a LCD display . The values are STANDARD LCD SLIM DIGITAL_BOLD ELEKTRA
74
38
30,236
public void setLedColor ( final Color COLOR ) { if ( null == ledColor ) { _ledColor = null == COLOR ? Color . RED : COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { ledColor . set ( COLOR ) ; } }
Defines the color that will be used to visualize the LED of the gauge if it has one .
61
20
30,237
public void setSubTitleColor ( final Color COLOR ) { if ( null == subTitleColor ) { _subTitleColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { subTitleColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the subTitle of the gauge .
56
18
30,238
public void setAverageColor ( final Color COLOR ) { if ( null == averageColor ) { _averageColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { averageColor . set ( COLOR ) ; } }
Defines the color that will be used to colorize the average indicator of the gauge .
52
18
30,239
public void setAreaTextVisible ( final boolean VISIBLE ) { if ( null == areaTextVisible ) { _areaTextVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { areaTextVisible . set ( VISIBLE ) ; } }
Defines if the text of the areas should be drawn inside the areas .
60
15
30,240
public void setAreaIconsVisible ( final boolean VISIBLE ) { if ( null == areaIconsVisible ) { _areaIconsVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { areaIconsVisible . set ( VISIBLE ) ; } }
Defines if the icon of the areas should be drawn inside the areas .
64
15
30,241
public void setTickMarkSectionsVisible ( final boolean VISIBLE ) { if ( null == tickMarkSectionsVisible ) { _tickMarkSectionsVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { tickMarkSectionsVisible . set ( VISIBLE ) ; } }
Defines if the tickmark sections should be used to colorize the tickmarks .
73
17
30,242
public void setTickLabelSectionsVisible ( final boolean VISIBLE ) { if ( null == tickLabelSectionsVisible ) { _tickLabelSectionsVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { tickLabelSectionsVisible . set ( VISIBLE ) ; } }
Defines if the ticklabel sections should be used to colorize the ticklabels .
73
18
30,243
public void setMarkersVisible ( final boolean VISIBLE ) { if ( null == markersVisible ) { _markersVisible = VISIBLE ; fireUpdateEvent ( VISIBILITY_EVENT ) ; } else { markersVisible . set ( VISIBLE ) ; } }
Defines if the markers should be drawn
59
8
30,244
public void setOnlyFirstAndLastTickLabelVisible ( final boolean VISIBLE ) { if ( null == onlyFirstAndLastTickLabelVisible ) { _onlyFirstAndLastTickLabelVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { onlyFirstAndLastTickLabelVisible . set ( VISIBLE ) ; } }
Defines if only the first and the last ticklabel will be drawn . Sometimes this could be useful if a gauge should for example only should show 0 and 1000 .
80
33
30,245
public void setMajorTickMarksVisible ( final boolean VISIBLE ) { if ( null == majorTickMarksVisible ) { _majorTickMarksVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { majorTickMarksVisible . set ( VISIBLE ) ; } }
Defines if the major tickmarks should be drawn If set to false and minorTickmarks == true a minor tickmark will be drawn instead of the major tickmark .
72
35
30,246
public void setMinorTickMarksVisible ( final boolean VISIBLE ) { if ( null == minorTickMarksVisible ) { _minorTickMarksVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { minorTickMarksVisible . set ( VISIBLE ) ; } }
Defines if the minor tickmarks should be drawn
73
10
30,247
public void setTickMarkRingVisible ( final boolean VISIBLE ) { if ( null == tickMarkRingVisible ) { _tickMarkRingVisible = VISIBLE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { tickMarkRingVisible . set ( VISIBLE ) ; } }
Defines if an additional ring should be drawn that connects the tick marks .
65
15
30,248
public void setOrientation ( final Orientation ORIENTATION ) { if ( null == orientation ) { _orientation = ORIENTATION ; fireUpdateEvent ( RESIZE_EVENT ) ; } else { orientation . set ( ORIENTATION ) ; } }
Defines the orientation of the control . This feature will only be used in the BulletChartSkin and LinearSkin . Values are HORIZONTAL and VERTICAL
55
33
30,249
public void setCustomTickLabelsEnabled ( final boolean ENABLED ) { if ( null == customTickLabelsEnabled ) { _customTickLabelsEnabled = ENABLED ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { customTickLabelsEnabled . set ( ENABLED ) ; } }
Defines if custom ticklabels should be used instead of the automatically calculated ones . This could be useful for gauges like a compass where you need N E S and W instead of numbers .
74
39
30,250
public void addCustomTickLabel ( final String TICK_LABEL ) { if ( null == TICK_LABEL ) return ; if ( ! customTickLabels . contains ( TICK_LABEL ) ) customTickLabels . add ( TICK_LABEL ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Adds the given String to the list of custom ticklabels
74
12
30,251
public void removeCustomTickLabel ( final String TICK_LABEL ) { if ( null == TICK_LABEL ) return ; if ( customTickLabels . contains ( TICK_LABEL ) ) customTickLabels . remove ( TICK_LABEL ) ; fireUpdateEvent ( REDRAW_EVENT ) ; }
Removes the given String from the list of custom ticklabels
73
13
30,252
public void setCustomTickLabelFontSize ( final double SIZE ) { if ( null == customTickLabelFontSize ) { _customTickLabelFontSize = Helper . clamp ( 0.0 , 72.0 , SIZE ) ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { customTickLabelFontSize . set ( SIZE ) ; } }
Defines the custom font size . The default font size is 18px at a size of 250px . This value will be used to calculate the current font size for the ticklabels when scaling .
78
40
30,253
public void setInteractive ( final boolean INTERACTIVE ) { if ( null == interactive ) { _interactive = INTERACTIVE ; fireUpdateEvent ( INTERACTIVITY_EVENT ) ; } else { interactive . set ( INTERACTIVE ) ; } }
Defines if the gauge is in interactive mode . This is currently implemented in the radial gauges that have a knob . If interactive == true the knob can be pressed to trigger something .
55
37
30,254
public void setButtonTooltipText ( final String TEXT ) { if ( null == buttonTooltipText ) { _buttonTooltipText = TEXT ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { buttonTooltipText . set ( TEXT ) ; } }
Defines the text that will be shown in the button tooltip . The knob in the radial gauges acts as button if interactive == true .
57
28
30,255
public void setAlertMessage ( final String MESSAGE ) { if ( null == alertMessage ) { _alertMessage = MESSAGE ; fireUpdateEvent ( ALERT_EVENT ) ; } else { alertMessage . set ( MESSAGE ) ; } }
Defines the text that could be used in a tooltip as an alert message .
58
16
30,256
public void stop ( ) { setLedOn ( false ) ; if ( null != blinkFuture ) { blinkFuture . cancel ( true ) ; } if ( null != blinkService ) { blinkService . shutdownNow ( ) ; } }
Calling this method will stop all threads . This is needed when using JavaFX on mobile devices when the device goes to sleep mode .
48
26
30,257
public void setValue ( final double VALUE ) { if ( null == value ) { _value = VALUE ; } else { value . set ( VALUE ) ; } fireMarkerEvent ( VALUE_CHANGED_EVENT ) ; }
Defines the value for the marker
53
7
30,258
public void setText ( final String TEXT ) { if ( null == text ) { _text = TEXT ; } else { text . set ( TEXT ) ; } fireMarkerEvent ( TEXT_CHANGED_EVENT ) ; }
Defines a text for this marker . This text can be used as a description and will be used in tooltips .
49
24
30,259
public void setColor ( final Color COLOR ) { if ( null == color ) { _color = COLOR ; } else { color . set ( COLOR ) ; } fireMarkerEvent ( COLOR_CHANGED_EVENT ) ; }
Defines the color that will be used to colorize the marker .
53
14
30,260
public void setMarkerType ( final MarkerType TYPE ) { if ( null == markerType ) { _markerType = null == TYPE ? MarkerType . STANDARD : TYPE ; } else { markerType . set ( TYPE ) ; } fireMarkerEvent ( TYPE_CHANGED_EVENT ) ; }
Defines the shape that will be used to visualize the marker . The values are STANDARD DOT TRAPEZOID .
68
25
30,261
@ SuppressWarnings ( "unused" ) @ Override public void onPaymentSuccess ( String razorpayPaymentID ) { try { Toast . makeText ( this , "Payment Successful: " + razorpayPaymentID , Toast . LENGTH_SHORT ) . show ( ) ; } catch ( Exception e ) { Log . e ( TAG , "Exception in onPaymentSuccess" , e ) ; } }
The name of the function has to be onPaymentSuccess Wrap your code in try catch as shown to ensure that this method runs correctly
93
27
30,262
@ SuppressWarnings ( "unused" ) @ Override public void onPaymentError ( int code , String response ) { try { Toast . makeText ( this , "Payment failed: " + code + " " + response , Toast . LENGTH_SHORT ) . show ( ) ; } catch ( Exception e ) { Log . e ( TAG , "Exception in onPaymentError" , e ) ; } }
The name of the function has to be onPaymentError Wrap your code in try catch as shown to ensure that this method runs correctly
92
27
30,263
public static < T extends View > T mount ( T v , Renderable r ) { Mount m = new Mount ( v , r ) ; mounts . put ( v , m ) ; render ( v ) ; return v ; }
Mounts a renderable function defining the layout into a View . If host is a viewgroup it is assumed to be empty so the Renderable would define what its child views would be .
47
38
30,264
@ SuppressWarnings ( "unchecked" ) public static < T extends View > T currentView ( ) { if ( currentMount == null ) { return null ; } return ( T ) currentMount . iterator . currentView ( ) ; }
Returns currently rendered View . It allows to access the real view from inside the Renderable .
52
18
30,265
static public List < ? > getContent ( NDArray array ) { Object content = array . getContent ( ) ; return asJavaList ( array , ( List < ? > ) content ) ; }
Gets the payload of a one - dimensional array .
41
11
30,266
static public List < ? > getContent ( NDArray array , String key ) { Map < String , ? > content = ( Map < String , ? > ) array . getContent ( ) ; return asJavaList ( array , ( List < ? > ) content . get ( key ) ) ; }
Gets the payload of the specified dimension of a multi - dimensional array .
62
15
30,267
private void launchServer ( ) { try { log . info ( "Configuring Android SDK" ) ; if ( config . getAndroidHome ( ) != null ) { AndroidSdk . setAndroidHome ( config . getAndroidHome ( ) ) ; } if ( config . getAndroidSdkVersion ( ) != null ) { AndroidSdk . setAndroidSdkVersion ( config . getAndroidSdkVersion ( ) ) ; } if ( config . getBuildToolsVersion ( ) != null ) { AndroidSdk . setBuildToolsVersion ( config . getBuildToolsVersion ( ) ) ; } if ( config . getAvdManager ( ) != null ) { AndroidSdk . setAvdManagerHome ( config . getAvdManager ( ) ) ; } if ( config . getAdbHome ( ) != null ) { AndroidSdk . setAdbHome ( config . getAdbHome ( ) ) ; } log . info ( "Using Android SDK installed in: " + AndroidSdk . androidHome ( ) ) ; log . info ( "Using Android SDK version: " + AndroidSdk . androidSdkFolder ( ) . getAbsolutePath ( ) ) ; log . info ( "Using build-tools in: " + AndroidSdk . buildToolsFolder ( ) . getAbsolutePath ( ) ) ; log . info ( "Using adb in: " + AndroidSdk . adb ( ) . getAbsolutePath ( ) ) ; log . info ( "Starting Selendroid standalone on port " + config . getPort ( ) ) ; server = new SelendroidStandaloneServer ( config ) ; server . start ( ) ; } catch ( AndroidSdkException e ) { log . severe ( "Selendroid standalone was not able to interact with the Android SDK: " + e . getMessage ( ) ) ; log . severe ( "Please make sure you have the latest version with the latest updates installed: " ) ; log . severe ( "http://developer.android.com/sdk/index.html" ) ; throw Throwables . propagate ( e ) ; } catch ( Exception e ) { log . severe ( "Error building server: " + e . getMessage ( ) ) ; throw Throwables . propagate ( e ) ; } Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { public void run ( ) { log . info ( "Shutting down Selendroid standalone" ) ; stopSelendroid ( ) ; } } ) ; }
Starts the Selendroid standalone server and exits immediately . This method might return before the server is ready to receive requests .
528
25
30,268
public void launchSelendroid ( ) { launchServer ( ) ; if ( config . isGrid ( ) ) { // Longer timeout to allow for grid registration HttpClientUtil . waitForServer ( server . getPort ( ) , 3 , TimeUnit . MINUTES ) ; } else { HttpClientUtil . waitForServer ( server . getPort ( ) , 20 , TimeUnit . SECONDS ) ; } }
Starts the Selendroid standalone server and waits until it s ready to accept requests .
92
18
30,269
public AndroidElement get ( String elementId ) { AndroidElement element = cache . get ( elementId ) ; if ( element instanceof AndroidNativeElement ) { if ( ! ViewHierarchyAnalyzer . getDefaultInstance ( ) . isViewChieldOfCurrentRootView ( ( ( AndroidNativeElement ) element ) . getView ( ) ) ) { return null ; } } return element ; }
Uses the generated Id to look up elements
82
9
30,270
public static List < CallLogEntry > getAllLogsOfDuration ( List < CallLogEntry > logs , int duration , boolean greaterthan ) { List < CallLogEntry > list = new ArrayList < CallLogEntry > ( ) ; for ( CallLogEntry log : logs ) { if ( log . duration < duration ^ greaterthan ) { list . add ( log ) ; } } return list ; }
duration specifies call duration to test against .
85
8
30,271
public static boolean containsLogFromNumber ( List < CallLogEntry > logs , String number ) { for ( CallLogEntry log : logs ) { if ( log . number . equals ( number ) ) { return true ; } } return false ; }
returns true if call log of specified number exists
51
10
30,272
private InputStream getResourceAsStream ( String resource ) { InputStream is = getClass ( ) . getResourceAsStream ( resource ) ; // switch needed for testability if ( is == null ) { try { is = new FileInputStream ( new File ( resource ) ) ; } catch ( FileNotFoundException e ) { // do nothing } } if ( is == null ) { throw new SelendroidException ( "The resource '" + resource + "' was not found." ) ; } return is ; }
Loads resources as stream and the main reason for having the method is because it can be use while testing and in production for loading files from within jar file .
107
32
30,273
@ Override public void setSystemProperty ( String propertyName , String value ) { if ( Strings . isNullOrEmpty ( propertyName ) ) { throw new IllegalArgumentException ( "Property name can't be empty." ) ; } execute ( "-selendroid-setAndroidOsSystemProperty" , ImmutableMap . of ( "propertyName" , propertyName , "value" , value ) ) ; }
Sets a Java System Property .
87
7
30,274
private JSONObject getNodeConfig ( ) { JSONObject res = new JSONObject ( ) ; try { res . put ( "class" , "org.openqa.grid.common.RegistrationRequest" ) ; res . put ( "configuration" , getConfiguration ( ) ) ; JSONArray caps = new JSONArray ( ) ; JSONArray devices = driver . getSupportedDevices ( ) ; for ( int i = 0 ; i < devices . length ( ) ; i ++ ) { JSONObject device = ( JSONObject ) devices . get ( i ) ; for ( int x = 0 ; x < driver . getSupportedApps ( ) . length ( ) ; x ++ ) { caps . put ( getDeviceConfig ( device , driver . getSupportedApps ( ) . getJSONObject ( x ) ) ) ; } } res . put ( "capabilities" , caps ) ; } catch ( JSONException e ) { throw new SelendroidException ( e . getMessage ( ) , e ) ; } return res ; }
Get the node configuration and capabilities for Grid registration
212
9
30,275
private JSONObject getConfiguration ( ) throws JSONException { JSONObject configuration = new JSONObject ( ) ; configuration . put ( "port" , config . getPort ( ) ) ; configuration . put ( "register" , true ) ; if ( config . getProxy ( ) != null ) { configuration . put ( "proxy" , config . getProxy ( ) ) ; } else { configuration . put ( "proxy" , "org.openqa.grid.selenium.proxy.DefaultRemoteProxy" ) ; } configuration . put ( "role" , "node" ) ; configuration . put ( "registerCycle" , config . getRegisterCycle ( ) ) ; if ( config . getMaxSession ( ) == 0 ) { configuration . put ( "maxSession" , driver . getSupportedDevices ( ) . length ( ) ) ; } else { configuration . put ( "maxSession" , config . getMaxSession ( ) ) ; } configuration . put ( "browserTimeout" , config . getSessionTimeoutMillis ( ) / 1000 ) ; configuration . put ( "cleanupCycle" , config . getCleanupCycle ( ) ) ; configuration . put ( "timeout" , config . getTimeout ( ) ) ; configuration . put ( "nodePolling" , config . getNodePolling ( ) ) ; configuration . put ( "unregisterIfStillDownAfter" , config . getUnregisterIfStillDownAfter ( ) ) ; configuration . put ( "downPollingLimit" , config . getDownPollingLimit ( ) ) ; configuration . put ( "nodeStatusCheckTimeout" , config . getNodeStatusCheckTimeout ( ) ) ; // adding hub details configuration . put ( "hubHost" , hub . getHost ( ) ) ; configuration . put ( "hubPort" , hub . getPort ( ) ) ; // adding driver details configuration . put ( "seleniumProtocol" , "WebDriver" ) ; configuration . put ( "host" , config . getServerHost ( ) ) ; configuration . put ( "remoteHost" , "http://" + config . getServerHost ( ) + ":" + config . getPort ( ) ) ; return configuration ; }
Extracts the configuration .
461
6
30,276
protected void startServerImpl ( ) { SelendroidLogger . info ( "*** ServerInstrumentation#startServerImpl() ***" ) ; if ( serverThread != null && serverThread . isAlive ( ) ) { return ; } if ( serverThread != null ) { stopServer ( ) ; } serverThread = new HttpdThread ( this , serverPort ) ; serverThread . startServer ( ) ; }
specific logic to a subclass
89
5
30,277
public TouchActionBuilder pointerDown ( WebElement element , int x , int y ) { Preconditions . checkState ( ! isDown ) ; Map < String , Object > params = getTouchParameters ( element , x , y ) ; addAction ( TouchActionName . POINTER_DOWN , params ) ; isDown = true ; return this ; }
Places pointer down at an offset from the top left corner of the specified WebElement
73
17
30,278
public TouchActionBuilder pointerMove ( WebElement element , int x , int y ) { Preconditions . checkState ( isDown ) ; Map < String , Object > params = getTouchParameters ( element , x , y ) ; addAction ( TouchActionName . POINTER_MOVE , params ) ; return this ; }
Moves the pointer to a position offset from the top left corner of the specified WebElement This is only possible if the pointer is currently down .
68
29
30,279
protected void sleep ( ) { try { Thread . sleep ( sleepIntervalInMillis ) ; } catch ( InterruptedException exception ) { Thread . currentThread ( ) . interrupt ( ) ; throw new SelendroidException ( exception ) ; } }
Sleeps for a few milliseconds .
52
7
30,280
public void addToAppsStore ( File file ) throws AndroidSdkException { AndroidApp app = null ; try { app = selendroidApkBuilder . resignApp ( file ) ; } catch ( Exception e ) { throw new SessionNotCreatedException ( "An error occurred while resigning the app '" + file . getName ( ) + "'. " , e ) ; } String appId = null ; try { appId = app . getAppId ( ) ; } catch ( AndroidSdkException e ) { log . info ( "Ignoring app because an error occurred reading the app details: " + file . getAbsolutePath ( ) ) ; log . info ( e . getMessage ( ) ) ; } if ( appId != null && ! appsStore . containsKey ( appId ) ) { appsStore . put ( appId , app ) ; log . info ( "App " + appId + " has been added to selendroid standalone server." ) ; } }
This function will sign an android app and add it to the App Store . The function is made public because it also be invoked by the Folder Monitor each time a new application dropped into this folder .
209
39
30,281
private void startFolderMonitor ( ) { if ( serverConfiguration . getAppFolderToMonitor ( ) != null ) { try { folderMonitor = new FolderMonitor ( this , serverConfiguration ) ; folderMonitor . start ( ) ; } catch ( IOException e ) { log . warning ( "Could not monitor the given folder: " + serverConfiguration . getAppFolderToMonitor ( ) ) ; } } }
Applications folder .
83
3
30,282
private String readFile ( File file ) { BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( file ) ) ; String line = null ; StringBuilder sb = new StringBuilder ( ) ; String separator = System . getProperty ( "line.separator" ) ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) . append ( separator ) ; } return sb . toString ( ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( "We already made sure the extra args file exists" , e ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error while reading from extra args file" , e ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { SelendroidLogger . error ( "Failed to close reader for args file" , e ) ; } } } }
There s no nio on Android and it s not worth importing Apache commons
214
15
30,283
public static Intent createStartActivityIntent ( Context context , String mainActivityName ) { Intent intent = new Intent ( ) ; intent . setClassName ( context , mainActivityName ) ; intent . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK | Intent . FLAG_ACTIVITY_REORDER_TO_FRONT | Intent . FLAG_ACTIVITY_SINGLE_TOP | Intent . FLAG_ACTIVITY_CLEAR_TOP ) ; intent . setAction ( Intent . ACTION_MAIN ) ; intent . addCategory ( Intent . CATEGORY_LAUNCHER ) ; return intent ; }
Create an intent to start an activity for both ServerInstrumentation and LightweightInstrumentation
141
19
30,284
public static Intent createUriIntent ( String intentAction , String intentUri ) { if ( intentAction == null ) { intentAction = Intent . ACTION_VIEW ; } return new Intent ( intentAction , Uri . parse ( intentUri ) ) . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK | Intent . FLAG_ACTIVITY_REORDER_TO_FRONT | Intent . FLAG_ACTIVITY_SINGLE_TOP | Intent . FLAG_ACTIVITY_CLEAR_TOP ) ; }
Create an implicit intent based on the given URI .
121
10
30,285
public static Intent createStartServiceIntent ( Context context , String serviceClassName , String intentAction ) { Intent intent = intentAction != null ? new Intent ( intentAction ) : new Intent ( ) ; return intent . setClassName ( context , serviceClassName ) ; }
Create an Intent to start a service using the given class name and action .
57
15
30,286
private List < String > getDomainsFromUrl ( URL url ) { String host = url . getHost ( ) ; String [ ] paths = new String [ ] { } ; if ( url . getPath ( ) != null ) { paths = url . getPath ( ) . split ( "/" ) ; } List < String > domains = new ArrayList < String > ( paths . length + 1 ) ; StringBuilder relative = new StringBuilder ( ) . append ( "http://" ) . append ( host ) . append ( "/" ) ; domains . add ( relative . toString ( ) ) ; for ( String path : paths ) { if ( path . length ( ) > 0 ) { relative . append ( path ) . append ( "/" ) ; domains . add ( relative . toString ( ) ) ; } } return domains ; }
Gets the list of domains associated to a URL .
176
11
30,287
public static SelendroidResponse forCatchAllError ( String sessionId , Throwable e ) { try { return new SelendroidResponse ( sessionId , StatusCode . UNKNOWN_ERROR . getCode ( ) , e , CATCH_ALL_ERROR_MESSAGE_PREFIX ) ; } catch ( JSONException err ) { return new SelendroidResponse ( sessionId , StatusCode . UNKNOWN_ERROR . getCode ( ) ) ; } }
It is currently hard to detect whether a test failed because of a legitimate error by a developer or because something is going wrong in selendroid internals . This response marks error responses from the server that indicate something has gone wrong in the internals of selendroid .
99
56
30,288
public void release ( AndroidDevice device , AndroidApp aut ) { log . info ( "Releasing device " + device ) ; if ( devicesInUse . contains ( device ) ) { if ( aut != null ) { // stop the app anyway - better in case people do use snapshots try { device . kill ( aut ) ; } catch ( Exception e ) { log . log ( Level . WARNING , "Failed to kill android application when releasing device" , e ) ; } if ( clearData ) { try { device . clearUserData ( aut ) ; } catch ( AndroidSdkException e ) { log . log ( Level . WARNING , "Failed to clear user data of application" , e ) ; } } } if ( device instanceof AndroidEmulator && ! ( aut instanceof InstalledAndroidApp ) && ! keepEmulator ) { AndroidEmulator emulator = ( AndroidEmulator ) device ; try { emulator . stop ( ) ; } catch ( AndroidDeviceException e ) { log . severe ( "Failed to stop emulator: " + e . getMessage ( ) ) ; } androidEmulatorPortFinder . release ( emulator . getPort ( ) ) ; } devicesInUse . remove ( device ) ; } }
After a test session a device should be released . That means id will be removed from the list of devices in use and in case of an emulator it will be stopped .
256
34
30,289
protected synchronized void addDeviceToStore ( AndroidDevice device ) throws AndroidDeviceException { if ( androidDevices . containsKey ( device . getTargetPlatform ( ) ) ) { List < AndroidDevice > platformDevices = androidDevices . get ( device . getTargetPlatform ( ) ) ; if ( ! platformDevices . contains ( device ) ) { platformDevices . add ( device ) ; } } else { androidDevices . put ( device . getTargetPlatform ( ) , Lists . newArrayList ( device ) ) ; } }
Internal method to add an actual device to the store .
112
11
30,290
@ Override public void send ( final CharSequence text ) { final KeyCharacterMap characterMap = KeyCharacterMap . load ( KeyCharacterMap . VIRTUAL_KEYBOARD ) ; long timeout = System . currentTimeMillis ( ) + serverInstrumentation . getAndroidWait ( ) . getTimeoutInMillis ( ) ; SelendroidLogger . info ( "Using timeout of " + timeout + " milli seconds." ) ; done = false ; instrumentation . runOnMainSync ( new Runnable ( ) { public void run ( ) { for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char c = text . charAt ( i ) ; int code = WebViewKeys . getKeyEventFromUnicodeKey ( c ) ; if ( code != - 1 ) { webview . dispatchKeyEvent ( new KeyEvent ( KeyEvent . ACTION_DOWN , code ) ) ; webview . dispatchKeyEvent ( new KeyEvent ( KeyEvent . ACTION_UP , code ) ) ; } else { KeyEvent [ ] arr = characterMap . getEvents ( new char [ ] { c } ) ; if ( arr != null ) { for ( int j = 0 ; j < arr . length ; j ++ ) { webview . dispatchKeyEvent ( arr [ j ] ) ; } } } } done = true ; } } ) ; }
Sends key strokes to the given text to the element in focus within the webview .
294
18
30,291
public SelendroidCapabilities addBootstrapClass ( String className ) { String currentClassNames = getBootstrapClassNames ( ) ; if ( currentClassNames == null || currentClassNames . isEmpty ( ) ) { setCapability ( BOOTSTRAP_CLASS_NAMES , className ) ; } else { setCapability ( BOOTSTRAP_CLASS_NAMES , currentClassNames + "," + className ) ; } return this ; }
Adds a class to run on app startup . Class names are stored as a string separated by commas .
98
21
30,292
private String getDefaultVersion ( Set < String > keys , String appName ) { SortedSet < String > listOfApps = new TreeSet < String > ( ) ; for ( String key : keys ) { if ( key . split ( ":" ) [ 0 ] . contentEquals ( appName ) ) { listOfApps . add ( key ) ; } } return listOfApps . size ( ) > 0 ? listOfApps . last ( ) : null ; }
the latest version of the app .
99
7
30,293
private Boolean getBooleanCapability ( String key ) { Object o = getRawCapabilities ( ) . get ( key ) ; if ( o == null ) { return null ; } else if ( o instanceof Boolean ) { return ( Boolean ) o ; } else if ( o instanceof String && ( "true" . equalsIgnoreCase ( ( String ) o ) || "false" . equalsIgnoreCase ( ( String ) o ) ) ) { return Boolean . valueOf ( ( String ) o ) ; } else { throw new ClassCastException ( String . format ( "DesiredCapability %s's value should be boolean: found value %s of type %s" , key , o . toString ( ) , o . getClass ( ) . getName ( ) ) ) ; } }
throws exception if user didn t pass the capability as a boolean or String parsable as boolean
168
19
30,294
public Point getLocation ( ) { JSONObject result = ( JSONObject ) driver . executeAtom ( AndroidAtoms . GET_TOP_LEFT_COORDINATES , null , this ) ; try { return new Point ( result . getInt ( "x" ) , result . getInt ( "y" ) ) ; } catch ( JSONException e ) { throw new SelendroidException ( e ) ; } }
Where on the page is the top left - hand corner of the rendered element? it s part of RenderedWebElement
89
24
30,295
protected void initializeAdbConnection ( ) { // Get a device bridge instance. Initialize, create and restart. try { AndroidDebugBridge . init ( false ) ; } catch ( IllegalStateException e ) { if ( ! shouldKeepAdbAlive ) { log . log ( Level . WARNING , "AndroidDebugBridge may have been already initialized at this point. It is OK to proceed." , e ) ; } } bridge = AndroidDebugBridge . getBridge ( ) ; if ( bridge == null ) { bridge = AndroidDebugBridge . createBridge ( adbPath , false ) ; } IDevice [ ] devices = bridge . getDevices ( ) ; AndroidDebugBridge . addDeviceChangeListener ( this ) ; // Add the existing devices to the list of devices we are tracking. if ( devices . length > 0 ) { for ( int i = 0 ; i < devices . length ; i ++ ) { deviceConnected ( devices [ i ] ) ; log . info ( "my devices: " + devices [ i ] . getAvdName ( ) ) ; } } else { long timeout = System . currentTimeMillis ( ) + 2000 ; while ( ( devices = bridge . getDevices ( ) ) . length == 0 && System . currentTimeMillis ( ) < timeout ) { try { Thread . sleep ( 50 ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } } if ( devices . length > 0 ) { for ( int i = 0 ; i < devices . length ; i ++ ) { deviceConnected ( devices [ i ] ) ; log . info ( "my devices: " + devices [ i ] . getAvdName ( ) ) ; } } } }
Initializes the AndroidDebugBridge and registers the DefaultHardwareDeviceManager with the AndroidDebugBridge device change listener .
361
22
30,296
public void shutdown ( ) { log . info ( "Notifying device listener about shutdown" ) ; for ( HardwareDeviceListener listener : deviceListeners ) { for ( AndroidDevice device : connectedDevices . values ( ) ) { listener . onDeviceDisconnected ( connectedDevices . get ( device ) ) ; } } log . info ( "Removing Device Manager listener from ADB" ) ; AndroidDebugBridge . removeDeviceChangeListener ( this ) ; if ( ! shouldKeepAdbAlive ) { AndroidDebugBridge . disconnectBridge ( ) ; } AndroidDebugBridge . terminate ( ) ; log . info ( "stopping Device Manager" ) ; // TODO add thread interrupt and join handling }
Shutdown the AndroidDebugBridge and clean up all connected devices .
145
13
30,297
@ Override protected void onDraw ( Canvas canvas ) { super . onDraw ( canvas ) ; canvas . drawOval ( rectF , backgroundPaint ) ; float realProgress = progress * DEFAULT_MAX_VALUE / progressMax ; float angle = ( rightToLeft ? 360 : - 360 ) * realProgress / 100 ; canvas . drawArc ( rectF , startAngle , angle , false , foregroundPaint ) ; }
region Draw Method
92
3
30,298
@ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { final int height = getDefaultSize ( getSuggestedMinimumHeight ( ) , heightMeasureSpec ) ; final int width = getDefaultSize ( getSuggestedMinimumWidth ( ) , widthMeasureSpec ) ; final int min = Math . min ( width , height ) ; setMeasuredDimension ( min , min ) ; float highStroke = strokeWidth > backgroundStrokeWidth ? strokeWidth : backgroundStrokeWidth ; rectF . set ( 0 + highStroke / 2 , 0 + highStroke / 2 , min - highStroke / 2 , min - highStroke / 2 ) ; }
region Mesure Method
152
4
30,299
public void setProgressWithAnimation ( float progress , int duration ) { if ( progressAnimator != null ) { progressAnimator . cancel ( ) ; } progressAnimator = ValueAnimator . ofFloat ( this . progress , progress ) ; progressAnimator . setDuration ( duration ) ; progressAnimator . addUpdateListener ( new ValueAnimator . AnimatorUpdateListener ( ) { @ Override public void onAnimationUpdate ( ValueAnimator animation ) { float progress = ( Float ) animation . getAnimatedValue ( ) ; setProgress ( progress , true ) ; if ( indeterminateMode ) { float updateAngle = progress * 360 / 100 ; startAngle = DEFAULT_START_ANGLE + ( rightToLeft ? updateAngle : - updateAngle ) ; } } } ) ; progressAnimator . start ( ) ; }
Set the progress with an animation .
179
7