Пример #1
0
 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);
     }
 }
Пример #2
0
 /// <summary>
 /// Use
 /// <see cref="WindowManager.getDefaultDisplay()">WindowManager.getDefaultDisplay()</see>
 /// to create a Display object.
 /// Display gives you access to some information about a particular display
 /// connected to the device.
 /// </summary>
 internal Display(int display, android.view.CompatibilityInfoHolder compatInfo)
 {
     // initalize the statics when this class is first instansiated. This is
     // done here instead of in the static block because Zygote
     lock (sStaticInit)
     {
         if (!sInitialized)
         {
             nativeClassInit();
             sInitialized = true;
         }
     }
     mCompatibilityInfo = compatInfo != null ? compatInfo : new android.view.CompatibilityInfoHolder
                              ();
     mDisplay = display;
     init(display);
 }
Пример #3
0
 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;
 }
Пример #4
0
 private void addView(android.view.View view, android.view.ViewGroup.LayoutParams
                      @params, android.view.CompatibilityInfoHolder cih, bool nest)
 {
     if (false)
     {
         android.util.Log.v("WindowManager", "addView view=" + view);
     }
     if (!(@params is android.view.WindowManagerClass.LayoutParams))
     {
         throw new System.ArgumentException("Params must be WindowManager.LayoutParams");
     }
     android.view.WindowManagerClass.LayoutParams wparams = (android.view.WindowManagerClass
                                                             .LayoutParams)@params;
     android.view.ViewRootImpl root;
     android.view.View         panelParentView = null;
     lock (this)
     {
         // Here's an odd/questionable case: if someone tries to add a
         // view multiple times, then we simply bump up a nesting count
         // and they need to remove the view the corresponding number of
         // times to have it actually removed from the window manager.
         // This is useful specifically for the notification manager,
         // which can continually add/remove the same view as a
         // notification gets updated.
         int index = findViewLocked(view, false);
         if (index >= 0)
         {
             if (!nest)
             {
                 throw new System.InvalidOperationException("View " + view + " has already been added to the window manager."
                                                            );
             }
             root = mRoots[index];
             root.mAddNesting++;
             // Update layout parameters.
             view.setLayoutParams(wparams);
             root.setLayoutParams(wparams, true);
             return;
         }
         // If this is a panel window, then find the window it is being
         // attached to for future reference.
         if (wparams.type >= android.view.WindowManagerClass.LayoutParams.FIRST_SUB_WINDOW &&
             wparams.type <= android.view.WindowManagerClass.LayoutParams.LAST_SUB_WINDOW)
         {
             int count = mViews != null ? mViews.Length : 0;
             {
                 for (int i = 0; i < count; i++)
                 {
                     if (mRoots[i].mWindow.asBinder() == wparams.token)
                     {
                         panelParentView = mViews[i];
                     }
                 }
             }
         }
         root             = new android.view.ViewRootImpl(view.getContext());
         root.mAddNesting = 1;
         if (cih == null)
         {
             root.mCompatibilityInfo = new android.view.CompatibilityInfoHolder();
         }
         else
         {
             root.mCompatibilityInfo = cih;
         }
         view.setLayoutParams(wparams);
         if (mViews == null)
         {
             index   = 1;
             mViews  = new android.view.View[1];
             mRoots  = new android.view.ViewRootImpl[1];
             mParams = new android.view.WindowManagerClass.LayoutParams[1];
         }
         else
         {
             index = mViews.Length + 1;
             object[] old = mViews;
             mViews = new android.view.View[index];
             System.Array.Copy(old, 0, mViews, 0, index - 1);
             old    = mRoots;
             mRoots = new android.view.ViewRootImpl[index];
             System.Array.Copy(old, 0, mRoots, 0, index - 1);
             old     = mParams;
             mParams = new android.view.WindowManagerClass.LayoutParams[index];
             System.Array.Copy(old, 0, mParams, 0, index - 1);
         }
         index--;
         mViews[index]  = view;
         mRoots[index]  = root;
         mParams[index] = wparams;
     }
     // do this last because it fires off messages to start doing things
     root.setView(view, wparams, panelParentView);
 }
Пример #5
0
 public virtual void addView(android.view.View view, android.view.ViewGroup.LayoutParams
                             @params, android.view.CompatibilityInfoHolder cih)
 {
     addView(view, @params, cih, false);
 }
Пример #6
0
 public static android.view.WindowManager getDefault(android.view.CompatibilityInfoHolder
                                                     compatInfo)
 {
     return(new android.view.WindowManagerImpl.CompatModeWrapper(sWindowManager, compatInfo
                                                                 ));
 }
Пример #7
0
 // Following fields are initialized from native code
 /// <summary>Returns a display object which uses the metric's width/height instead.</summary>
 /// <remarks>Returns a display object which uses the metric's width/height instead.</remarks>
 /// <hide></hide>
 public static android.view.Display createCompatibleDisplay(int displayId, android.view.CompatibilityInfoHolder
                                                            compat)
 {
     return(new android.view.Display(displayId, compat));
 }
Пример #8
0
		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;
			}
		}
Пример #9
0
			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;
			}