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:dev.ronlemire.commoncontrols.MainActivity.java

    public void StartLayoutFrameFragment() {
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {// w w w .j  ava2s.com
      Fragment layoutFrameFragment = (Fragment) fm
            .findFragmentById(R.id.sample_replacer);
      layoutFrameFragment = LayoutFrameFragment.newInstance("LayoutFrame");

      fm.beginTransaction()
         .replace(R.id.sample_replacer, layoutFrameFragment)
         .commit();
   } else {
      LayoutFrameFragment layoutFrameFragment = LayoutFrameFragment
            .newInstance("LayoutFrame");
      getSupportFragmentManager().beginTransaction()
            .replace(MainActivity.sampleListView.getId(), layoutFrameFragment)
            .commit();
   }
}

From source file:com.nttec.everychan.ui.MainActivity.java

private void handleOrientationChange(Configuration configuration, boolean doNotReloadBoardFragment) {
    boolean newOrientation = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE;
    if (newOrientation != isHorizontalOrientation) {
        if (rootViewWeight != 1.0f) {
            clearCache();// www.  j  a  v a  2 s . co m
            restartActivity();
        } else {
            if (!doNotReloadBoardFragment && FlowTextHelper.IS_AVAILABLE) {
                reloadCurrentBoardFragment();
            }
            isHorizontalOrientation = newOrientation;
        }
    }
}

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

public void StartLayoutRelativeFragment() {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) {
        Fragment layoutRelativeFragment = (Fragment) fm.findFragmentById(R.id.sample_replacer);
        layoutRelativeFragment = LayoutRelativeFragment.newInstance("LayoutRelative");

        fm.beginTransaction().replace(R.id.sample_replacer, layoutRelativeFragment).commit();
    } else {//from   w  w w .ja va 2s.  c o  m
        LayoutRelativeFragment layoutRelativeFragment = LayoutRelativeFragment.newInstance("LayoutRelative");
        getSupportFragmentManager().beginTransaction()
                .replace(MainActivity.sampleListView.getId(), layoutRelativeFragment).commit();
    }
}

From source file:com.esri.squadleader.view.SquadLeaderActivity.java

private void adjustLayoutForOrientation(int orientation) {
    View displayView = findViewById(R.id.tableLayout_display);
    if (displayView.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) displayView.getLayoutParams();
        switch (orientation) {
        case Configuration.ORIENTATION_LANDSCAPE: {
            params.addRule(RelativeLayout.RIGHT_OF, R.id.toggleButton_grid);
            params.addRule(RelativeLayout.LEFT_OF, R.id.toggleButton_followMe);
            params.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.imageButton_zoomOut);
            params.addRule(RelativeLayout.ABOVE, -1);
            break;
        }/*from  w  w w.  j  av a 2  s .c o  m*/
        case Configuration.ORIENTATION_PORTRAIT:
        default: {
            params.addRule(RelativeLayout.RIGHT_OF, -1);
            params.addRule(RelativeLayout.LEFT_OF, R.id.imageButton_zoomIn);
            params.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.imageButton_zoomIn);
            params.addRule(RelativeLayout.ABOVE, R.id.toggleButton_grid);
        }
        }
        displayView.setLayoutParams(params);
    }
}

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

    public void StartLayoutRelativeFragment() {
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {//from w  w w  .  jav  a2  s .c  o m
      Fragment layoutRelativeFragment = (Fragment) fm
            .findFragmentById(R.id.sample_replacer);
      layoutRelativeFragment = LayoutRelativeFragment.newInstance("LayoutRelative");

      fm.beginTransaction()
         .replace(R.id.sample_replacer, layoutRelativeFragment)
         .commit();
   } else {
      LayoutRelativeFragment layoutRelativeFragment = LayoutRelativeFragment
            .newInstance("LayoutRelative");
      getSupportFragmentManager().beginTransaction()
            .replace(MainActivity.sampleListView.getId(), layoutRelativeFragment)
            .commit();
   }
}

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

