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


Java View.removeOnAttachStateChangeListener方法代碼示例

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


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

示例1: addView

import android.view.View; //導入方法依賴的package包/類
/**
 * 添加view到Window
 *
 * @param view
 * @param params
 */
public void addView(View view, ViewGroup.LayoutParams params)
{
    if (view == null)
    {
        return;
    }
    init(view);
    if (containsView(view))
    {
        return;
    }
    if (params == null)
    {
        params = newLayoutParams();
    }

    getWindowManager().addView(view, params);

    view.removeOnAttachStateChangeListener(mInternalOnAttachStateChangeListener);
    view.addOnAttachStateChangeListener(mInternalOnAttachStateChangeListener);
    mMapView.put(view, 0);
}
 
開發者ID:zj565061763,項目名稱:windowmanager,代碼行數:29,代碼來源:SDWindowManager.java

示例2: setTarget

import android.view.View; //導入方法依賴的package包/類
/**
 * 設置目標view
 *
 * @param target
 */
public FPoper setTarget(View target)
{
    final View old = getTarget();
    if (old != target)
    {
        if (old != null)
        {
            old.removeOnAttachStateChangeListener(mOnAttachStateChangeListenerTarget);
        }

        if (target != null)
        {
            mTarget = new WeakReference<>(target);
            target.removeOnAttachStateChangeListener(mOnAttachStateChangeListenerTarget);
            target.addOnAttachStateChangeListener(mOnAttachStateChangeListenerTarget);
        } else
        {
            mTarget = null;
            removeUpdateListener();
        }
    }
    return this;
}
 
開發者ID:zj565061763,項目名稱:poper,代碼行數:29,代碼來源:FPoper.java

示例3: onGlobalFocusChanged

