DeviceInfo

Additional

Language
Java
Version
N/A
Created
Jul 14, 2016
Updated
Feb 7, 2018
Owner
EyeEm (eyeem)
Contributors
vishna
ronaldoeyeem
dpenic
3
Activity
Badge
Generate
Download
Source code

Advertisement

DeviceInfo

Easy info about Android device

(currently) available info:

  • is7inch;
  • is10inch;
  • isPortrait;
  • isLandscape;
  • isPhone;
  • isTablet;
  • isInMultiWindowMode;
  • isInPictureInPictureMode;
  • isAmazon;
  • heightPixels;
  • heightDip;
  • widthPixels;
  • widthDip;
  • smallestWidthDp;
  • statusBarHeight;
  • navigationBarHeight;
  • diagonalScreenSize;
  • displayRealSize;
// add to your dependencies
compile 'com.eyeem.deviceinfo:library:<latest>'
// get reference to latest info using context, activity, or view
DeviceInfo di = DeviceInfo.get(context);
// or
DeviceInfo di = DeviceInfo.get(view);

// use as needed
if(di.isPortrait) {
   view.getLayoutParams.width = di.widthPixels;
}

Pull requests welcome!