public void StartLayoutTable1Fragment() {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) {
        Fragment layoutTable1Fragment = (Fragment) fm.findFragmentById(R.id.sample_replacer);
        layoutTable1Fragment = LayoutTable1Fragment.newInstance("LayoutTable1");

        fm.beginTransaction().replace(R.id.sample_replacer, layoutTable1Fragment).commit();
    } else {/*from w w w  . j  a  v a 2 s . c  o  m*/
        LayoutTable1Fragment layoutTable1Fragment = LayoutTable1Fragment.newInstance("LayoutTable1");
        getSupportFragmentManager().beginTransaction()
                .replace(MainActivity.sampleListView.getId(), layoutTable1Fragment).commit();
    }
}

From source file:org.openremote.android.console.GroupActivity.java

/**
 * Detect the phone's orientation and display the corresponding screen.
 * //from w ww  .  j  a  v  a2  s  .  com
 * @see android.app.Activity#onConfigurationChanged(android.content.res.Configuration)
 */
@Override
public void onConfigurationChanged(Configuration newConfig) {
    int newOrientation = newConfig.orientation;
    Log.i("OpenRemote-ORIENTATION", "orientation:" + newOrientation);
    if (lastConfigurationOrientation != newOrientation) {
        if (newOrientation == Configuration.ORIENTATION_PORTRAIT) {
            isLandscape = false;
        } else if (newOrientation == Configuration.ORIENTATION_LANDSCAPE) {
            isLandscape = true;
        }
        if (canRotateToInterfaceOrientation()) {
            rotateToIntefaceOrientation();
        }
    }
    super.onConfigurationChanged(newConfig);
    lastConfigurationOrientation = newOrientation;
}

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

    public void StartLayoutTable1Fragment() {
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {//w w w  .ja  va  2 s . co  m
      Fragment layoutTable1Fragment = (Fragment) fm
            .findFragmentById(R.id.sample_replacer);
      layoutTable1Fragment = LayoutTable1Fragment.newInstance("LayoutTable1");

      fm.beginTransaction()
         .replace(R.id.sample_replacer, layoutTable1Fragment)
         .commit();
   } else {
      LayoutTable1Fragment layoutTable1Fragment = LayoutTable1Fragment
            .newInstance("LayoutTable1");
      getSupportFragmentManager().beginTransaction()
            .replace(MainActivity.sampleListView.getId(), layoutTable1Fragment)
            .commit();
   }
}

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

public void StartLayoutTable2Fragment() {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) {
        Fragment layoutTable2Fragment = (Fragment) fm.findFragmentById(R.id.sample_replacer);
        layoutTable2Fragment = LayoutTable2Fragment.newInstance("LayoutTable2");

        fm.beginTransaction().replace(R.id.sample_replacer, layoutTable2Fragment).commit();
    } else {//from ww  w. ja va  2  s. com
        LayoutTable2Fragment layoutTable2Fragment = LayoutTable2Fragment.newInstance("LayoutTable2");
        getSupportFragmentManager().beginTransaction()
                .replace(MainActivity.sampleListView.getId(), layoutTable2Fragment).commit();
    }
}

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

    public void StartLayoutTable2Fragment() {
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {/*from w w  w .j  av  a2s. c  o  m*/
      Fragment layoutTable2Fragment = (Fragment) fm
            .findFragmentById(R.id.sample_replacer);
      layoutTable2Fragment = LayoutTable2Fragment.newInstance("LayoutTable2");

      fm.beginTransaction()
         .replace(R.id.sample_replacer, layoutTable2Fragment)
         .commit();
   } else {
      LayoutTable2Fragment layoutTable2Fragment = LayoutTable2Fragment
            .newInstance("LayoutTable2");
      getSupportFragmentManager().beginTransaction()
            .replace(MainActivity.sampleListView.getId(), layoutTable2Fragment)
            .commit();
   }
}