ScreenUtils

class ScreenUtils
    author: Blankj
    blog  : http://blankj.com
    time  : 2016/08/02
    desc  : utils about screen

Functions

getScreenDensity
Link copied to clipboard
open fun getScreenDensity(): Float
Return the density of screen.
getScreenDensityDpi
Link copied to clipboard
open fun getScreenDensityDpi(): Int
Return the screen density expressed as dots-per-inch.
getScreenHeight
Link copied to clipboard
open fun getScreenHeight(): Int
Return the height of screen, in pixel.
getScreenRotation
Link copied to clipboard
open fun getScreenRotation(@NonNull() activity: Activity): Int
Return the rotation of screen.
getScreenWidth
Link copied to clipboard
open fun getScreenWidth(): Int
Return the width of screen, in pixel.
getSleepDuration
Link copied to clipboard
open fun getSleepDuration(): Int
Return the duration of sleep.
isLandscape
Link copied to clipboard
open fun isLandscape(): Boolean
Return whether screen is landscape.
isPortrait
Link copied to clipboard
open fun isPortrait(): Boolean
Return whether screen is portrait.
isScreenLock
Link copied to clipboard
open fun isScreenLock(): Boolean
Return whether screen is locked.
isTablet
Link copied to clipboard
open fun isTablet(): Boolean
Return whether device is tablet.
screenShot
Link copied to clipboard
open fun screenShot(@NonNull() activity: Activity): Bitmap
Return the bitmap of screen.
open fun screenShot(@NonNull() activity: Activity, isDeleteStatusBar: Boolean): Bitmap
Return the bitmap of screen.
setFullScreen
Link copied to clipboard
open fun setFullScreen(@NonNull() activity: Activity)
Set full screen.
setLandscape
Link copied to clipboard
open fun setLandscape(@NonNull() activity: Activity)
Set the screen to landscape.
setPortrait
Link copied to clipboard
open fun setPortrait(@NonNull() activity: Activity)
Set the screen to portrait.
setSleepDuration
Link copied to clipboard
open fun setSleepDuration(duration: Int)
Set the duration of sleep.