Java Code Examples for android.view.View.unscheduleDrawable()

The following are Jave code examples for showing how to use unscheduleDrawable() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: LuaViewPlayground   File: ForegroundDelegate.java   Source Code and License Vote up 6 votes
/**
 * Supply a Drawable that is to be rendered on top of all of the child
 * views in the frame layout.  Any padding in the Drawable will be taken
 * into account by ensuring that the children are inset to be placed
 * inside of the padding area.
 *
 * @param drawable The Drawable to be drawn on top of the children.
 */
public void setForeground(View view, Drawable drawable) {
    if (view != null) {
        if (mForeground != drawable) {
            if (mForeground != null) {
                mForeground.setCallback(null);
                view.unscheduleDrawable(mForeground);
            }

            mForeground = drawable;

            if (drawable != null) {
                view.setWillNotDraw(false);
                drawable.setCallback(view);
                if (drawable.isStateful()) {
                    drawable.setState(view.getDrawableState());
                }
                if (mForegroundGravity == Gravity.FILL) {
                    Rect padding = new Rect();
                    drawable.getPadding(padding);
                }

                //update bounds
                updateBounds(view, drawable);//added by song
            } else {
                view.setWillNotDraw(true);
            }
            view.requestLayout();
            view.invalidate();
        }
    }
}
 
Example 2
Project: PaoMovie   File: MultiCallback.java   Source Code and License Vote up 5 votes
@Override
public void unscheduleDrawable(final Drawable who, final Runnable what) {
	for (int i = 0; i < mViewList.size(); i++) {
		final ViewWeakReference reference = mViewList.get(i);
		final View view = reference.get();
		if (view != null) {
			view.unscheduleDrawable(who);
		} else {
			// Always remove null references to reduce Set size
			mViewList.remove(reference);
		}
	}
}
 
Example 3
Project: PaoMovie   File: MultiCallback.java   Source Code and License Vote up 5 votes
@Override
public void unscheduleDrawable(final Drawable who, final Runnable what) {
	for (int i = 0; i < mViewList.size(); i++) {
		final ViewWeakReference reference = mViewList.get(i);
		final View view = reference.get();
		if (view != null) {
			view.unscheduleDrawable(who);
		} else {
			// Always remove null references to reduce Set size
			mViewList.remove(reference);
		}
	}
}