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.shipdream.lib.android.mvc.samples.note.view.fragment.NoteTabletLandscape.java

@Override
public void onViewReady(View view, Bundle savedInstanceState, Reason reason) {
    super.onViewReady(view, savedInstanceState, reason);
    if (getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE) {
        NoteListFragment noteListFragment = new NoteListFragment();
        NoteDetailFragment noteDetailFragment = new NoteDetailFragment();

        FragmentManager fm = getChildFragmentManager();
        FragmentTransaction trans = fm.beginTransaction();
        trans.replace(R.id.note_large_leftPane, noteListFragment);
        trans.replace(R.id.note_large_rightPane, noteDetailFragment);
        trans.commit();//w  w  w .j  a  v a2 s  . co m
    }
}

From source file:Main.java

private static String getHumanReadableOrientation(Context context) {
    switch (context.getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        return "Landscape";
    case Configuration.ORIENTATION_PORTRAIT:
        return "Portrait";
    default:/*from  www  . j a  v  a2  s.com*/
        return "unknown";
    }
}

From source file:com.noshufou.android.su.AppDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Configuration config = getResources().getConfiguration();
    if (config.orientation == Configuration.ORIENTATION_LANDSCAPE && (config.screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        finish();/*  w ww .  j a  v a  2  s .  c  o  m*/
        return;
    }

    setContentView(R.layout.activity_app_details);
    if (savedInstanceState == null) {
        Fragment fragment = Fragment.instantiate(this, AppDetailsFragment.class.getName(),
                getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
    }
}

From source file:com.example.propertylist.DescriptionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.description_portrait_layout);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mScreenWidth = metrics.widthPixels;
    int mScreenHeight = metrics.heightPixels;

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        // If the screen is now in landscape mode, we can show the
        // description dialog in-line with the list so we don't need this activity.
        if (mScreenWidth > minScreenwidth && mScreenHeight > minScreenHeight) {
            finish();//w  ww  .j a  v a  2 s .c o  m
            return;
        }
    }

    if (savedInstanceState == null) {
        // During initial setup, plug in the description fragment.
        PropertyOverView currentOverview = new PropertyOverView();
        currentOverview.setArguments(getIntent().getExtras());
        getFragmentManager().beginTransaction().add(R.id.portrait_overview, currentOverview).commit();
    }
}

From source file:com.asksven.commandcenter.BasicDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean bForceDualPane = preferences.getBoolean("dualPaneOnSmallScreens", false);

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if (bForceDualPane || Devices.isTablet(this)) {
            // If the screen is now in landscape mode, we can show the
            // dialog in-line with the list so we don't need this activity.
            finish();//from  w  w  w  .  ja v a 2  s  . co  m
            return;
        }
    }

    if (savedInstanceState == null) {
        // During initial setup, plug in the details fragment.
        BasicDetailsFragment details = new BasicDetailsFragment();
        details.setArguments(getIntent().getExtras());
        getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit();
    }
}

From source file:com.inovex.zabbixmobile.activities.BaseDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        finish();/*from  w w w . j a va 2s .  co m*/
    }
}

From source file:com.near.chimerarevo.fragments.AboutContainerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.about_container_layout, container, false);

    boolean isLandscapeLarge = false;

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE)
            isLandscapeLarge = true;/*from   w  ww .  ja va  2  s.  c  o  m*/
    } else
        isLandscapeLarge = false;

    if (!isLandscapeLarge)
        v.setPadding(0, getResources().getDimensionPixelSize(R.dimen.actionbar_height), 0, 0);

    ViewPager pager = (ViewPager) v.findViewById(R.id.view_pager);
    pager.setAdapter(new AboutPagerAdapter());

    return v;
}

From source file:com.commonsware.android.eu4you.EU4You.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from   w  w  w  . j a  v a  2s . c  o m

    CountriesFragment countries = (CountriesFragment) getSupportFragmentManager()
            .findFragmentById(R.id.countries);

    countries.setCountryListener(this);

    Fragment f = getSupportFragmentManager().findFragmentById(R.id.details);

    detailsInline = (f != null
            && (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE));

    if (detailsInline) {
        countries.enablePersistentSelection();
    } else if (f != null) {
        f.getView().setVisibility(View.GONE);
    }
}

From source file:de.sudoq.controller.tutorial.TutorialActivity.java

private ActionBar.Tab createTab(int text, int icon) {
    ActionBar.Tab tab = getSupportActionBar().newTab();
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
        tab.setText(text);/*  www . j  a v a 2 s.  c  o  m*/
    else
        tab.setIcon(icon);

    tab.setTabListener(new MyTabListener());
    return tab;
}

From source file:com.blogspot.marioboehmer.thingibrowse.ThingDetailsActivity.java

@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    setContentView(R.layout.thing_details_activity);
    Fragment detailsFragment = getSupportFragmentManager().findFragmentById(R.id.thingDetailsFragment);
    if (detailsFragment != null && !detailsFragment.isInLayout()
            && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        finish();//from  w ww.j  a  v a 2s  .c o m
        return;
    }
}