Last active
October 19, 2020 07:46
-
-
Save huuphuoc1396/183c311acef09ca06b87018a43798194 to your computer and use it in GitHub Desktop.
Construct DisplayManagerHelper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// Try to construct the DisplayMangerHelper. | |
// If it isn't successful, this device isn't LG dual screens | |
displayManagerHelper = DisplayManagerHelper(applicationContext) | |
coverDisplayCallback = MainCoverDisplayCallback() | |
smartCoverCallback = MainSmartCoverCallback() | |
// Register the callbacks for covers | |
displayManagerHelper?.registerCoverDisplayEnabledCallback( | |
applicationContext.packageName, | |
coverDisplayCallback | |
) | |
displayManagerHelper?.registerSmartCoverCallback(smartCoverCallback) | |
isLGDualScreen = true | |
} catch (e: Exception) { | |
isLGDualScreen = false | |
Log.e(TAG, "This device isn't LG dual screens", e) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment