Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE

List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.

Prototype

int SCREEN_ORIENTATION_LANDSCAPE

To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.

Click Source Link

Document

Constant corresponding to landscape in the android.R.attr#screenOrientation attribute.

Usage

From source file:org.uoyabause.android.tv.GameSelectActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean lock_landscape = sharedPref.getBoolean("pref_landscape", false);
    if (lock_landscape == true) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {//from w ww  . jav a2  s. c  o  m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }

    super.onCreate(savedInstanceState);

    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int resultCode = googleAPI.isGooglePlayServicesAvailable(this);

    if (resultCode != ConnectionResult.SUCCESS) {
        Log.e(TAG, "This device is not supported.");
    }

    Log.d(TAG, "InstanceID token: " + FirebaseInstanceId.getInstance().getToken());

    setContentView(R.layout.activity_game_select);
}

From source file:com.lweynant.yearly.action.OrientationChangeAction.java

public static ViewAction orientationLandscape() {
    return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

From source file:eu.geopaparazzi.library.forms.FragmentDetailActivity.java

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

    // don't permit rotation
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {/*from  www  . j a  va 2s.  c  o m*/
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    if (savedInstanceState != null) {
        formName = savedInstanceState.getString(FormUtilities.ATTR_FORMNAME);
    }
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        noteId = extras.getLong(LibraryConstants.DATABASE_ID);
        formName = extras.getString(FormUtilities.ATTR_FORMNAME);
        sectionObjectString = extras.getString(FormUtilities.ATTR_SECTIONOBJECTSTR);
        try {
            sectionObject = new JSONObject(sectionObjectString);
        } catch (JSONException e) {
            GPLog.error(this, null, e);
        }
        longitude = extras.getDouble(LibraryConstants.LONGITUDE);
        latitude = extras.getDouble(LibraryConstants.LATITUDE);
    }

    setContentView(R.layout.details_activity_layout);
}

From source file:com.just.agentweb.VideoImpl.java

@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    Activity mActivity;/*from   www  .  j  av a2s. c om*/
    if ((mActivity = this.mActivity) == null || mActivity.isFinishing()) {
        return;
    }
    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    Window mWindow = mActivity.getWindow();
    Pair<Integer, Integer> mPair = null;
    // ????
    if ((mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        mFlags.add(mPair);
    }

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
            && (mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        mFlags.add(mPair);
    }

    if (mMoiveView != null) {
        callback.onCustomViewHidden();
        return;
    }

    if (mWebView != null) {
        mWebView.setVisibility(View.GONE);
    }

    if (mMoiveParentView == null) {
        FrameLayout mDecorView = (FrameLayout) mActivity.getWindow().getDecorView();
        mMoiveParentView = new FrameLayout(mActivity);
        mMoiveParentView.setBackgroundColor(Color.BLACK);
        mDecorView.addView(mMoiveParentView);
    }
    this.mCallback = callback;
    mMoiveParentView.addView(this.mMoiveView = view);
    mMoiveParentView.setVisibility(View.VISIBLE);

}

From source file:me.wizos.loread.view.webview.VideoImpl.java

public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    Activity mActivity;/*from  w  ww .  j a  v  a  2 s.  c  o m*/
    if ((mActivity = this.mActivity) == null || mActivity.isFinishing()) {
        return;
    }
    // ?
    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    Window mWindow = mActivity.getWindow();
    Pair<Integer, Integer> mPair;
    // ????
    if ((mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        mFlags.add(mPair);
    }

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
            && (mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        mFlags.add(mPair);
    }

    if (videoView != null) {
        callback.onCustomViewHidden();
        return;
    }
    //        KLog.e("" + mWebView  + "   "  + videoParentView);
    if (mWebView != null) {
        mWebView.setVisibility(View.GONE);
    }

    if (videoParentView == null) {
        FrameLayout mDecorView = (FrameLayout) mActivity.getWindow().getDecorView();
        videoParentView = new FrameLayout(mActivity);
        videoParentView.setBackgroundColor(Color.BLACK);
        videoParentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); // ?
        mDecorView.addView(videoParentView);
    }

    //        KLog.e("" + mWebView.getVisibility()  + "   "  + videoParentView);
    this.mCallback = callback;
    this.videoView = view;
    videoParentView.addView(videoView, WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT);
    videoParentView.setVisibility(View.VISIBLE);
    isPlaying = true;
}

From source file:org.vqeg.viqet.activities.PhotoDetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(org.vqeg.viqet.R.layout.activity_photo_detail);

    if (getResources().getBoolean(org.vqeg.viqet.R.bool.portrait_only)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {//from   ww  w . j a  va 2 s . com
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }

    photo = (Photo) getIntent().getSerializableExtra(PHOTO_ID);
    resultIndex = getIntent().getIntExtra(RESULT_ID, 0);
    stepIndex = getIntent().getIntExtra(STEP_ID, 0);

    initialize();
}

