CWAC-Presentation
Comment:
- CWAC-Presentation enables you to handle external displays.
When an external display is available the event ShowPresentation(Display1 As Display) is raised.
The Display object can be used to initialize a Presentation object.
The Presentation object is used to display a user interface on the external display.
When an external display is no longer available the event ClearPresentation(ShowInline As Boolean) is raised.
The Presentation object's Dismiss method should then be called.
ShowInline indicates whether the Activity is still in the foregorund and therefore the user interface should now be displayed 'inline' on the device's primary display.
This library is based on the open source CommonsWare PresentationHelper library: https://github.com/commonsguy/cwac-presentation
The CommonsWare PresentationHelper library is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
BasicPresentation
Methods:
- Dismiss
- GetDisplay As Display
Gets the Display that this presentation appears on.
- GetPanel As PanelWrapper
- GetResources As Resources
Gets the Resources that should be used to inflate the layout of this presentation.
- Initialize (Display1 As Display)
- Initialize2 (Display1 As Display, Theme As Int)
- IsInitialized As Boolean
- Show
Display
Fields:
- DEFAULT_DISPLAY As Int
The default Display id, which is the id of the built-in primary display assuming there is one.
- FLAG_PRESENTATION As Int
Display flag: Indicates that the display is a presentation display.
- FLAG_PRIVATE As Int
Display flag: Indicates that the display is private.
- FLAG_SECURE As Int
Display flag: Indicates that the display has a secure video output and supports compositing secure surfaces.
- FLAG_SUPPORTS_PROTECTED_BUFFERS As Int
Display flag: Indicates that the display supports compositing content that is stored in protected graphics buffers.
Methods:
- GetCurrentSizeRanges As Point[]
Return the range of display sizes an application can expect to encounter under normal operation, as long as there is no physical change in screen size.
Return value is an array of Point objects where element 0 is the smallest display size and element 1 is the largest display size.
- GetDisplayId As Int
Gets the display id.
- GetFlags As Int
Returns a combination of flags that describe the capabilities of the display.
- GetMetrics As DisplayMetrics
Gets display metrics that describe the size and density of this display.
- GetName As String
Gets the name of the display.
- GetRealMetrics As DisplayMetrics
Gets display metrics based on the real size of this display.
- GetRealSize As Point
Gets the real size of the display without subtracting any window decor or applying any compatibility scale factors.
- GetRectSize As RectWrapper
Gets the size of the display as a rectangle, in pixels.
- GetRefreshRate As Float
Gets the refresh rate of this display in frames per second.
- GetRotation As Int
Returns the rotation of the screen from its "natural" orientation.
- GetSize As Point
Gets the size of the display, in pixels.
- IsInitialized As Boolean
- IsValid As Boolean
Returns true if this display is still valid, false if the display has been removed.
DisplayManager
Methods:
- GetDisplay (DisplayId As Int) As Display
Gets information about a logical display.
- GetDisplays As Display[]
Gets all currently valid logical displays.
- GetDisplays2 (Category As String) As Display[]
Gets all currently valid logical displays of the specified category.
- Initialize
- IsInitialized As Boolean
- RegisterDisplayListener (EventName As String) As DisplayManagerDisplayListener
Registers a display listener to receive notifications about when displays are added, removed or changed.
- UnregisterDisplayListener (DisplayListener1 As DisplayListener)
Unregisters a display listener.
DisplayManagerDisplayListener
Events:
- DisplayAdded (DisplayId As Int)
- DisplayChanged (DisplayId As Int)
- DisplayRemoved (DisplayId As Int)
Methods:
DisplayMetrics
Fields:
- DENSITY_DEFAULT As Int
- DENSITY_HIGH As Int
- DENSITY_LOW As Int
- DENSITY_MEDIUM As Int
- DENSITY_TV As Int
- DENSITY_XHIGH As Int
- DENSITY_XXHIGH As Int
Methods:
- Initialize
- IsInitialized As Boolean
- SetTo (DisplayMetrics1 As DisplayMetrics)
- SetToDefaults
Properties:
- Density As Float [read only]
The logical density of the display.
- DensityDpi As Int [read only]
The screen density expressed as dots-per-inch.
- HeightPixels As Int [read only]
The absolute height of the display in pixels.
- ScaledDensity As Float [read only]
A scaling factor for fonts displayed on the display.
- WidthPixels As Int [read only]
The absolute width of the display in pixels.
- Xdpi As Float [read only]
The exact physical pixels per inch of the screen in the X dimension.
- Ydpi As Float [read only]
The exact physical pixels per inch of the screen in the Y dimension.
Point
Methods:
- Equals (X As Int, Y As Int) As Boolean
Returns true if the point's coordinates equal (X, Y).
- Initialize (X As Int, Y As Int)
- Initialize2 (Point1 As Point)
- Initialize3
- IsInitialized As Boolean
- Negate
Negate the point's coordinates.
- Offset (Dx As Int, Dy As Int)
Offset the point's coordinates by Dx, Dy.
- Set (X As Int, Y As Int)
Properties:
- X As Int [read only]
- Y As Int [read only]
PresentationHelper
Events:
- ClearPresentation (ShowInline As Boolean)
- ShowPresentation (Display1 As Display)
Methods:
- Initialize (EventName As String)
- IsInitialized As Boolean
- Pause
You should call Pause when your Activity is paused.
- Resume
You could call Resume when your Activity is resumed.
Properties:
Resources
Fields:
- RESOURCE_SOURCE_APPLICATION As ResourceSource
Constant field used to reference the application's resources.
- RESOURCE_SOURCE_SYSTEM As ResourceSource
Constant field used to reference the system's resources.
Methods:
- GetBoolean (ResourceId As Int) As Boolean
Return a boolean associated with the resource ID.
- GetColor (ResourceId As Int) As Int
Return a color integer associated with the resource ID.
- GetDimension (ResourceId As Int) As Float
Retrieve a dimensional for the resource ID.
- GetDimensionPixelOffset (ResourceId As Int) As Int
Retrieve a dimensional for the resource ID for use as an offset in raw pixels.
- GetDimensionPixelSize (ResourceId As Int) As Int
Retrieve a dimensional for the resource ID for use as a size in raw pixels.
- GetDrawable (ResourceId As Int) As Drawable
Return a drawable object associated with the resource ID.
- GetDrawableForDensity (ResourceId As Int, Density As Int) As Drawable
Return a drawable object associated with the resource ID for the given screen density in DPI.
- GetIdentifier (ResourceName As String, ResourceType As String, DefaultPackage As String) As Int
Returns an integer resource identifier for the given resource name.
A fully qualified resource name is of the form "package:type/entry".
The first two components (package and type) are optional if ResourceType and DefaultPackage, respectively, are specified here.
ResourceName - The name of the desired resource.
ResourceType - Optional resource type to find, if "type/" is not included in the name.
DefaultPackage - Optional default package to find, if "package:" is not included in the name.
Returns 0 if no such resource was found. (0 is not a valid resource ID).
- GetIntArray (ResourceId As Int) As Int[]
Return the int array associated with the resource ID.
- GetInteger (ResourceId As Int) As Int
Return an integer associated with the resource ID.
- GetQuantityString (ResourceId As Int, Quantity As Int) As String
Returns the string necessary for grammatically correct pluralization of the resource ID for the quantity.
- GetResourceEntryName (ResourceId As Int) As String
Return the entry name for the resource identifier.
- GetResourceName (ResourceId As Int) As String
Return the full name for the resource identifier.
- GetResourceNames (ResourceSource1 As ResourceSource, ResourceType As String) As List
Returns a List containing resource names.
ResourceSource1 - Either RESOURCE_SOURCE_APPLICATION or RESOURCE_SOURCE_SYSTEM.
ResourceType - The type of resources to return resource names for, eg "string" or "drawable".
- GetResourcePackageName (ResourceId As Int) As String
Return the package name for the resource identifier.
- GetResourceTypeName (ResourceId As Int) As String
Return the type name for the resource identifier.
- GetString (ResourceId As Int) As String
Return the string value associated with the resource ID.
It will be stripped of any styled text information.
- GetStringArray (ResourceId As Int) As String[]
Return the string array associated with the resource ID.
- Initialize (ResourceSource1 As ResourceSource)
Initialize the Resources object.
ResourceSource1 - Either RESOURCE_SOURCE_APPLICATION or RESOURCE_SOURCE_SYSTEM.
- IsInitialized As Boolean
- OpenRawResource (ResourceId As Int) As InputStreamWrapper
Open a data stream for reading a raw resource.
Properties:
- PackageName As String [read only]
Returns the application package name.