Example usage for android.content.res Configuration ORIENTATION_LANDSCAPE

List of usage examples for android.content.res Configuration ORIENTATION_LANDSCAPE

Introduction

In this page you can find the example usage for android.content.res Configuration ORIENTATION_LANDSCAPE.

Prototype

int ORIENTATION_LANDSCAPE

To view the source code for android.content.res Configuration ORIENTATION_LANDSCAPE.

Click Source Link

Document

Constant for #orientation , value corresponding to the land resource qualifier.

Usage

From source file:com.anysoftkeyboard.AnySoftKeyboard.java

@Override
public boolean onEvaluateFullscreenMode() {
    if (getCurrentInputEditorInfo() != null) {
        final EditorInfo editorInfo = getCurrentInputEditorInfo();
        if ((editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0) {
            //if the view DOES NOT want fullscreen, then do what it wants
            Logger.d(TAG, "Will not go to Fullscreen because input view requested IME_FLAG_NO_FULLSCREEN");
            return false;
        } else if ((editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0) {
            Logger.d(TAG, "Will not go to Fullscreen because input view requested IME_FLAG_NO_EXTRACT_UI");
            return false;

        }/*w ww. j  a v  a 2s. com*/
    }

    switch (getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        return mAskPrefs.getUseFullScreenInputInLandscape();
    default:
        return mAskPrefs.getUseFullScreenInputInPortrait();
    }
}

From source file:dev.ronlemire.commoncontrols.MainActivity.java

    public void StartWeightGravityFragment() {
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {//from  ww  w  . j av a 2  s .c o m
      Fragment weightGravityFragment = (Fragment) fm
            .findFragmentById(R.id.sample_replacer);
      weightGravityFragment = WeightGravityFragment.newInstance("WeightGravity");

      fm.beginTransaction()
         .replace(R.id.sample_replacer, weightGravityFragment)
         .commit();
   } else {
      WeightGravityFragment weightGravityFragment = WeightGravityFragment
            .newInstance("WeightGravity");
      getSupportFragmentManager().beginTransaction()
            .replace(MainActivity.sampleListView.getId(), weightGravityFragment)
            .commit();
   }
}

From source file:com.aimfire.demo.CameraActivity.java

public int getDeviceDefaultOrientation() {
    WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

    Configuration config = getResources().getConfiguration();

    int rotation = windowManager.getDefaultDisplay().getRotation();

    if (((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180)
            && config.orientation == Configuration.ORIENTATION_LANDSCAPE)
            || ((rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270)
                    && config.orientation == Configuration.ORIENTATION_PORTRAIT)) {
        return Configuration.ORIENTATION_LANDSCAPE;
    } else {// w w  w .  ja va 2  s. c o  m
        return Configuration.ORIENTATION_PORTRAIT;
    }
}

From source file:edu.mit.viral.shen.DroidFish.java

/** Return true if left-handed layout should be used. */
private final boolean leftHandedView() {
    return settings.getBoolean("leftHanded", false)
            && (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
}

From source file:dev.ronlemire.commoncontrols.MainActivity.java

private void ReturnToSampleList() {
    ClearMessageBox();//from  ww w.  ja v  a2 s.c  o m
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) {
        StartListofControlsFragment();
        StartEmptyFragment();
    } else {
        ListOfControlsFragment sampleListFragment = ListOfControlsFragment.newInstance("List");
        getSupportFragmentManager().beginTransaction()
                .replace(MainActivity.sampleListView.getId(), sampleListFragment).commit();
    }
}

From source file:com.lewa.crazychapter11.MainActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    String screen = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE ? "??"
            : "??";

    Toast.makeText(this, "???" + "\n ??" + screen, Toast.LENGTH_LONG)
            .show();//from w w w .  jav a  2  s.  c  o m
    show_txt = (EditText) findViewById(R.id.show_txt);
    show_txt.setText("??");

    Log.v("algerhe2", "onConfiguration changed entry !!!");
}

From source file:dev.ronlemire.commoncontrols.MainActivity.java

 private void ReturnToSampleList() {
   ClearMessageBox();/*from  w w w  .j  a v  a2  s .c  o m*/
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {
      StartListofControlsFragment();
      StartEmptyFragment();
   } else {
      ListOfControlsFragment sampleListFragment = ListOfControlsFragment
            .newInstance("List");
      getSupportFragmentManager()
            .beginTransaction()
            .replace(MainActivity.sampleListView.getId(),
                  sampleListFragment).commit();
   }
}

From source file:com.aimfire.main.MainActivity.java

public int getScreenOrientation() {
    int rotation = getWindowManager().getDefaultDisplay().getRotation();
    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270) {
            return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        } else {//from   w  ww  .j a  va2s . co  m
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        }
    }
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) {
            return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        } else {
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        }
    }
    return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}