From source file:com.example.android.materialdesigncodelab.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (!RadioApplication.isPortrait)
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    else//from  w  w  w .j a  va  2  s  . c om
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    activity = this;
    // Adding Toolbar to Main screen
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Setting ViewPager for each Tabs
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);
    // Set Tabs inside Toolbar
    TabLayout tabs = (TabLayout) findViewById(R.id.tabs);
    tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    tabs.setupWithViewPager(viewPager);
    // Adding menu icon to Toolbar
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }

}

From source file:foam.bumpercrop.starwisp.java

/** Called when the activity is first created. */
@Override//from  www . j  a v a 2s. c  o m
public void onCreate(Bundle savedInstanceState) {
    Log.i("starwisp", "top onCreate...");
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    String dirname = "bumpercrop/";
    m_AppDir = "/sdcard/" + dirname;
    File appdir = new File(m_AppDir);
    appdir.mkdirs();

    File filesdir = new File(m_AppDir + "/files/");
    filesdir.mkdirs();

    // build static things
    m_Scheme = new Scheme(this);

    m_Scheme.Load("lib.scm");
    m_Scheme.Load("racket-fix.scm");
    m_Scheme.Load("eavdb/ktv.ss");
    m_Scheme.Load("eavdb/ktv-list.ss");
    m_Scheme.Load("eavdb/entity-values.ss");
    m_Scheme.Load("eavdb/entity-insert.ss");
    m_Scheme.Load("eavdb/entity-get.ss");
    m_Scheme.Load("eavdb/entity-update.ss");
    m_Scheme.Load("eavdb/entity-filter.ss");
    m_Scheme.Load("eavdb/entity-sync.ss");
    m_Scheme.Load("eavdb/entity-csv.ss");
    m_Scheme.Load("eavdb/eavdb.ss");
    m_Scheme.Load("dbsync.scm");

    Log.i("starwisp", "running boot.scm...");
    m_Scheme.Load("boot.scm");
    m_Scheme.Load("models.scm");
    Log.i("starwisp", "running compiler.scm...");
    m_Scheme.Load("compiler.scm");

    m_Builder = new StarwispBuilder(m_Scheme);
    m_Name = "main";

    // tell scheme the date
    final Calendar c = Calendar.getInstance();
    int day = c.get(Calendar.DAY_OF_MONTH);
    int month = c.get(Calendar.MONTH) + 1;
    int year = c.get(Calendar.YEAR);

    // pass in a bunch of useful stuff
    m_Scheme.eval("(define dirname \"/sdcard/" + dirname + "\")(define date-day " + day
            + ") (define date-month " + month + ") (define date-year " + year + ")");

    Log.i("starwisp", "started, now running starwisp.scm...");
    m_Scheme.Load("translations.scm");
    m_Scheme.Load("starwisp.scm");

    super.onCreate(savedInstanceState);

}

From source file:cl.ipp.katbag.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setBehindContentView(R.layout.fragment_menu);

    katbagHandler = new KatbagHandlerSqlite(context);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);

    slidingMenu = getSlidingMenu();/*from w  ww  . j  a va  2 s. c  o  m*/

    // tablet
    if (findViewById(R.id.fragment_menu_container) != null) {
        slidingMenu.setSlidingEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(false);
        TABLET = true;// tablet
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    } else { // smartphone
        slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
        slidingMenu.setShadowDrawable(R.drawable.shadow);
        slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        slidingMenu.setFadeDegree(0.35f);
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        slidingMenu.setSlidingEnabled(true);
        slidingMenu.setOnOpenListener(new OnOpenListener() {

            @Override
            public void onOpen() {
                hideSoftKeyboard();
            }
        });

        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        actionBar.setDisplayHomeAsUpEnabled(true);
        TABLET = false;// tablet
    }

    mFragment = new Board();
    m = getSupportFragmentManager();
    FragmentTransaction t = m.beginTransaction();
    t.replace(R.id.fragment_main_container, mFragment);
    t.addToBackStack(mFragment.getClass().getSimpleName());
    getSupportFragmentManager();
    m.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    t.commit();

    setTextVersion();
}

From source file:com.waz.zclient.utils.ViewUtils.java

public static void lockScreenOrientation(int orientation, Activity activity) {
    switch (orientation) {
    case Configuration.ORIENTATION_PORTRAIT:
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;/*from w  w w .j av a2  s  . c  o  m*/
    case Configuration.ORIENTATION_LANDSCAPE:
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
    default:
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        break;
    }
}