SoftOrientation
AndroidContentResConfiguration
Functions:
- CompareTo (That As AndroidContentResConfiguration) As Int
- DescribeContents As Int
- Diff (AndroidContentResConfiguration1 As Object) As Int
Return a bit mask of the differences between this Configuration object and the given one. Does not change the values of either. Any undefined fields in delta are ignored.
- Diff2 (Delta As AndroidContentResConfiguration) As Int
Return a bit mask of the differences between this Configuration object and the given one. Does not change the values of either. Any undefined fields in delta are ignored.
- Equals (AndroidContentResConfiguration1 As Object) As Boolean
- Equals2 (That As AndroidContentResConfiguration) As Boolean
- Equals3 (That As Object) As Boolean
- GetLayoutDirection As Int
Return the layout direction.
- HashCode As Int
Returns a hash code value for the object.
- Initialize (Configuration As Object)
Initializes the class instance.
Configuration As Object - Pass Null if you want to initialize new empty instance, or pass android.content.res.Configuration from Java code.
- IsLayoutSizeAtLeast (Size As Int) As Boolean
Check if the Configuration's current screenLayout is at least the given size.
Size As Int - The desired size, either SCREENLAYOUT_SIZE_SMALL, SCREENLAYOUT_SIZE_NORMAL, SCREENLAYOUT_SIZE_LARGE, or SCREENLAYOUT_SIZE_XLARGE.
- IsNightModeActive As Boolean
Retuns whether the configuration is in night mode.
- IsScreenHdr As Boolean
Return whether the screen has a high dynamic range.
- IsScreenRound As Boolean
Return whether the screen has a round shape. Apps may choose to change styling based on this property, such as the alignment or layout of text or informational icons.
- IsScreenWideColorGamut As Boolean
Return whether the screen has a wide color gamut and wide color gamut rendering is supported by this device. When true, it implies the screen is colorspace aware but not necessarily color-managed. The final colors may still be changed by the screen depending on user settings.
- NeedNewResources (ConfigChanges As Int, InterestingChanges As Int) As Boolean
Determines if a new resource needs to be loaded from the bit set of configuration changes returned by updateFrom(android.content.res.Configuration).
- SetTo (AndroidContentResConfiguration1 As Object)
Sets the fields in this object to those in the given Configuration.
AndroidContentResConfiguration1 As Object - The Configuration object used to set the values of this Configuration's fields.
- SetTo2 (O As AndroidContentResConfiguration)
Sets the fields in this object to those in the given Configuration.
O As AndroidContentResConfiguration - The Configuration object used to set the values of this Configuration's fields.
- SetToDefaults
Set this object to the system defaults.
- ToObject As Object
This method converts AndroidContentResConfiguration for B4A to android.content.res.Configuration for Java. The resulting object can be used in java code.
- ToString As String
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
- UpdateFrom (AndroidContentResConfiguration1 As Object) As Int
Copies the fields from delta into this Configuration object, keeping track of which ones have changed. Any undefined fields in delta are ignored and not copied in to the current Configuration.
- UpdateFrom2 (Delta As AndroidContentResConfiguration) As Int
Copies the fields from delta into this Configuration object, keeping track of which ones have changed. Any undefined fields in delta are ignored and not copied in to the current Configuration.
Properties:
- ColorMode As Int [read only]
Bit mask of color capabilities of the screen. Currently there are two fields: The COLOR_MODE_WIDE_COLOR_GAMUT_MASK bits define the color gamut of the screen. They may be one of COLOR_MODE_WIDE_COLOR_GAMUT_NO Or COLOR_MODE_WIDE_COLOR_GAMUT_YES. The COLOR_MODE_HDR_MASK defines the dynamic range of the screen. They may be one of COLOR_MODE_HDR_NO Or COLOR_MODE_HDR_YES.
- Constants As AndroidContentResConfigurationConstants [read only]
Get the constants associated with AndroidContentResConfiguration.
- DensityDpi As Int [read only]
The target screen density being rendered to, corresponding to density resource qualifier. Set to DENSITY_DPI_UNDEFINED if no density is specified.
- FontScale As Float [read only]
Current user preference for the scaling factor for fonts, relative to the base density scaling.
- HardKeyboardHidden As Int [read only]
A flag indicating whether the hard keyboard has been hidden. This will be set on a device with a mechanism to hide the keyboard from the user, when that mechanism is closed. One of: HARDKEYBOARDHIDDEN_NO, HARDKEYBOARDHIDDEN_YES.
- Keyboard As Int [read only]
The kind of keyboard attached to the device. One of: KEYBOARD_NOKEYS, KEYBOARD_QWERTY, KEYBOARD_12KEY.
- KeyboardHidden As Int [read only]
A flag indicating whether any keyboard is available. Unlike hardKeyboardHidden, this also takes into account a soft keyboard, so if the hard keyboard is hidden but there is soft keyboard available, it will be set to NO. Value is one of: KEYBOARDHIDDEN_NO, KEYBOARDHIDDEN_YES.
- MCC As Int [read only]
MSI MCC (Mobile Country Code), corresponding to mcc resource qualifier. 0 if undefined.
- MNC As Int [read only]
IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier. 0 if undefined. Note that the actual MNC may be 0; in order to check for this use the MNC_ZERO symbol.
- Navigation As Int [read only]
The kind of navigation method available on the device. One of: NAVIGATION_NONAV, NAVIGATION_DPAD, NAVIGATION_TRACKBALL, NAVIGATION_WHEEL.
- NavigationHidden As Int [read only]
A flag indicating whether any 5-way or DPAD navigation available. This will be set on a device with a mechanism to hide the navigation controls from the user, when that mechanism is closed. One of: NAVIGATIONHIDDEN_NO, NAVIGATIONHIDDEN_YES.
- Orientation As Int [read only]
Overall orientation of the screen. May be one of ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT. Value Is ORIENTATION_UNDEFINED, ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE, Or ORIENTATION_SQUARE.
- ScreenHeightDp As Int [read only]
The height of the available screen space in dp units excluding the area occupied by window insets, such as the status bar, navigation bar, and cutouts.
- ScreenLayout As Int [read only]
Bit mask of overall layout of the screen. Currently there are four fields: The SCREENLAYOUT_SIZE_MASK bits define the overall size of the screen. They may be one of SCREENLAYOUT_SIZE_SMALL, SCREENLAYOUT_SIZE_NORMAL, SCREENLAYOUT_SIZE_LARGE, Or SCREENLAYOUT_SIZE_XLARGE. The SCREENLAYOUT_LONG_MASK defines whether the screen Is wider/taller than normal. They may be one of SCREENLAYOUT_LONG_NO Or SCREENLAYOUT_LONG_YES. The SCREENLAYOUT_LAYOUTDIR_MASK defines whether the screen layout Is either LTR Or RTL. They may be one of SCREENLAYOUT_LAYOUTDIR_LTR Or SCREENLAYOUT_LAYOUTDIR_RTL. The SCREENLAYOUT_ROUND_MASK defines whether the screen has a rounded shape. They may be one of SCREENLAYOUT_ROUND_NO Or SCREENLAYOUT_ROUND_YES.
- ScreenWidthDp As Int [read only]
The width of the available screen space in dp units excluding the area occupied by window insets.
- SmallestScreenWidthDp As Int [read only]
The smallest screen size an application will see in normal operation. Corresponds to the smallest width resource qualifier. This is the smallest value of screenWidthDp and screenHeightDp in both portrait and landscape orientations. Defaults to SMALLEST_SCREEN_WIDTH_DP_UNDEFINED if no width is specified.
- TouchScreen As Int [read only]
The kind of touch screen attached to the device. One of: TOUCHSCREEN_NOTOUCH, TOUCHSCREEN_FINGER.
- UiMode As Int [read only]
Bit mask of the ui mode. Currently there are two fields: The UI_MODE_TYPE_MASK bits define the overall ui mode of the device. They may be one of UI_MODE_TYPE_UNDEFINED, UI_MODE_TYPE_NORMAL, UI_MODE_TYPE_DESK, UI_MODE_TYPE_CAR, UI_MODE_TYPE_TELEVISION, UI_MODE_TYPE_APPLIANCE, UI_MODE_TYPE_WATCH, Or UI_MODE_TYPE_VR_HEADSET. The UI_MODE_NIGHT_MASK defines whether the screen Is in a special mode. They may be one of UI_MODE_NIGHT_UNDEFINED, UI_MODE_NIGHT_NO Or UI_MODE_NIGHT_YES.
AndroidContentResConfigurationConstants
Functions:
- Initialize
Initializes the object. You can add parameters to this method if needed.
SoftOrientationB4XPage
Functions:
- Initialize (Callback As Object, EventName As String, PageID As String, LayoutFile As String, DefaultOrientation As Int, Root As Object)
Initializes the object. You can add parameters to this method if needed.
Properties:
- Callback As Object [read only]
- DefaultOrientation As Int [read only]
- EventName As String [read only]
- LayoutFile As String [read only]
- PageID As String [read only]
- Root As Object [read only]
SoftOrientationForActivities
Events:
- ActivityConfigurationChanged (NewConfiguration As AndroidContentResConfiguration)
Functions:
- Initialize (Callback As Object, EventName As String, Activity As Object, LayoutFile As String)
- OnConfigurationChanged (NewConfig As Object)
This Sub will be called when the onConfigurationChanged event is fired in the main Activity. It is not recommended that you call this Sub by yourself.
NewConfig As Object - android.content.res.Configuration from Java code.
Properties:
- Activity As Activity [read only]
Gets the Activity which is associated with class instance on class initialization.
- ActivityActualConfiguration As AndroidContentResConfiguration [read only]
Get actual android.content.res.Configuration (B4A class name AndroidContentResConfiguration) from Activity. You can also get or set all properties and methods from android.content.res.Configuration.
- Callback As Object [read only]
Gets the Callback object which is associated with class instance on class initialization.
- EventName As String [read only]
Gets the EventName which is associated with class instance on class initialization.
- LayoutFile As String [read only]
Gets the LayoutFile which is associated with class instance on class initialization.
- Orientation As Int [read only]
Gets or sets the screen orientation.
Choose one of the constants depending on your needs, for example: SCREEN_ORIENTATION_UNSPECIFIED, SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_PORTRAIT, SCREEN_ORIENTATION_USER, SCREEN_ORIENTATION_BEHIND, SCREEN_ORIENTATION_SENSOR, SCREEN_ORIENTATION_NOSENSOR, etc...
- OrientationAsString As String [read only]
Gets screen orientation value represented as String
- RotationInDegrees As Int [read only]
Gets actual screen rotation in degrees (Values:0,90,180,270)
SoftOrientationForB4XPages
Events:
- ActivityConfigurationChanged (NewConfiguration As AndroidContentResConfiguration)
Functions:
- AddB4XPage (Callback As Object, EventName As String, PageID As String, LayoutFile As String, DefaultOrientation As Int, Root As Object) As SoftOrientationB4XPage
If you use this library in a B4XPages project, you must add each page used in the project as SoftOrientationB4XPage.
This method adds an SoftOrientationB4XPage. The return result is an initialized SoftOrientationB4XPage that you can use further in the project.
Callback As Object - Use 'Me'.
EventName As String - Your event name.
PageID As String - Identification of the selected page.
LayoutFile As String - Layout file name for selected page from Designer.
DefaultOrientation As Int - Declare default orientation for selected page. Choose one of the constants depending on your needs, for example: SCREEN_ORIENTATION_UNSPECIFIED, SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_PORTRAIT, SCREEN_ORIENTATION_USER, SCREEN_ORIENTATION_BEHIND, SCREEN_ORIENTATION_SENSOR, SCREEN_ORIENTATION_NOSENSOR, etc...
Root As Object - The main Root as Object for selected page.
- AddB4XPage2 (Page As SoftOrientationB4XPage)
If you use this library in a B4XPages project, you must add each page used in the project as SoftOrientationB4XPage.
This method adds an already initialized SoftOrientationB4XPage.
- ApplyB4XPageDefaultOrientation (PageID As String)
Call this method when you want to activate the Default Orientation for the selected B4XPage. Be sure to call this method once in Sub B4XPage_Appear.
PageID As String - Identification of the selected page.
- ApplyB4XPageDefaultOrientation2 (Page As SoftOrientationB4XPage)
Call this method when you want to activate the Default Orientation for the selected B4XPage. Be sure to call this method once in Sub B4XPage_Appear.
Page As SoftOrientationB4XPage - SoftOrientationB4XPage variable.
- ContainsPage (PageID As String) As Boolean
Check if SoftOrientationB4XPage already exists.
PageID As String - Page identification.
- ContainsPage2 (Page As SoftOrientationB4XPage) As Boolean
Check if SoftOrientationB4XPage already exists.
- GetPage (PageID As String) As SoftOrientationB4XPage
Get SoftOrientationB4XPage with current Page identification (Id).
PageID As String - Page identification.
- GetPageAt (Index As Int) As SoftOrientationB4XPage
Get SoftOrientationB4XPage with current Page index.
Index As Int - Current page Index.
- IndexOfPage (PageID As String) As Int
Find index for SoftOrientationB4XPage.
PageID As String - Page identification.
- IndexOfPage2 (Page As SoftOrientationB4XPage) As Int
Find index for SoftOrientationB4XPage.
- Initialize (Activity As Object)
Initializes the object.
Declare 'Public' variable in 'Sub Class_Globals' in B4XMainPage (Very important).
Initialize the class instance form B4XMainPage, NOT from MainActivity (Very important).
Activity As Object - The MainActivity for all B4XPages.
Example:
Sub Class_Globals
Public SoftOrientationMain As SoftOrientationForB4XPages
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MyLayoutName")
SoftOrientationMain.Initialize(B4XPages.GetNativeParent(Me))
-----Rest of code----
End Sub
- OnConfigurationChanged (NewConfig As Object, PageID As String)
This Sub will be called when the onConfigurationChanged event is fired in the main Activity. It is not recommended that you call this Sub by yourself.
NewConfig As Object - android.content.res.Configuration from Java code.
PageID As String - Identification of the currently active B4X Page.
- OnConfigurationChanged2 (NewConfig As Object, Page As SoftOrientationB4XPage)
This Sub will be called when the onConfigurationChanged event is fired in the main Activity. It is not recommended that you call this Sub by yourself.
NewConfig As Object - android.content.res.Configuration from Java code.
Page As SoftOrientationB4XPage - Currently active B4X Page.
- RemoveB4XPage (PageID As String)
If you programmatically remove a page from your B4XPages project, be sure to remove the SoftOrientationB4XPage associated with the specific removed page.
This method removes the SoftOrientationB4XPage associated with the removed page ID.
- RemoveB4XPage2 (Page As SoftOrientationB4XPage)
If you programmatically remove a page from your B4XPages project, be sure to remove the SoftOrientationB4XPage associated with the specific removed page.
This method removes the SoftOrientationB4XPage.
- RemoveB4XPageAt (Index As Int)
If you programmatically remove a page from your B4XPages project, be sure to remove the SoftOrientationB4XPage associated with the specific removed page.
This method removes the SoftOrientationB4XPage associated with the removed page Index.
- SetB4XPageAt (Index As Int, Callback As Object, EventName As String, PageID As String, LayoutFile As String, DefaultOrientation As Int, Root As Object) As SoftOrientationB4XPage
Set and replace SoftOrientationB4XPage at current page index. Return result is initialized SoftOrientationB4XPage with the specified parameters.
Index As Int - Current page Index.
Callback As Object - Use 'Me'.
EventName As String - Your event name.
PageID As String - Identification of the selected page.
LayoutFile As String - Layout file name for selected page from Designer.
DefaultOrientation As Int - Declare default orientation for selected page. Choose one of the constants depending on your needs, for example: SCREEN_ORIENTATION_UNSPECIFIED, SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_PORTRAIT, SCREEN_ORIENTATION_USER, SCREEN_ORIENTATION_BEHIND, SCREEN_ORIENTATION_SENSOR, SCREEN_ORIENTATION_NOSENSOR, etc...
Root As Object - The main Root as Object for selected page.
- SetB4XPageAt2 (Index As Int, SoftOrientationB4XPage1 As SoftOrientationB4XPage)
Set and replace SoftOrientationB4XPage at current page index.
Index As Int - Current page Index.
Properties:
- ActivityActualConfiguration As AndroidContentResConfiguration [read only]
Get actual android.content.res.Configuration (B4A class name AndroidContentResConfiguration) from MainActivity. You can also get or set all properties and methods from android.content.res.Configuration.
- CurrentlyActiveB4XPage As SoftOrientationB4XPage [read only]
Gets the Currently active B4X Page as SoftOrientationB4XPage.
- NumberOfB4XPages As Int [read only]
Retrieve the total number of added SoftOrientationB4XPages.
- Orientation As Int [read only]
Gets or sets the screen orientation.
Choose one of the constants depending on your needs, for example: SCREEN_ORIENTATION_UNSPECIFIED, SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_PORTRAIT, SCREEN_ORIENTATION_USER, SCREEN_ORIENTATION_BEHIND, SCREEN_ORIENTATION_SENSOR, SCREEN_ORIENTATION_NOSENSOR, etc...
- OrientationAsString As String [read only]
Gets screen orientation value represented as String
- RotationInDegrees As Int [read only]
Gets actual screen rotation in degrees (Values:0,90,180,270)