List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_USER
int SCREEN_ORIENTATION_USER
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_USER.
Click Source Link
user
in the android.R.attr#screenOrientation attribute. From source file:com.cpd.activities.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (getResources().getBoolean(R.bool.portrait_only)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else {/*w w w .j a v a2 s. c om*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } configureToolbar(); configurePagerTabs(); }
From source file:com.cpd.activities.NewsOpenActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_news_open); if (getResources().getBoolean(R.bool.portrait_only)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else {/* w w w . j ava 2 s . c om*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } Intent intent = getIntent(); mNewsVo = (NewsVo) intent.getSerializableExtra(AppTags.NEWS_VO); TrackerUtils.clickNewsArticle(mNewsVo.title); final TextView articleTextView = (TextView) findViewById(R.id.news_activity_text); mLoader = new NewsLoader(new NewsParser.NewsReady() { @Override public void OnNewsReady(NewsVo newsArticle) { mConnectionTries++; /* Avoid infinite loop */ if (mConnectionTries <= ConnectionUtils.MAX_NETWORK_TENTATIVES) { if (newsArticle.articleText == null) { mLoader.run(mNewsVo, true); } else { // Interpret HTML tags mConnectionTries = 0; articleTextView.setText(Html.fromHtml(newsArticle.articleText)); articleTextView.setMovementMethod(LinkMovementMethod.getInstance()); if (DebugUtils.DEBUG) Log.d(TAG, "Opened article: " + newsArticle.title); } } else { if (DebugUtils.ERROR) Log.e(TAG, "Not connecting to news!"); } } }); mLoader.run(mNewsVo, true); // The RssParser already gives the title and image. Therefore, we can load this content // while the NewsParser is running. Toolbar toolbar = (Toolbar) findViewById(R.id.news_open_toolbar); setSupportActionBar(toolbar); ImageView imageView = (ImageView) findViewById(R.id.news_activity_picture); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openImageActivity(); } }); Picasso.with(this).load(mNewsVo.imgLargeUrl).into(imageView); TextView titleView = (TextView) findViewById(R.id.news_activity_title); titleView.setText(mNewsVo.title); }
From source file:im.ene.lab.toro.sample.activity.ShowCaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(getResources().getBoolean(R.bool.is_large_screen) ? // ActivityInfo.SCREEN_ORIENTATION_USER : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_show_case); String name = getIntent().getStringExtra(EXTRA_FRAGMENT_NAME); setTitle(getFragmentTitle(name));//from ww w . ja v a2s. c om Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.container); if (fragment == null) { fragment = getFragment(name); if (fragment != null) { getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit(); } } }
From source file:im.ene.lab.toro.sample.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(getResources().getBoolean(R.bool.is_large_screen) ? // ActivityInfo.SCREEN_ORIENTATION_USER : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_main); ButterKnife.bind(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w w w. jav a 2 s. c om*/ DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); int lastSelected = ToroSampleApp.pref().getInt(PREF_KEY_STRATEGY, 0); Toro.setStrategy(mStrategies.get(lastSelected)); }
From source file:de.limexcomputer.cordova.plugin.rotationlock.RotationLock.java
/** * Executes the request./* w w w . j a v a 2s .c om*/ * * This method is called from the WebView thread. * To do a non-trivial amount of work, use: * cordova.getThreadPool().execute(runnable); * * To run on the UI thread, use: * cordova.getActivity().runOnUiThread(runnable); * * @param action The action to execute. * @param args The exec() arguments in JSON form. * @param callback The callback context used when calling back into JavaScript. * @return Whether the action was valid. */ @Override public boolean execute(String action, JSONArray args, CallbackContext callback) throws JSONException { if (!action.equalsIgnoreCase("setOrientation")) { return false; } String orientation = args.optString(0); Activity activity = this.cordova.getActivity(); // refer to https://github.com/their/pg-plugin-screen-orientation/blob/master/src/ScreenOrientation.java if (orientation.equals(UNSPECIFIED)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(USER)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } else if (orientation.equals(BEHIND)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND); } else if (orientation.equals(SENSOR)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else if (orientation.equals(NOSENSOR)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } else if (orientation.equals(SENSOR_LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(SENSOR_PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(REVERSE_LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(REVERSE_PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else if (orientation.equals(FULL_SENSOR)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); } callback.success(orientation); return true; }
From source file:org.apache.cordova.screenorientation.ScreenOrientation.java
public int getOrientation(String orientation) { if (orientation.equals(UNSPECIFIED)) { return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(USER)) { return (ActivityInfo.SCREEN_ORIENTATION_USER); } else if (orientation.equals(BEHIND)) { return (ActivityInfo.SCREEN_ORIENTATION_BEHIND); } else if (orientation.equals(SENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else if (orientation.equals(NOSENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } else if (orientation.equals(SENSOR_LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(SENSOR_PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(REVERSE_LANDSCAPE)) { return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(REVERSE_PORTRAIT)) { return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else if (orientation.equals(FULL_SENSOR)) { return (ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); }//ww w. j av a 2 s .c om return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); }
From source file:com.waz.zclient.pages.main.conversation.SingleImageFragment.java
@Override @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) protected void onPostAttach(Activity activity) { super.onPostAttach(activity); activityOrientation = activity.getRequestedOrientation(); activity.setRequestedOrientation(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? ActivityInfo.SCREEN_ORIENTATION_FULL_USER : ActivityInfo.SCREEN_ORIENTATION_USER); }
From source file:org.mklab.mikity.android.MainActivity.java
/** * ??????/*from w w w . j av a 2 s . c o m*/ */ public void controlRotation() { final Configuration configuration = getResources().getConfiguration(); final int rotation = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay().getRotation(); boolean isReverse = false; if (this.settingsFragment.rotationLockButton.isChecked()) { switch (rotation) { case Surface.ROTATION_180: case Surface.ROTATION_270: isReverse = true; break; default: isReverse = false; break; } if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (isReverse) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } } else { if (isReverse) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } MainActivity.this.canvasFragment.objectRenderer.updateDisplay(); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } }
From source file:de.spiritcroc.modular_remote.MainActivity.java
@Override protected void onResume() { super.onResume(); appWidgetHost.startListening();/*from w w w.ja va 2 s . co m*/ tcpConnectionManager.refreshConnections(); viewPager.addOnPageChangeListener(this); onPageSelected(viewPager.getCurrentItem()); int tmp = Util.getPreferenceInt(sharedPreferences, Preferences.OFFSCREEN_PAGE_LIMIT, 2); if (tmp < 0) { neverDestroyPages = true; viewPager.setOffscreenPageLimit(pages.size()); } else { neverDestroyPages = false; viewPager.setOffscreenPageLimit(tmp); } fullscreen = sharedPreferences.getBoolean(Preferences.FULLSCREEN, false); hideNavigationBar = sharedPreferences.getBoolean(Preferences.HIDE_NAVIGATION_BAR, false); hideActionBar = sharedPreferences.getBoolean(Preferences.HIDE_ACTION_BAR, false); int pagerTabStripVisibility = sharedPreferences.getBoolean(Preferences.HIDE_PAGER_TAB_STRIP, false) ? View.GONE : View.VISIBLE; if (pagerTabStrip.getVisibility() != pagerTabStripVisibility) { pagerTabStrip.setVisibility(pagerTabStripVisibility); } String ringerMode = sharedPreferences.getString(Preferences.CHANGE_RINGER_MODE, getString(R.string.pref_ringer_mode_keep_value)); AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); previousRingerMode = audioManager.getRingerMode(); if (getString(R.string.pref_ringer_mode_mute_value).equals(ringerMode)) { audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT); changedRingerMode = true; } else if (getString(R.string.pref_ringer_mode_vibrate_value).equals(ringerMode)) { audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); changedRingerMode = true; } else if (getString(R.string.pref_ringer_mode_vibrate_if_not_muted_value).equals(ringerMode) && previousRingerMode != AudioManager.RINGER_MODE_SILENT) { audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); changedRingerMode = true; } if (forceOrientation == FORCE_ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (forceOrientation == FORCE_ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { String orientation = sharedPreferences.getString(Preferences.ORIENTATION, Preferences.ORIENTATION_SHARE_LAYOUT); if (Preferences.ORIENTATION_PORTRAIT_ONLY.equals(orientation)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (Preferences.ORIENTATION_LANDSCAPE_ONLY.equals(orientation)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } } resizeContent(); setLockedModeVisibilities(); }
From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java
public final void setAutorotateEnable(int enabled) { int ori = ActivityInfo.SCREEN_ORIENTATION_USER; if (enabled == 1) { ori = getOrientationForRotation(); }/* w w w .j av a 2s .c o m*/ final int orientation = ori; new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { setRequestedOrientation(orientation); ; } }.sendEmptyMessageDelayed(0, 100); }