Search in sources :

Example 11 with AttachInfo

use of android.view.View.AttachInfo in project platform_frameworks_base by android.

the class AttachInfo_Accessor method setAttachInfo.

public static void setAttachInfo(View view) {
    Context context = view.getContext();
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    ViewRootImpl root = new ViewRootImpl(context, display);
    AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(), display, root, new Handler(), null);
    info.mHasWindowFocus = true;
    info.mWindowVisibility = View.VISIBLE;
    // this is so that we can display selections.
    info.mInTouchMode = false;
    info.mHardwareAccelerated = false;
    view.dispatchAttachedToWindow(info, 0);
}
Also used : Context(android.content.Context) BridgeWindowSession(com.android.layoutlib.bridge.android.BridgeWindowSession) BridgeWindow(com.android.layoutlib.bridge.android.BridgeWindow) Handler(android.os.Handler) AttachInfo(android.view.View.AttachInfo)

Example 12 with AttachInfo

use of android.view.View.AttachInfo in project platform_frameworks_base by android.

the class ViewRootImpl method getAccessibilityFocusedRect.

private boolean getAccessibilityFocusedRect(Rect bounds) {
    final AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
    if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
        return false;
    }
    final View host = mAccessibilityFocusedHost;
    if (host == null || host.mAttachInfo == null) {
        return false;
    }
    final AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
    if (provider == null) {
        host.getBoundsOnScreen(bounds, true);
    } else if (mAccessibilityFocusedVirtualView != null) {
        mAccessibilityFocusedVirtualView.getBoundsInScreen(bounds);
    } else {
        return false;
    }
    // Transform the rect into window-relative coordinates.
    final AttachInfo attachInfo = mAttachInfo;
    bounds.offset(0, attachInfo.mViewRootImpl.mScrollY);
    bounds.offset(-attachInfo.mWindowLeft, -attachInfo.mWindowTop);
    if (!bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, attachInfo.mViewRootImpl.mHeight)) {
        // If no intersection, set bounds to empty.
        bounds.setEmpty();
    }
    return !bounds.isEmpty();
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AttachInfo(android.view.View.AttachInfo) AccessibilityNodeProvider(android.view.accessibility.AccessibilityNodeProvider)

Example 13 with AttachInfo

use of android.view.View.AttachInfo in project android_frameworks_base by crdroidandroid.

the class ViewRootImpl method getAccessibilityFocusedRect.

private boolean getAccessibilityFocusedRect(Rect bounds) {
    final AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
    if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
        return false;
    }
    final View host = mAccessibilityFocusedHost;
    if (host == null || host.mAttachInfo == null) {
        return false;
    }
    final AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
    if (provider == null) {
        host.getBoundsOnScreen(bounds, true);
    } else if (mAccessibilityFocusedVirtualView != null) {
        mAccessibilityFocusedVirtualView.getBoundsInScreen(bounds);
    } else {
        return false;
    }
    // Transform the rect into window-relative coordinates.
    final AttachInfo attachInfo = mAttachInfo;
    bounds.offset(0, attachInfo.mViewRootImpl.mScrollY);
    bounds.offset(-attachInfo.mWindowLeft, -attachInfo.mWindowTop);
    if (!bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, attachInfo.mViewRootImpl.mHeight)) {
        // If no intersection, set bounds to empty.
        bounds.setEmpty();
    }
    return !bounds.isEmpty();
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AttachInfo(android.view.View.AttachInfo) AccessibilityNodeProvider(android.view.accessibility.AccessibilityNodeProvider)

Example 14 with AttachInfo

use of android.view.View.AttachInfo in project android_frameworks_base by crdroidandroid.

the class AttachInfo_Accessor method setAttachInfo.

public static void setAttachInfo(View view) {
    Context context = view.getContext();
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    ViewRootImpl root = new ViewRootImpl(context, display);
    AttachInfo info = new AttachInfo(new BridgeWindowSession(), new BridgeWindow(), display, root, new Handler(), null);
    info.mHasWindowFocus = true;
    info.mWindowVisibility = View.VISIBLE;
    // this is so that we can display selections.
    info.mInTouchMode = false;
    info.mHardwareAccelerated = false;
    view.dispatchAttachedToWindow(info, 0);
}
Also used : Context(android.content.Context) BridgeWindowSession(com.android.layoutlib.bridge.android.BridgeWindowSession) BridgeWindow(com.android.layoutlib.bridge.android.BridgeWindow) Handler(android.os.Handler) AttachInfo(android.view.View.AttachInfo)

Example 15 with AttachInfo

use of android.view.View.AttachInfo in project android_frameworks_base by AOSPA.

the class ViewRootImpl method getAccessibilityFocusedRect.

private boolean getAccessibilityFocusedRect(Rect bounds) {
    final AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
    if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
        return false;
    }
    final View host = mAccessibilityFocusedHost;
    if (host == null || host.mAttachInfo == null) {
        return false;
    }
    final AccessibilityNodeProvider provider = host.getAccessibilityNodeProvider();
    if (provider == null) {
        host.getBoundsOnScreen(bounds, true);
    } else if (mAccessibilityFocusedVirtualView != null) {
        mAccessibilityFocusedVirtualView.getBoundsInScreen(bounds);
    } else {
        return false;
    }
    // Transform the rect into window-relative coordinates.
    final AttachInfo attachInfo = mAttachInfo;
    bounds.offset(0, attachInfo.mViewRootImpl.mScrollY);
    bounds.offset(-attachInfo.mWindowLeft, -attachInfo.mWindowTop);
    if (!bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, attachInfo.mViewRootImpl.mHeight)) {
        // If no intersection, set bounds to empty.
        bounds.setEmpty();
    }
    return !bounds.isEmpty();
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AttachInfo(android.view.View.AttachInfo) AccessibilityNodeProvider(android.view.accessibility.AccessibilityNodeProvider)

Aggregations

AttachInfo (android.view.View.AttachInfo)27 Point (android.graphics.Point)13 Rect (android.graphics.Rect)12 Paint (android.graphics.Paint)7 Context (android.content.Context)6 Handler (android.os.Handler)6 BridgeWindow (com.android.layoutlib.bridge.android.BridgeWindow)6 BridgeWindowSession (com.android.layoutlib.bridge.android.BridgeWindowSession)6 AccessibilityManager (android.view.accessibility.AccessibilityManager)5 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)5 CompatibilityInfo (android.content.res.CompatibilityInfo)2 Resources (android.content.res.Resources)2 Region (android.graphics.Region)2 RemoteException (android.os.RemoteException)2 DisplayMetrics (android.util.DisplayMetrics)2 IAccessibilityInteractionConnectionCallback (android.view.accessibility.IAccessibilityInteractionConnectionCallback)2 InputMethodManager (android.view.inputmethod.InputMethodManager)2 Scroller (android.widget.Scroller)2 BaseSurfaceHolder (com.android.internal.view.BaseSurfaceHolder)2 IInputMethodCallback (com.android.internal.view.IInputMethodCallback)1