import android.view.View; //導入方法依賴的package包/類
@Override
public void onGlobalFocusChanged(View oldFocus, View newFocus) {
    if (newFocus == null) {
        return;
    }
    if (oldFocus != null) {
        oldFocus.removeOnAttachStateChangeListener(this);
    }
    Looper.myQueue().removeIdleHandler(this);
    newFocus.addOnAttachStateChangeListener(this);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:12,代碼來源:IMMLeaks.java

示例4: clearInputMethodManagerLeak

import android.view.View; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.KITKAT)
private void clearInputMethodManagerLeak() {
    try {
        Object lock = mHField.get(inputMethodManager);
        // This is highly dependent on the InputMethodManager implementation.
        synchronized (lock) {
            View servedView = (View) mServedViewField.get(inputMethodManager);
            if (servedView != null) {

                boolean servedViewAttached = servedView.getWindowVisibility() != View.GONE;

                if (servedViewAttached) {
                    // The view held by the IMM was replaced without a global focus change. Let's make
                    // sure we get notified when that view detaches.

                    // Avoid double registration.
                    servedView.removeOnAttachStateChangeListener(this);
                    servedView.addOnAttachStateChangeListener(this);
                } else {
                    // servedView is not attached. InputMethodManager is being stupid!
                    Activity activity = extractActivity(servedView.getContext());
                    if (activity == null || activity.getWindow() == null) {
                        // Unlikely case. Let's finish the input anyways.
                        finishInputLockedMethod.invoke(inputMethodManager);
                    } else {
                        View decorView = activity.getWindow().peekDecorView();
                        boolean windowAttached = decorView.getWindowVisibility() != View.GONE;
                        if (!windowAttached) {
                            finishInputLockedMethod.invoke(inputMethodManager);
                        } else {
                            decorView.requestFocusFromTouch();
                        }
                    }
                }
            }
        }
    } catch (IllegalAccessException | InvocationTargetException unexpected) {
        Log.e("IMMLeaks", "Unexpected reflection exception", unexpected);
    }
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:41,代碼來源:IMMLeaks.java

示例5: onGlobalFocusChanged

import android.view.View; //導入方法依賴的package包/類
@Override public void onGlobalFocusChanged(View oldFocus, View newFocus) {
  if (newFocus == null) {
    return;
  }
  if (oldFocus != null) {
    oldFocus.removeOnAttachStateChangeListener(this);
  }
  Looper.myQueue().removeIdleHandler(this);
  newFocus.addOnAttachStateChangeListener(this);
}
 
開發者ID:GcsSloop,項目名稱:diycode,代碼行數:11,代碼來源:IMMLeaks.java

示例6: clearInputMethodManagerLeak

import android.view.View; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void clearInputMethodManagerLeak() {
  try {
    Object lock = mHField.get(inputMethodManager);
    // This is highly dependent on the InputMethodManager implementation.
    synchronized (lock) {
      View servedView = (View) mServedViewField.get(inputMethodManager);
      if (servedView != null) {

        boolean servedViewAttached = servedView.getWindowVisibility() != View.GONE;

        if (servedViewAttached) {
          // The view held by the IMM was replaced without a global focus change. Let's make
          // sure we get notified when that view detaches.

          // Avoid double registration.
          servedView.removeOnAttachStateChangeListener(this);
          servedView.addOnAttachStateChangeListener(this);
        } else {
          // servedView is not attached. InputMethodManager is being stupid!
          Activity activity = extractActivity(servedView.getContext());
          if (activity == null || activity.getWindow() == null) {
            // Unlikely case. Let's finish the input anyways.
            finishInputLockedMethod.invoke(inputMethodManager);
          } else {
            View decorView = activity.getWindow().peekDecorView();
            boolean windowAttached = decorView.getWindowVisibility() != View.GONE;
            if (!windowAttached) {
              finishInputLockedMethod.invoke(inputMethodManager);
            } else {
              decorView.requestFocusFromTouch();
            }
          }
        }
      }
    }
  } catch (IllegalAccessException | InvocationTargetException unexpected) {
    Log.e("IMMLeaks", "Unexpected reflection exception", unexpected);
  }
}
 
開發者ID:GcsSloop,項目名稱:diycode,代碼行數:41,代碼來源:IMMLeaks.java

示例7: onViewDetachedFromWindow

import android.view.View; //導入方法依賴的package包/類
@Override
public void onViewDetachedFromWindow(View v) {
    if (DebugOverlay.DEBUG) {
        Log.i(TAG, "onViewDetachedFromWindow");
    }
    windowManager.removeViewImmediate(_rootView);
    v.removeOnAttachStateChangeListener(this);
}
 
開發者ID:Manabu-GT,項目名稱:DebugOverlay-Android,代碼行數:9,代碼來源:OverlayViewManager.java

示例8: onViewDetachedFromWindow

import android.view.View; //導入方法依賴的package包/類
@Override
public void onViewDetachedFromWindow(View v) {
    v.removeOnAttachStateChangeListener(this);
    checkVisibility(false);
}
 
開發者ID:CodingCodersCode,項目名稱:EvolvingNetLib,代碼行數:6,代碼來源:CCBaseLazyRxFragment.java

示例9: onViewDetachedFromWindow

import android.view.View; //導入方法依賴的package包/類
@Override
public void onViewDetachedFromWindow(View v) {
    v.removeOnAttachStateChangeListener(this);
    Looper.myQueue().removeIdleHandler(this);
    Looper.myQueue().addIdleHandler(this);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:7,代碼來源:IMMLeaks.java

示例10: onViewDetachedFromWindow

import android.view.View; //導入方法依賴的package包/類
@Override
public void onViewDetachedFromWindow(View v)
{
    v.removeOnAttachStateChangeListener(this);
    mMapView.remove(v);
}
 
開發者ID:zj565061763,項目名稱:windowmanager,代碼行數:7,代碼來源:SDWindowManager.java

示例11: onViewDetachedFromWindow

import android.view.View; //導入方法依賴的package包/類
@Override public void onViewDetachedFromWindow(View v) {
  v.removeOnAttachStateChangeListener(this);
  Looper.myQueue().removeIdleHandler(this);
  Looper.myQueue().addIdleHandler(this);
}
 
開發者ID:GcsSloop,項目名稱:diycode,代碼行數:6,代碼來源:IMMLeaks.java


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