Skip to content

Instantly share code, notes, and snippets.

@huuphuoc1396
Last active October 19, 2020 07:46
Show Gist options
  • Save huuphuoc1396/183c311acef09ca06b87018a43798194 to your computer and use it in GitHub Desktop.
Save huuphuoc1396/183c311acef09ca06b87018a43798194 to your computer and use it in GitHub Desktop.
Construct DisplayManagerHelper
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