Interface Drawable.Callback
- All Known Implementing Classes:
AbsListView,AbsoluteLayout,AbsSeekBar,AbsSpinner,AdapterView,AnimationDrawable,Button,CheckableImageButton,CheckBox,ClipDrawable,ColorStateListDrawable,CompoundButton,CoordinatorLayout,DrawableContainer,DrawableWrapper,DropDownListView,EditText,ExpandableListView,FragmentContainerView,FrameLayout,GridLayout,GridView,HorizontalScrollView,ImageButton,ImageView,InsetDrawable,LayerDrawable,LevelListDrawable,LinearLayout,LinearPagerIndicator,ListView,MaterialCheckBox,MaterialRadioButton,NestedScrollView,ProgressBar,RadioButton,RadioGroup,RelativeLayout,RelativeRadioGroup,RippleDrawable,ScaleDrawable,ScrollView,SeekBar,Spinner,StateListDrawable,Switch,SwitchButton,TabLayout,TabLayout.TabView,TableLayout,TableRow,TestFragment.TestLinearLayout,TextView,ToggleButton,View,ViewGroup,ViewPager
- Enclosing class:
Drawable
public static interface Drawable.Callback
Implement this interface if you want to create an animated drawable that
extends
Drawable.
Upon retrieving a drawable, use
Drawable.setCallback(Callback)
to supply your implementation of the interface to the drawable; it uses
this interface to schedule and execute animation changes.-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the drawable needs to be redrawn.voidscheduleDrawable(Drawable who, Runnable what, long when) A Drawable can call this to schedule the next frame of its animation.voidunscheduleDrawable(Drawable who, Runnable what) A Drawable can call this to unschedule an action previously scheduled withscheduleDrawable(icyllis.modernui.graphics.drawable.Drawable, java.lang.Runnable, long).
-
Method Details
-
invalidateDrawable
Called when the drawable needs to be redrawn. A view at this point should invalidate itself (or at least the part of itself where the drawable appears).- Parameters:
who- The drawable that is requesting the update.
-
scheduleDrawable
A Drawable can call this to schedule the next frame of its animation. An implementation can generally simply callHandler.postAtTime(Runnable, Object, long)with the parameters (what, who, when) to perform the scheduling.- Parameters:
who- The drawable being scheduled.what- The action to execute.when- The time (in milliseconds) to run. The timebase isCore.timeMillis()
-
unscheduleDrawable
A Drawable can call this to unschedule an action previously scheduled withscheduleDrawable(icyllis.modernui.graphics.drawable.Drawable, java.lang.Runnable, long). An implementation can generally simply callHandler.removeCallbacks(Runnable, Object)with the parameters (what, who) to unschedule the drawable.- Parameters:
who- The drawable being unscheduled.what- The action being unscheduled.
-