public static android.view.WindowManager getDefault(android.content.res.CompatibilityInfo compatInfo) { android.view.CompatibilityInfoHolder cih = new android.view.CompatibilityInfoHolder (); cih.set(compatInfo); if (cih.getIfNeeded() == null) { return(sWindowManager); } lock (sLock) { // NOTE: It would be cleaner to move the implementation of // WindowManagerImpl into a static inner class, and have this // public impl just call into that. Then we can make multiple // instances of WindowManagerImpl for compat mode rather than // having to make wrappers. android.view.WindowManager wm = sCompatWindowManagers.get(compatInfo); if (wm == null) { wm = new android.view.WindowManagerImpl.CompatModeWrapper(sWindowManager, cih); sCompatWindowManagers.put(compatInfo, wm); } return(wm); } }
/// <summary> /// Constructor for the /// <see cref="ZoomButtonsController">ZoomButtonsController</see> /// . /// </summary> /// <param name="ownerView"> /// The view that is being zoomed by the zoom controls. The /// zoom controls will be displayed aligned with this view. /// </param> public ZoomButtonsController(android.view.View ownerView) { mConfigurationChangedReceiver = new _BroadcastReceiver_150(this); mHandler = new _Handler_170(this); mContext = ownerView.getContext(); mWindowManager = (android.view.WindowManager)mContext.getSystemService(android.content.Context .WINDOW_SERVICE); mOwnerView = ownerView; mTouchPaddingScaledSq = (int)(ZOOM_CONTROLS_TOUCH_PADDING * mContext.getResources ().getDisplayMetrics().density); mTouchPaddingScaledSq *= mTouchPaddingScaledSq; mContainer = createContainer(); }
internal CompatModeWrapper(android.view.WindowManager wm, android.view.CompatibilityInfoHolder ci) { mWindowManager = wm is android.view.WindowManagerImpl.CompatModeWrapper ? ((android.view.WindowManagerImpl .CompatModeWrapper)wm).mWindowManager : (android.view.WindowManagerImpl)wm; // Use the original display if there is no compatibility mode // to apply, or the underlying window manager is already a // compatibility mode wrapper. (We assume that if it is a // wrapper, it is applying the same compatibility mode.) if (ci == null) { mDefaultDisplay = mWindowManager.getDefaultDisplay(); } else { //mDefaultDisplay = mWindowManager.getDefaultDisplay(); mDefaultDisplay = android.view.Display.createCompatibleDisplay(mWindowManager.getDefaultDisplay ().getDisplayId(), ci); } mCompatibilityInfo = ci; }
/// <summary><p>Change the popup's content.</summary> /// <remarks> /// <p>Change the popup's content. The content is represented by an instance /// of /// <see cref="android.view.View">android.view.View</see> /// .</p> /// <p>This method has no effect if called when the popup is showing.</p> /// </remarks> /// <param name="contentView">the new content for the popup</param> /// <seealso cref="getContentView()">getContentView()</seealso> /// <seealso cref="isShowing()">isShowing()</seealso> public virtual void setContentView(android.view.View contentView) { if (isShowing()) { return; } mContentView = contentView; if (mContext == null && mContentView != null) { mContext = mContentView.getContext(); } if (mWindowManager == null && mContentView != null) { mWindowManager = (android.view.WindowManager)mContext.getSystemService(android.content.Context .WINDOW_SERVICE); } }
/// <summary><p>Create a new popup window which can display the <tt>contentView</tt>. /// </summary> /// <remarks> /// <p>Create a new popup window which can display the <tt>contentView</tt>. /// The dimension of the window must be passed to this constructor.</p> /// <p>The popup does not provide any background. This should be handled /// by the content view.</p> /// </remarks> /// <param name="contentView">the popup's content</param> /// <param name="width">the popup's width</param> /// <param name="height">the popup's height</param> /// <param name="focusable">true if the popup can be focused, false otherwise</param> public PopupWindow(android.view.View contentView, int width, int height, bool focusable ) { mOnScrollChangedListener = new _OnScrollChangedListener_131(this); if (contentView != null) { mContext = contentView.getContext(); mWindowManager = (android.view.WindowManager)mContext.getSystemService(android.content.Context .WINDOW_SERVICE); } setContentView(contentView); setWidth(width); setHeight(height); setFocusable(focusable); }
/// <summary> /// <p>Create a new, empty, non focusable popup window of dimension (0,0).</p> /// <p>The popup does not provide a background.</p> /// </summary> public PopupWindow(android.content.Context context, android.util.AttributeSet attrs , int defStyleAttr, int defStyleRes) { mOnScrollChangedListener = new _OnScrollChangedListener_131(this); mContext = context; mWindowManager = (android.view.WindowManager)context.getSystemService(android.content.Context .WINDOW_SERVICE); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.PopupWindow, defStyleAttr, defStyleRes); mBackground = a.getDrawable([email protected]_popupBackground ); int animStyle = a.getResourceId([email protected]_popupAnimationStyle , -1); mAnimationStyle = animStyle == [email protected]_PopupWindow ? -1 : animStyle; // If this is a StateListDrawable, try to find and store the drawable to be // used when the drop-down is placed above its anchor view, and the one to be // used when the drop-down is placed below its anchor view. We extract // the drawables ourselves to work around a problem with using refreshDrawableState // that it will take into account the padding of all drawables specified in a // StateListDrawable, thus adding superfluous padding to drop-down views. // // We assume a StateListDrawable will have a drawable for ABOVE_ANCHOR_STATE_SET and // at least one other drawable, intended for the 'below-anchor state'. if (mBackground is android.graphics.drawable.StateListDrawable) { android.graphics.drawable.StateListDrawable background = (android.graphics.drawable.StateListDrawable )mBackground; // Find the above-anchor view - this one's easy, it should be labeled as such. int aboveAnchorStateIndex = background.getStateDrawableIndex(ABOVE_ANCHOR_STATE_SET ); // Now, for the below-anchor view, look for any other drawable specified in the // StateListDrawable which is not for the above-anchor state and use that. int count = background.getStateCount(); int belowAnchorStateIndex = -1; { for (int i = 0; i < count; i++) { if (i != aboveAnchorStateIndex) { belowAnchorStateIndex = i; break; } } } // Store the drawables we found, if we found them. Otherwise, set them both // to null so that we'll just use refreshDrawableState. if (aboveAnchorStateIndex != -1 && belowAnchorStateIndex != -1) { mAboveAnchorBackgroundDrawable = background.getStateDrawable(aboveAnchorStateIndex ); mBelowAnchorBackgroundDrawable = background.getStateDrawable(belowAnchorStateIndex ); } else { mBelowAnchorBackgroundDrawable = null; mAboveAnchorBackgroundDrawable = null; } } a.recycle(); }
/// <summary> /// Constructor for the /// <see cref="ZoomButtonsController">ZoomButtonsController</see> /// . /// </summary> /// <param name="ownerView"> /// The view that is being zoomed by the zoom controls. The /// zoom controls will be displayed aligned with this view. /// </param> public ZoomButtonsController(android.view.View ownerView) { mConfigurationChangedReceiver = new _BroadcastReceiver_150(this); mHandler = new _Handler_170(this); mContext = ownerView.getContext(); mWindowManager = (android.view.WindowManager)mContext.getSystemService(android.content.Context .WINDOW_SERVICE); mOwnerView = ownerView; mTouchPaddingScaledSq = (int)(ZOOM_CONTROLS_TOUCH_PADDING * mContext.getResources ().getDisplayMetrics().density); mTouchPaddingScaledSq *= mTouchPaddingScaledSq; mContainer = createContainer(); }
internal void attach(android.content.Context context, android.app.ActivityThread aThread, android.app.Instrumentation instr, android.os.IBinder token, int ident, android.app.Application application, android.content.Intent intent, android.content.pm.ActivityInfo info, java.lang.CharSequence title, android.app.Activity parent, string id, android.app.Activity .NonConfigurationInstances lastNonConfigurationInstances, android.content.res.Configuration config) { attachBaseContext(context); mFragments.attachActivity(this); mWindow = [email protected](this); mWindow.setCallback(this); mWindow.getLayoutInflater().setPrivateFactory(this); if (info.softInputMode != android.view.WindowManagerClass.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { mWindow.setSoftInputMode(info.softInputMode); } if (info.uiOptions != 0) { mWindow.setUiOptions(info.uiOptions); } mUiThread = java.lang.Thread.currentThread(); mMainThread = aThread; mInstrumentation = instr; mToken = token; mIdent = ident; mApplication = application; mIntent = intent; mComponent = intent.getComponent(); mActivityInfo = info; mTitle = title; mParent = parent; mEmbeddedID = id; mLastNonConfigurationInstances = lastNonConfigurationInstances; mWindow.setWindowManager(null, mToken, mComponent.flattenToString(), (info.flags & android.content.pm.ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0); if (mParent != null) { mWindow.setContainer(mParent.getWindow()); } mWindowManager = mWindow.getWindowManager(); mCurrentConfig = config; }
/// <summary> /// Set the window manager for use by this Window to, for example, /// display panels. /// </summary> /// <remarks> /// Set the window manager for use by this Window to, for example, /// display panels. This is <em>not</em> used for displaying the /// Window itself -- that must be done by the client. /// </remarks> /// <param name="wm">The ViewManager for adding new windows.</param> public virtual void setWindowManager(android.view.WindowManager wm, android.os.IBinder appToken, string appName, bool hardwareAccelerated) { mAppToken = appToken; mAppName = appName; if (wm == null) { wm = android.view.WindowManagerImpl.getDefault(); } mWindowManager = new android.view.Window.LocalWindowManager(this, wm, hardwareAccelerated ); }