Java Code Examples for android.content.res.Configuration#ORIENTATION_SQUARE

The following examples show how to use android.content.res.Configuration#ORIENTATION_SQUARE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DisplayUtils.java    From alpha-wallet-android with MIT License 6 votes vote down vote up
public static int getScreenOrientation(Context context)
{
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();

    int orientation = Configuration.ORIENTATION_UNDEFINED;
    if(display.getWidth()==display.getHeight()){
        orientation = Configuration.ORIENTATION_SQUARE;
    } else{
        if(display.getWidth() < display.getHeight()){
            orientation = Configuration.ORIENTATION_PORTRAIT;
        }else {
            orientation = Configuration.ORIENTATION_LANDSCAPE;
        }
    }
    return orientation;
}
 
Example 2
Source File: DisplayUtils.java    From smartcoins-wallet with MIT License 6 votes vote down vote up
public static int getScreenOrientation(Context context)
{
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();

    int orientation = Configuration.ORIENTATION_UNDEFINED;
    if(display.getWidth()==display.getHeight()){
        orientation = Configuration.ORIENTATION_SQUARE;
    } else{
        if(display.getWidth() < display.getHeight()){
            orientation = Configuration.ORIENTATION_PORTRAIT;
        }else {
            orientation = Configuration.ORIENTATION_LANDSCAPE;
        }
    }
    return orientation;
}
 
Example 3
Source File: HWRManager.java    From sinovoice-pathfinder with MIT License 6 votes vote down vote up
public void prepareRecog(){
	strokeMgr = StrokeMgr.instance();
	
	Configuration config = mContext.getResources().getConfiguration();
	if(config.orientation == Configuration.ORIENTATION_PORTRAIT
			|| config.orientation == Configuration.ORIENTATION_SQUARE){
		currSplitMode = com.sinovoice.hcicloudsdk.api.hwr.HciCloudHwr.HCI_HWR_SPLIT_MODE_OVERLAP;
	}else if(config.orientation == Configuration.ORIENTATION_LANDSCAPE){
		currSplitMode = com.sinovoice.hcicloudsdk.api.hwr.HciCloudHwr.HCI_HWR_SPLIT_MODE_LINE;
	}else{
		currSplitMode = com.sinovoice.hcicloudsdk.api.hwr.HciCloudHwr.HCI_HWR_SPLIT_MODE_OVERLAP;
	}
	
	lastSpliteMode = currSplitMode;
	
	recogThread =  new HwrRecogThread();
	recogThread.start();
	
	mIsInited = true;
}
 
Example 4
Source File: DeviceOrientations.java    From sentry-android with MIT License 5 votes vote down vote up
/**
 * Get the device's current screen orientation.
 *
 * @return the device's current screen orientation, or null if unknown
 */
@SuppressWarnings("deprecation")
public static @Nullable Device.DeviceOrientation getOrientation(int orientation) {
  switch (orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
      return Device.DeviceOrientation.LANDSCAPE;
    case Configuration.ORIENTATION_PORTRAIT:
      return Device.DeviceOrientation.PORTRAIT;
    case Configuration.ORIENTATION_SQUARE:
    case Configuration.ORIENTATION_UNDEFINED:
    default:
      return null;
  }
}
 
Example 5
Source File: MyActionBarActivity.java    From Clip-Stack with MIT License 5 votes vote down vote up
public int getScreenOrientation() {
    int width = getScreenWidthPixels();
    int height = getScreenHeightPixels();
    if (width > height) {
        Log.v(MyUtil.PACKAGE_NAME, "ORIENTATION_LANDSCAPE");
        return Configuration.ORIENTATION_LANDSCAPE;
    }
    if (width < height) {
        Log.v(MyUtil.PACKAGE_NAME, "ORIENTATION_PORTRAIT");
        return Configuration.ORIENTATION_PORTRAIT;
    }
    Log.v(MyUtil.PACKAGE_NAME, "ORIENTATION_SQUARE");
    return Configuration.ORIENTATION_SQUARE;
}
 
Example 6
Source File: Utils.java    From BatteryFu with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reliably get orientation. Return values are one of
 * Configuration.ORIENTATION_XXXXX
 * 
 * @return
 */
public int getScreenOrientation(Activity context) {
   Display getOrient = context.getWindowManager().getDefaultDisplay();
   int orientation = Configuration.ORIENTATION_UNDEFINED;
   if (getOrient.getWidth() == getOrient.getHeight()) {
      orientation = Configuration.ORIENTATION_SQUARE;
   } else {
      if (getOrient.getWidth() < getOrient.getHeight()) {
         orientation = Configuration.ORIENTATION_PORTRAIT;
      } else {
         orientation = Configuration.ORIENTATION_LANDSCAPE;
      }
   }
   return orientation;
}