Java Code Examples for android.view.View#removeCallbacks()
The following examples show how to use
android.view.View#removeCallbacks() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: android-project-wo2b File: ViewPropertyAnimatorPreHC.java License: Apache License 2.0 | 6 votes |
@Override public void cancel() { if (mAnimatorMap.size() > 0) { HashMap<Animator, PropertyBundle> mAnimatorMapCopy = (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone(); Set<Animator> animatorSet = mAnimatorMapCopy.keySet(); for (Animator runningAnim : animatorSet) { runningAnim.cancel(); } } mPendingAnimations.clear(); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); } }
Example 2
Source Project: UltimateAndroid File: ViewPropertyAnimatorHC.java License: Apache License 2.0 | 6 votes |
@Override public void cancel() { if (mAnimatorMap.size() > 0) { HashMap<Animator, PropertyBundle> mAnimatorMapCopy = (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone(); Set<Animator> animatorSet = mAnimatorMapCopy.keySet(); for (Animator runningAnim : animatorSet) { runningAnim.cancel(); } } mPendingAnimations.clear(); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); } }
Example 3
Source Project: UcMainPagerDemo File: UcNewsHeaderPagerBehavior.java License: Apache License 2.0 | 6 votes |
private void settle(CoordinatorLayout parent, final View child) { if (BuildConfig.DEBUG) { Log.d(TAG, "settle: "); } if (mFlingRunnable != null) { child.removeCallbacks(mFlingRunnable); mFlingRunnable = null; } mFlingRunnable = new FlingRunnable(parent, child); if (child.getTranslationY() < getHeaderOffsetRange() / 3.0f) { mFlingRunnable.scrollToClosed(DURATION_SHORT); } else { mFlingRunnable.scrollToOpen(DURATION_SHORT); } }
Example 4
Source Project: UCMainViewForBehavior File: UCViewHeaderBehavior.java License: Apache License 2.0 | 5 votes |
private void handlerActionUp(View child) { if (mFlingRunnable != null) { child.removeCallbacks(mFlingRunnable); mFlingRunnable = null; } mFlingRunnable = new FlingRunnable(child); if (child.getTranslationY() < getHeaderOffsetRange() / 4.0f) { mFlingRunnable.scrollToClosed(DURATION_SHORT); } else { mFlingRunnable.scrollToOpen(DURATION_SHORT); } }
Example 5
Source Project: UCMainViewForBehavior File: UCViewHeaderBehavior.java License: Apache License 2.0 | 5 votes |
/** * @param duration open animation duration */ public void openPager(int duration) { View child = mChild.get(); if (isClosed() && child != null) { if(child.getVisibility() == View.GONE) { child.setVisibility(View.VISIBLE); } if (mFlingRunnable != null) { child.removeCallbacks(mFlingRunnable); mFlingRunnable = null; } mFlingRunnable = new FlingRunnable(child); mFlingRunnable.scrollToOpen(duration); } }
Example 6
Source Project: letv File: ViewPropertyAnimatorCompat.java License: Apache License 2.0 | 5 votes |
private void postStartMessage(ViewPropertyAnimatorCompat vpa, View view) { Runnable runnable = null; if (this.mStarterMap != null) { runnable = (Runnable) this.mStarterMap.get(view); } if (runnable == null) { runnable = new Starter(vpa, view); if (this.mStarterMap == null) { this.mStarterMap = new WeakHashMap(); } this.mStarterMap.put(view, runnable); } view.removeCallbacks(runnable); view.post(runnable); }
Example 7
Source Project: android-project-wo2b File: ViewPropertyAnimatorPreHC.java License: Apache License 2.0 | 5 votes |
/** * Utility function, called by animateProperty() and animatePropertyBy(), which handles the * details of adding a pending animation and posting the request to start the animation. * * @param constantName The specifier for the property being animated * @param startValue The starting value of the property * @param byValue The amount by which the property will change */ private void animatePropertyBy(int constantName, float startValue, float byValue) { // First, cancel any existing animations on this property if (mAnimatorMap.size() > 0) { Animator animatorToCancel = null; Set<Animator> animatorSet = mAnimatorMap.keySet(); for (Animator runningAnim : animatorSet) { PropertyBundle bundle = mAnimatorMap.get(runningAnim); if (bundle.cancel(constantName)) { // property was canceled - cancel the animation if it's now empty // Note that it's safe to break out here because every new animation // on a property will cancel a previous animation on that property, so // there can only ever be one such animation running. if (bundle.mPropertyMask == NONE) { // the animation is no longer changing anything - cancel it animatorToCancel = runningAnim; break; } } } if (animatorToCancel != null) { animatorToCancel.cancel(); } } NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue); mPendingAnimations.add(nameValuePair); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); v.post(mAnimationStarter); } }
Example 8
Source Project: bither-android File: ColdAdvanceActivity.java License: Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { v.removeCallbacks(delay); clickedTime++; if (clickedTime >= 7) { new DialogEnterpriseHDMEnable(ColdAdvanceActivity.this).show(); clickedTime = 0; return; } v.postDelayed(delay, 400); }
Example 9
Source Project: adt-leanback-support File: ViewPropertyAnimatorCompat.java License: Apache License 2.0 | 5 votes |
private void postStartMessage(ViewPropertyAnimatorCompat vpa, View view) { Runnable starter = null; if (mStarterMap != null) { starter = mStarterMap.get(view); } if (starter == null) { starter = new Starter(vpa, view); if (mStarterMap == null) { mStarterMap = new WeakHashMap<View, Runnable>(); } mStarterMap.put(view, starter); } view.removeCallbacks(starter); view.post(starter); }
Example 10
Source Project: android-project-wo2b File: ViewPropertyAnimatorHC.java License: Apache License 2.0 | 5 votes |
/** * Utility function, called by animateProperty() and animatePropertyBy(), which handles the * details of adding a pending animation and posting the request to start the animation. * * @param constantName The specifier for the property being animated * @param startValue The starting value of the property * @param byValue The amount by which the property will change */ private void animatePropertyBy(int constantName, float startValue, float byValue) { // First, cancel any existing animations on this property if (mAnimatorMap.size() > 0) { Animator animatorToCancel = null; Set<Animator> animatorSet = mAnimatorMap.keySet(); for (Animator runningAnim : animatorSet) { PropertyBundle bundle = mAnimatorMap.get(runningAnim); if (bundle.cancel(constantName)) { // property was canceled - cancel the animation if it's now empty // Note that it's safe to break out here because every new animation // on a property will cancel a previous animation on that property, so // there can only ever be one such animation running. if (bundle.mPropertyMask == NONE) { // the animation is no longer changing anything - cancel it animatorToCancel = runningAnim; break; } } } if (animatorToCancel != null) { animatorToCancel.cancel(); } } NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue); mPendingAnimations.add(nameValuePair); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); v.post(mAnimationStarter); } }
Example 11
Source Project: libcommon File: ViewTransformDelegater.java License: Apache License 2.0 | 5 votes |
/** * 実行待機中のタスクがあればクリアする */ public void clearPendingTasks() { if (DEBUG) Log.v(TAG, "clearPendingTasks:"); final View view = getTargetView(); if (mWaitImageReset != null) view.removeCallbacks(mWaitImageReset); if (mStartCheckRotate != null) view.removeCallbacks(mStartCheckRotate); if (mWaitReverseReset != null) view.removeCallbacks(mWaitReverseReset); }
Example 12
Source Project: FoldableLayout File: Utils.java License: Apache License 2.0 | 5 votes |
static void postOnAnimation(View view, Runnable action) { view.removeCallbacks(action); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.postOnAnimationDelayed(action, FRAME_TIME); } else { view.postDelayed(action, FRAME_TIME); } }
Example 13
Source Project: DragLinearLayout File: NoteActivity.java License: MIT License | 5 votes |
/** * Opens or closes the IME. * If called in quick succession (i.e. before the message queue of the view is processed), * only the latest call will get executed. */ private void setImeVisibility(final View view, final boolean visible) { if (visible) { view.removeCallbacks(toggleImeRunnable); toggleImeRunnable = new Runnable() { public void run() { InputMethodManager imm = (InputMethodManager) NoteActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE); if (null != imm) { imm.showSoftInput(view, 0); } } }; view.post(toggleImeRunnable); } else { view.removeCallbacks(toggleImeRunnable); toggleImeRunnable = new Runnable() { public void run() { InputMethodManager imm = (InputMethodManager) NoteActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE); if (null != imm) { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } } }; view.post(toggleImeRunnable); } }
Example 14
Source Project: CoordinatorLayoutExample File: GroupHeaderBehavior.java License: Apache License 2.0 | 5 votes |
private void handleActionUp(CoordinatorLayout parent, final View child) { if (mFlingRunnable != null) { child.removeCallbacks(mFlingRunnable); mFlingRunnable = null; } mFlingRunnable = new FlingRunnable(parent, child); //notice is a negative number float targetHeight = getHeaderOffsetRange() / 8.0f; float childTranslationY = child.getTranslationY(); logD(TAG, "handleActionUp: childTranslationY=" + childTranslationY + "targetHeight=" + targetHeight + " mCurState= " + mCurState); if (mCurState == STATE_OPENED) { if (childTranslationY < targetHeight) { mFlingRunnable.scrollToClosed(DURATION_SHORT); } else { mFlingRunnable.scrollToOpen(DURATION_SHORT); } } else if (mCurState == STATE_CLOSED) { float percent = 1 - Math.abs(childTranslationY * 1.0f / getHeaderOffsetRange()); childTranslationY = getHeaderOffsetRange() - childTranslationY; logD(TAG, "handleActionUp: childTranslationY=" + childTranslationY + "percent=" + percent); if (percent < 0.15) { mFlingRunnable.scrollToClosed(DURATION_SHORT); } else { mFlingRunnable.scrollToOpen(DURATION_SHORT); } } }
Example 15
Source Project: AcDisplay File: TouchTracker.java License: GNU General Public License v2.0 | 4 votes |
void removeLongPressCallback(View target) { if (mPendingCheckForLongPress != null) { target.removeCallbacks(mPendingCheckForLongPress); } }
Example 16
Source Project: RippleDrawable File: DrawableHotspotTouch.java License: MIT License | 4 votes |
void removeTapCallback(View target){ if(mPendingCheckForTap != null){ target.removeCallbacks(mPendingCheckForTap); } }
Example 17
Source Project: FloatBall File: OnceRunnable.java License: Apache License 2.0 | 4 votes |
public void removeSelf(View carrier) { mScheduled = false; carrier.removeCallbacks(this); }
Example 18
Source Project: UltimateAndroid File: TouchTracker.java License: Apache License 2.0 | 4 votes |
void removeLongPressCallback(View target){ if (mPendingCheckForLongPress != null) { target.removeCallbacks(mPendingCheckForLongPress); } }
Example 19
Source Project: Mover File: TouchTracker.java License: Apache License 2.0 | 4 votes |
void removeTapCallback(View target){ if(mPendingCheckForTap != null){ target.removeCallbacks(mPendingCheckForTap); } }
Example 20
Source Project: ticdesign File: FocusLayoutHelper.java License: Apache License 2.0 | 4 votes |
private void stopPressConfirm(View view) { if (view != null) { view.removeCallbacks(mConfirmPressRunnable); } }