List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_NOSENSOR
int SCREEN_ORIENTATION_NOSENSOR
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_NOSENSOR.
Click Source Link
nosensor
in the android.R.attr#screenOrientation attribute. From source file:com.landenlabs.all_devtool.GpsFragment.java
@Override public void onSelected() { GlobalInfo.s_globalInfo.mainFragActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); GlobalInfo.s_globalInfo.mainFragActivity.getWindow() .addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
From source file:com.wizardsofm.deskclock.alarms.AlarmActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final long instanceId = AlarmInstance.getId(getIntent().getData()); mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId); if (mAlarmInstance == null) { // The alarm was deleted before the activity got created, so just finish() LOGGER.e("Error displaying alarm for intent: %s", getIntent()); finish();/*from ww w . j a va 2 s . c o m*/ return; } else if (mAlarmInstance.mAlarmState != AlarmInstance.FIRED_STATE) { LOGGER.i("Skip displaying alarm for instance: %s", mAlarmInstance); finish(); return; } LOGGER.i("Displaying alarm for instance: %s", mAlarmInstance); // Get the volume/camera button behavior setting mVolumeBehavior = Utils.getDefaultSharedPreferences(this).getString(SettingsActivity.KEY_VOLUME_BUTTONS, SettingsActivity.DEFAULT_VOLUME_BEHAVIOR); getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED | FLAG_DISMISS_KEYGUARD | FLAG_KEEP_SCREEN_ON | FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON); // Hide navigation bar to minimize accidental tap on Home key hideNavigationBar(); // Close dialogs and window shade, so this is fully visible sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); // Honor rotation on tablets; fix the orientation on phones. if (!getResources().getBoolean(R.bool.config_rotateAlarmAlert)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } mAccessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); setContentView(R.layout.alarm_activity); mAlertView = (ViewGroup) findViewById(R.id.alert); mAlertTitleView = (TextView) mAlertView.findViewById(R.id.alert_title); mAlertInfoView = (TextView) mAlertView.findViewById(R.id.alert_info); mContentView = (ViewGroup) findViewById(R.id.content); mAlarmButton = (ImageView) mContentView.findViewById(R.id.alarm); mSnoozeButton = (ImageView) mContentView.findViewById(R.id.snooze); mDismissButton = (ImageView) mContentView.findViewById(R.id.dismiss); mHintView = (TextView) mContentView.findViewById(R.id.hint); final TextView titleView = (TextView) mContentView.findViewById(R.id.title); final TextClock digitalClock = (TextClock) mContentView.findViewById(R.id.digital_clock); final CircleView pulseView = (CircleView) mContentView.findViewById(R.id.pulse); // PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); // PowerManager.WakeLock wakeLock = pm.newWakeLock((PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "TAG"); // wakeLock.acquire(); // // // // KeyguardManager keyguardManager = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE); // KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("TAG"); // keyguardLock.disableKeyguard(); titleView.setText(mAlarmInstance.getLabelOrDefault(this)); Utils.setTimeFormat(digitalClock); mCurrentHourColor = UiDataModel.getUiDataModel().getWindowBackgroundColor(); getWindow().setBackgroundDrawable(new ColorDrawable(mCurrentHourColor)); mAlarmButton.setOnTouchListener(this); mSnoozeButton.setOnClickListener(this); mDismissButton.setOnClickListener(this); mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f); mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE); mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor); mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView, PropertyValuesHolder.ofFloat(CircleView.RADIUS, 0.0f, pulseView.getRadius()), PropertyValuesHolder.ofObject(CircleView.FILL_COLOR, AnimatorUtils.ARGB_EVALUATOR, ColorUtils.setAlphaComponent(pulseView.getFillColor(), 0))); mPulseAnimator.setDuration(PULSE_DURATION_MILLIS); mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR); mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE); mPulseAnimator.start(); if (DataModel.getDataModel().getSnoozeByVoice()) { startListening(); } // if (DataModel.getDataModel().getSnoozeByVoice()) { // thisContext = this; // Thread t1 = new Thread(new Runnable() { // public void run() { // mSpeechRecognizerManager = SpeechRecognizerManager.getInstance(thisContext); //new SpeechRecognizerManager(thisContext); // } // }); // t1.start(); // // } }
From source file:com.android.launcher3.Launcher.java
@Thunk void setOrientation() { if (mRotationEnabled) { unlockScreenOrientation(true);//from ww w .jav a 2 s . c o m } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } }
From source file:com.landenlabs.all_devtool.PackageFragment.java
@Override public void onSelected() { GlobalInfo.s_globalInfo.mainFragActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); // updateList(); // m_listView.invalidateViews(); }
From source file:com.google.appinventor.components.runtime.Form.java
/** * The requested screen orientation. Commonly used values are unspecified (-1), landscape (0), portrait (1), sensor (4), and user (2). " + "See the Android developer documentation for ActivityInfo.Screen_Orientation for the " + "complete list of possible settings. * * ScreenOrientation property getter method. * * @return screen orientation/* w w w . j a v a2 s. co m*/ */ @SimpleProperty(category = PropertyCategory.APPEARANCE, description = "The requested screen orientation, specified as a text value. " + "Commonly used values are " + "landscape, portrait, sensor, user and unspecified. " + "See the Android developer documentation for ActivityInfo.Screen_Orientation for the " + "complete list of possible settings.") public String ScreenOrientation() { switch (getRequestedOrientation()) { case ActivityInfo.SCREEN_ORIENTATION_BEHIND: return "behind"; case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: return "landscape"; case ActivityInfo.SCREEN_ORIENTATION_NOSENSOR: return "nosensor"; case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: return "portrait"; case ActivityInfo.SCREEN_ORIENTATION_SENSOR: return "sensor"; case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED: return "unspecified"; case ActivityInfo.SCREEN_ORIENTATION_USER: return "user"; case 10: // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR return "fullSensor"; case 8: // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE return "reverseLandscape"; case 9: // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT return "reversePortrait"; case 6: // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE return "sensorLandscape"; case 7: // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT return "sensorPortrait"; } return "unspecified"; }
From source file:com.google.appinventor.components.runtime.Form.java
/** * ScreenOrientation property setter method: sets the screen orientation for * the form.//from w ww. j av a2 s. c o m * * @param screenOrientation the screen orientation as a string */ @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_SCREEN_ORIENTATION, defaultValue = "unspecified") @SimpleProperty(category = PropertyCategory.APPEARANCE) public void ScreenOrientation(String screenOrientation) { if (screenOrientation.equalsIgnoreCase("behind")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND); } else if (screenOrientation.equalsIgnoreCase("landscape")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (screenOrientation.equalsIgnoreCase("nosensor")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } else if (screenOrientation.equalsIgnoreCase("portrait")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (screenOrientation.equalsIgnoreCase("sensor")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } else if (screenOrientation.equalsIgnoreCase("unspecified")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (screenOrientation.equalsIgnoreCase("user")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); } else if (SdkLevel.getLevel() >= SdkLevel.LEVEL_GINGERBREAD) { if (screenOrientation.equalsIgnoreCase("fullSensor")) { setRequestedOrientation(10); // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR } else if (screenOrientation.equalsIgnoreCase("reverseLandscape")) { setRequestedOrientation(8); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE } else if (screenOrientation.equalsIgnoreCase("reversePortrait")) { setRequestedOrientation(9); // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT } else if (screenOrientation.equalsIgnoreCase("sensorLandscape")) { setRequestedOrientation(6); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE } else if (screenOrientation.equalsIgnoreCase("sensorPortrait")) { setRequestedOrientation(7); // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT } else { dispatchErrorOccurredEvent(this, "ScreenOrientation", ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION, screenOrientation); } } else { dispatchErrorOccurredEvent(this, "ScreenOrientation", ErrorMessages.ERROR_INVALID_SCREEN_ORIENTATION, screenOrientation); } }
From source file:com.cognizant.trumobi.PersonaLauncher.java
private void changeOrientation(int type, boolean persistence) { if (!persistence) { switch (type) { case PersonaAlmostNexusSettingsHelper.ORIENTATION_SENSOR: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); break; case PersonaAlmostNexusSettingsHelper.ORIENTATION_PORTRAIT: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); break; case PersonaAlmostNexusSettingsHelper.ORIENTATION_LANDSCAPE: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; default:// w ww .j av a2 s . co m break; } } else { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }