當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewTreeObserver.removeOnPreDrawListener方法代碼示例

本文整理匯總了Java中android.view.ViewTreeObserver.removeOnPreDrawListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewTreeObserver.removeOnPreDrawListener方法的具體用法?Java ViewTreeObserver.removeOnPreDrawListener怎麽用?Java ViewTreeObserver.removeOnPreDrawListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewTreeObserver的用法示例。


在下文中一共展示了ViewTreeObserver.removeOnPreDrawListener方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPreDraw

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override public boolean onPreDraw() {
  ImageView target = this.target.get();
  if (target == null) {
    return true;
  }

  ViewTreeObserver vto = target.getViewTreeObserver();
  if (!vto.isAlive()) {
    return true;
  }

  int width = target.getWidth();
  int height = target.getHeight();

  if (width <= 0 || height <= 0 || target.isLayoutRequested()) {
    return true;
  }

  target.removeOnAttachStateChangeListener(this);
  vto.removeOnPreDrawListener(this);
  this.target.clear();

  this.creator.unfit().resize(width, height).into(target, callback);
  return true;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:DeferredRequestCreator.java

示例2: cancel

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
void cancel() {
  creator.clearTag();
  callback = null;

  ImageView target = this.target.get();
  if (target == null) {
    return;
  }
  this.target.clear();

  target.removeOnAttachStateChangeListener(this);

  ViewTreeObserver vto = target.getViewTreeObserver();
  if (vto.isAlive()) {
    vto.removeOnPreDrawListener(this);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:DeferredRequestCreator.java

示例3: clearCallbacksAndListener

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
void clearCallbacksAndListener() {
  // Keep a reference to the layout listener and remove it here
  // rather than having the observer remove itself because the observer
  // we add the listener to will be almost immediately merged into
  // another observer and will therefore never be alive. If we instead
  // keep a reference to the listener and remove it here, we get the
  // current view tree observer and should succeed.
  ViewTreeObserver observer = view.getViewTreeObserver();
  if (observer.isAlive()) {
    observer.removeOnPreDrawListener(layoutListener);
  }
  layoutListener = null;
  cbs.clear();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:ViewTarget.java

示例4: clearCallbacksAndListener

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
void clearCallbacksAndListener() {
  // Keep a reference to the layout attachStateListener and remove it here
  // rather than having the observer remove itself because the observer
  // we add the attachStateListener to will be almost immediately merged into
  // another observer and will therefore never be alive. If we instead
  // keep a reference to the attachStateListener and remove it here, we get the
  // current view tree observer and should succeed.
  ViewTreeObserver observer = view.getViewTreeObserver();
  if (observer.isAlive()) {
    observer.removeOnPreDrawListener(layoutListener);
  }
  layoutListener = null;
  cbs.clear();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:ViewTarget.java

示例5: onDetachedFromWindow

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
protected void onDetachedFromWindow() {
    if (mGlobalListenersAdded) {
        ViewTreeObserver observer = getViewTreeObserver();
        observer.removeOnScrollChangedListener(mScrollChangedListener);
        observer.removeOnPreDrawListener(mDrawListener);
        mGlobalListenersAdded = false;
    }
    mRequestedVisible = false;
    updateWindow(false, false);
    mLayout.token = null;
    super.onDetachedFromWindow();
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:14,代碼來源:UpdateView.java

示例6: onPreDraw

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
public boolean onPreDraw() {
    if (!hasRef()) {
        return false;
    }

    final ViewTreeObserver observer = getWeakRef().get().getViewTreeObserver();
    if (observer == null || !observer.isAlive()) {
        return false;
    }

    observer.removeOnPreDrawListener(this);
    return onPreDraw(getWeakRef().get());
}
 
開發者ID:Tenor-Inc,項目名稱:tenor-android-demo-search,代碼行數:15,代碼來源:WeakRefOnPreDrawListener.java

示例7: onDetachedFromWindow

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
public void onDetachedFromWindow() {
  super.onDetachedFromWindow();
      resetTouchBehaviors(false);
  if (mNeedsPreDrawListener && mOnPreDrawListener != null) {
    final ViewTreeObserver vto = getViewTreeObserver();
    vto.removeOnPreDrawListener(mOnPreDrawListener);
  }
  if (mNestedScrollingTarget != null) {
    onStopNestedScroll(mNestedScrollingTarget);
  }
  mIsAttachedToWindow = false;
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:14,代碼來源:CoordinatorLayout.java

示例8: removePreDrawListener

import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
   * Remove the pre-draw listener if we're attached to a window and mark that we currently
   * do not need it when attached.
 */
void removePreDrawListener() {
  if (mIsAttachedToWindow) {
    if (mOnPreDrawListener != null) {
      final ViewTreeObserver vto = getViewTreeObserver();
      vto.removeOnPreDrawListener(mOnPreDrawListener);
    }
  }
  mNeedsPreDrawListener = false;
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:14,代碼來源:CoordinatorLayout.java


注:本文中的android.view.ViewTreeObserver.removeOnPreDrawListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。