From source file:com.androzic.MapActivity.java

protected void updateNavigationStatus() {
    boolean isNavigating = navigationService != null && navigationService.isNavigating();
    boolean isNavigatingViaRoute = isNavigating && navigationService.isNavigatingViaRoute();

    // waypoint panel
    findViewById(R.id.waypointinfo).setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    // route panel
    findViewById(R.id.routeinfo).setVisibility(isNavigatingViaRoute ? View.VISIBLE : View.GONE);
    // distance//from   w w w.j  av  a2s.c o  m
    distanceValue.setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    findViewById(R.id.distancelt).setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    // bearing
    bearingValue.setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    findViewById(R.id.bearinglt).setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    // turn
    turnValue.setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    findViewById(R.id.turnlt).setVisibility(isNavigating ? View.VISIBLE : View.GONE);
    // xtk
    xtkValue.setVisibility(isNavigatingViaRoute ? View.VISIBLE : View.GONE);
    findViewById(R.id.xtklt).setVisibility(isNavigatingViaRoute ? View.VISIBLE : View.GONE);

    // we hide elevation in portrait mode due to lack of space
    if (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
        if (isNavigatingViaRoute && elevationValue.getVisibility() == View.VISIBLE) {
            elevationValue.setVisibility(View.GONE);
            findViewById(R.id.elevationlt).setVisibility(View.GONE);

            ViewGroup row = (ViewGroup) findViewById(R.id.movingrow);
            int pos = row.indexOfChild(elevationValue);
            View xtklt = findViewById(R.id.xtklt);
            row.removeView(xtkValue);
            row.removeView(xtklt);
            row.addView(xtklt, pos);
            row.addView(xtkValue, pos);
            row.getParent().requestLayout();
        } else if (!isNavigatingViaRoute && elevationValue.getVisibility() == View.GONE) {
            elevationValue.setVisibility(View.VISIBLE);
            findViewById(R.id.elevationlt).setVisibility(View.VISIBLE);

            ViewGroup row = (ViewGroup) findViewById(R.id.movingrow);
            int pos = row.indexOfChild(xtkValue);
            View elevationlt = findViewById(R.id.elevationlt);
            row.removeView(elevationValue);
            row.removeView(elevationlt);
            row.addView(elevationlt, pos);
            row.addView(elevationValue, pos);
            row.getParent().requestLayout();
        }
    }

    if (isNavigatingViaRoute) {
        routeName.setText(" " + navigationService.navRoute.name);
    }
    if (isNavigating) {
        waypointName.setText(" " + navigationService.navWaypoint.name);
        if (application.navigationOverlay == null) {
            application.navigationOverlay = new NavigationOverlay(this);
            application.navigationOverlay.onMapChanged();
        }
    } else if (application.navigationOverlay != null) {
        application.navigationOverlay.onBeforeDestroy();
        application.navigationOverlay = null;
    }

    updateMapViewArea();
    map.update();
}

From source file:com.intel.xdk.device.Device.java

private void updateOrientation() {
    if (rotateOrientation.equalsIgnoreCase("landscape")) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (rotateOrientation.equalsIgnoreCase("portrait")) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {/* w  w w . j a va 2 s. c o m*/
        activity.setRequestedOrientation(shouldAutoRotate ? ActivityInfo.SCREEN_ORIENTATION_SENSOR
                : activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
                        ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                        : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
}