本文整理匯總了Java中android.view.ViewTreeObserver.removeGlobalOnLayoutListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewTreeObserver.removeGlobalOnLayoutListener方法的具體用法?Java ViewTreeObserver.removeGlobalOnLayoutListener怎麽用?Java ViewTreeObserver.removeGlobalOnLayoutListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.ViewTreeObserver
的用法示例。
在下文中一共展示了ViewTreeObserver.removeGlobalOnLayoutListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
public void cleanup() {
if(null != this.mImageView) {
ImageView imageView = (ImageView)this.mImageView.get();
if(null != imageView) {
ViewTreeObserver observer = imageView.getViewTreeObserver();
if(null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
imageView.setOnTouchListener((View.OnTouchListener)null);
this.cancelFling();
}
if(null != this.mGestureDetector) {
this.mGestureDetector.setOnDoubleTapListener((GestureDetector.OnDoubleTapListener)null);
}
this.mMatrixChangeListener = null;
this.mPhotoTapListener = null;
this.mViewTapListener = null;
this.mImageView = null;
}
}
示例2: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Clean-up the resources attached to this object. This needs to be called when the ImageView is
* no longer used. A good example is from {@link android.view.View#onDetachedFromWindow()} or
* from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
* {@link uk.co.senab.photoview.PhotoView}.
*/
@SuppressWarnings("deprecation")
public void cleanup() {
if (null == mImageView) {
return; // cleanup already done
}
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
}
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
}
// Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
示例3: onDetachedFromWindow
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
ActivityChooserModel dataModel = mAdapter.getDataModel();
if (dataModel != null) {
try {
dataModel.unregisterObserver(mModelDataSetOberver);
} catch (IllegalStateException e) {
//Oh, well... fixes issue #557
}
}
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeGlobalOnLayoutListener(mOnGlobalLayoutListener);
}
mIsAttachedToWindow = false;
}
示例4: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Clean-up the resources attached to this object. This needs to be called when the ImageView is
* no longer used. A good example is from {@link View#onDetachedFromWindow()} or
* from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
* {@link IPhotoView}.
*/
@SuppressWarnings("deprecation")
public void cleanup() {
if (null == mImageView) {
return; // cleanup already done
}
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
}
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
}
// Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
示例5: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Clean-up the resources attached to this object. This needs to be called when the ImageView is
* no longer used. A good example is from {@link View#onDetachedFromWindow()} or
* from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
*/
@SuppressWarnings("deprecation")
public void cleanup() {
if (null == mImageView) {
return; // cleanup already done
}
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
}
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
}
// Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
示例6: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Clean-up the resources attached to this object. This needs to be called when the ImageView is
* no longer used. A good example is from {@link View#onDetachedFromWindow()} or
* from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
* {@link PhotoView}.
*/
@SuppressWarnings("deprecation")
public void cleanup() {
if (null == mImageView) {
return; // cleanup already done
}
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
}
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
}
// Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
示例7: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
public void cleanup() {
if (this.mImageView != null) {
ImageView imageView = (ImageView) this.mImageView.get();
if (imageView != null) {
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (observer != null && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
imageView.setOnTouchListener(null);
cancelFling();
}
if (this.mGestureDetector != null) {
this.mGestureDetector.setOnDoubleTapListener(null);
}
this.mMatrixChangeListener = null;
this.mPhotoTapListener = null;
this.mViewTapListener = null;
this.mImageView = null;
}
}
示例8: cleanup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Clean-up the resources attached to this object. This needs to be called when the ImageView is
* no longer used. A good example is from {@link android.view.View#onDetachedFromWindow()} or
* from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
* {@link opensource.component.photoview.PhotoView}.
*/
@SuppressWarnings("deprecation")
public final void cleanup() {
if (null == mImageView) {
return; // cleanup already done
}
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
}
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
}
// Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
示例9: removeOnGlobalLayoutListener
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
private static void removeOnGlobalLayoutListener(ViewTreeObserver observer, ViewTreeObserver.OnGlobalLayoutListener listener) {
if (observer == null) {
return ;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
observer.removeGlobalOnLayoutListener(listener);
} else {
observer.removeOnGlobalLayoutListener(listener);
}
}
示例10: removeGlobalLayoutListener
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static void removeGlobalLayoutListener(ViewTreeObserver viewTreeObserver, OnGlobalLayoutListener keyboardListener) {
if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
ApiSixteenPlus.removeGlobalLayoutListener(viewTreeObserver, keyboardListener);
} else {
viewTreeObserver.removeGlobalOnLayoutListener(keyboardListener);
}
}
示例11: removeGlobalLayoutObserver
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
public static void removeGlobalLayoutObserver(final ViewTreeObserver observer,
ViewTreeObserver.OnGlobalLayoutListener layoutListener) {
if (Build.VERSION.SDK_INT < 16) {
observer.removeGlobalOnLayoutListener(layoutListener);
} else {
observer.removeOnGlobalLayoutListener(layoutListener);
}
}
示例12: dismissPopup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
/**
* Dismisses the popup window with activities.
*
* @return True if dismissed, false if already dismissed.
*/
public boolean dismissPopup() {
if (isShowingPopup()) {
getListPopupWindow().dismiss();
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeGlobalOnLayoutListener(mOnGlobalLayoutListener);
}
}
return true;
}
示例13: dismissPopup
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
public boolean dismissPopup() {
if (isShowingPopup()) {
getListPopupWindow().dismiss();
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeGlobalOnLayoutListener(this.mOnGlobalLayoutListener);
}
}
return true;
}
示例14: onDetachedFromWindow
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
ActivityChooserModel dataModel = this.mAdapter.getDataModel();
if (dataModel != null) {
dataModel.unregisterObserver(this.mModelDataSetOberver);
}
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeGlobalOnLayoutListener(this.mOnGlobalLayoutListener);
}
if (isShowingPopup()) {
dismissPopup();
}
this.mIsAttachedToWindow = false;
}
示例15: removeGlobalOnLayoutListener
import android.view.ViewTreeObserver; //導入方法依賴的package包/類
@TargetApi(AndroidVersionCodes.JELLY_BEAN)
public static void removeGlobalOnLayoutListener(ViewTreeObserver mViewTreeObserver, ViewTreeObserver.OnGlobalLayoutListener listener) {
if (Build.VERSION.SDK_INT < AndroidVersionCodes.JELLY_BEAN) {
mViewTreeObserver.removeGlobalOnLayoutListener(listener);
} else {
mViewTreeObserver.removeOnGlobalLayoutListener(listener);
}
}