List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR_PORTRAIT
int SCREEN_ORIENTATION_SENSOR_PORTRAIT
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR_PORTRAIT.
Click Source Link
sensorPortrait
in the android.R.attr#screenOrientation attribute. From source file:zxing.util.CaptureActivity.java
License:asdf
private int getCurrentOrientation() { int rotation = getWindowManager().getDefaultDisplay().getRotation(); switch (rotation) { case Surface.ROTATION_0: return ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; case Surface.ROTATION_90: return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; default:/* w ww .j a v a 2 s. co m*/ return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; } }
From source file:com.klinker.android.twitter.activities.compose.Compose.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); countHandler = new Handler(); settings = AppSettings.getInstance(this); context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0); try {// w ww . j a v a 2 s. c o m ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } currentAccount = sharedPrefs.getInt("current_account", 1); buildGoogleApiClient(); Utils.setUpPopupTheme(context, settings); setUpWindow(); setUpLayout(); setUpActionBar(); setUpReplyText(); if (reply.getText().toString().contains(" RT @") || reply.getText().toString().contains("/status/")) { reply.setSelection(0); } if (getIntent().getBooleanExtra("start_attach", false)) { attachButton.performClick(); //overflow.performClick(); } if (notiId != 0) { HoloTextView replyTo = (HoloTextView) findViewById(R.id.reply_to); replyTo.setText(replyText); TextUtils.linkifyText(context, replyTo, null, true, "", true); replyTo.setVisibility(View.VISIBLE); } new Handler().postDelayed(new Runnable() { @Override public void run() { String text = reply.getText().toString(); try { if (!android.text.TextUtils.isEmpty(text) && !(text.startsWith(" RT @") || text.contains("/status/"))) { //text = text.replaceAll(" ", " "); reply.setText(text); reply.setSelection(text.length()); if (!text.endsWith(" ")) { reply.append(" "); } } } catch (Exception e) { } } }, 250); }
From source file:com.klinker.android.twitter.ui.compose.Compose.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); countHandler = new Handler(); settings = AppSettings.getInstance(this); context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); try {/* w w w.ja va2 s. co m*/ ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } currentAccount = sharedPrefs.getInt("current_account", 1); mLocationClient = new LocationClient(context, this, this); mLocationClient.connect(); Utils.setUpPopupTheme(context, settings); setUpWindow(); setUpLayout(); setUpActionBar(); setUpReplyText(); if (reply.getText().toString().contains(" RT @")) { reply.setSelection(0); } //Utils.setActionBar(context, false); if (getIntent().getBooleanExtra("start_attach", false)) { attachButton.performClick(); //overflow.performClick(); } if (notiId != 0) { HoloTextView replyTo = (HoloTextView) findViewById(R.id.reply_to); replyTo.setText(replyText); TextUtils.linkifyText(context, replyTo, null, true, "", true); replyTo.setVisibility(View.VISIBLE); } new Handler().postDelayed(new Runnable() { @Override public void run() { String text = reply.getText().toString(); try { if (!android.text.TextUtils.isEmpty(text) && !text.startsWith(" RT @")) { //text = text.replaceAll(" ", " "); reply.setText(text); reply.setSelection(text.length()); if (!text.endsWith(" ")) { reply.append(" "); } } } catch (Exception e) { } } }, 250); }
From source file:com.daiv.android.twitter.ui.compose.Compose.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); countHandler = new Handler(); settings = AppSettings.getInstance(this); context = this; sharedPrefs = context.getSharedPreferences("com.daiv.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); try {//from w ww . j a v a2 s .co m ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } currentAccount = sharedPrefs.getInt("current_account", 1); buildGoogleApiClient(); Utils.setUpPopupTheme(context, settings); setUpWindow(); setUpLayout(); setUpActionBar(); setUpReplyText(); if (reply.getText().toString().contains(" RT @") || reply.getText().toString().contains("/status/")) { reply.setSelection(0); } if (getIntent().getBooleanExtra("start_attach", false)) { attachButton.performClick(); //overflow.performClick(); } if (notiId != 0) { HoloTextView replyTo = (HoloTextView) findViewById(R.id.reply_to); replyTo.setText(replyText); TextUtils.linkifyText(context, replyTo, null, true, "", true); replyTo.setVisibility(View.VISIBLE); } new Handler().postDelayed(new Runnable() { @Override public void run() { String text = reply.getText().toString(); try { if (!android.text.TextUtils.isEmpty(text) && !(text.startsWith(" RT @") || text.contains("/status/"))) { //text = text.replaceAll(" ", " "); reply.setText(text); reply.setSelection(text.length()); if (!text.endsWith(" ")) { reply.append(" "); } } } catch (Exception e) { } } }, 250); }
From source file:com.github.guwenk.smuradio.SignInDialog.java
private void uploadFile() { if (filepath != null) { Log.d(AuthTag, "UPLOAD FILE " + filepath); final ProgressDialog progressDialog = new ProgressDialog(getActivity()); progressDialog.setTitle(getString(R.string.uploading)); progressDialog.setCancelable(false); progressDialog.show();/* w ww .j a va2 s . com*/ int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } Log.d(AuthTag, "UPLOAD FILE progress dialog showing"); StorageReference musicRef = mStorageRef.child("audio/" + songTitle); Log.d(AuthTag, "UPLOAD FILE storage referense: " + musicRef); try { user = mAuth.getCurrentUser(); } catch (Exception ignored) { } StorageMetadata metadata = new StorageMetadata.Builder().setCustomMetadata("By", user.getUid()).build(); musicRef.putFile(filepath, metadata) .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { // if upload success progressDialog.dismiss(); Toast.makeText(getActivity(), R.string.file_uploaded, Toast.LENGTH_SHORT).show(); alert.dismiss(); Log.d(AuthTag, "UPLOAD FILE success"); getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // if upload failed progressDialog.dismiss(); Toast.makeText(getActivity(), getString(R.string.uploading_error) + exception.getMessage(), Toast.LENGTH_SHORT).show(); alert.dismiss(); Log.d(AuthTag, "UPLOAD FILE FAILED"); getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(UploadTask.TaskSnapshot taskSnapshot) { double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount(); try { progressDialog.setMessage((int) progress + getString(R.string.uploaded_procents)); Log.d(AuthTag, "UPLOAD FILE progress update: " + progress); } catch (Exception e) { e.printStackTrace(); } } }); } else { Toast.makeText(getActivity(), R.string.wrong_file, Toast.LENGTH_SHORT).show(); } }
From source file:hyplink.net.pot.GameActivity.java
@TargetApi(Build.VERSION_CODES.GINGERBREAD) private void toogleOrientation() { int orientation = getRequestedOrientation(); switch (orientation) { case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; break;/*from w ww . j a v a2 s . c o m*/ case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE: orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; break; case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT: orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; break; default: orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; break; } gamePreferences.saveOrientationSetting(orientation); setRequestedOrientation(orientation); }
From source file:com.tweetlanes.android.core.view.TweetFeedFragment.java
private void lockScreenRotation() { if (getActivity() != null) { switch (getActivity().getResources().getConfiguration().orientation) { case Configuration.ORIENTATION_PORTRAIT: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); break; case Configuration.ORIENTATION_LANDSCAPE: getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); break; }//from w w w. j a v a2 s .c om } }
From source file:com.mschlauch.comfortreader.FullscreenActivity.java
public void retreiveSavedOptions() { switchofallmenus = true;//from ww w.j a va 2 s . c o m spinner.setVisibility(View.VISIBLE); String eins = ""; new AsyncTask<String, Void, String>() { @Override protected String doInBackground(String... urlStr) { // do stuff on non-UI thread settingsload.reloadSelectedBook(); wordsperminute = settingsload.getWordsPerMinute(); segmenterObject.minblocksize = settingsload.getMinBlockSize(); segmenterObject.maxblocksize = settingsload.getMaxBlockSize(); segmenterObject.textcolor = settingsload.getTextColor(); segmenterObject.emphasiscolor = settingsload.getFocusColor(); segmenterObject.backgroundcolor = settingsload.getBackgroundColor(); segmenterObject.maxcharactersperline = settingsload.getMaxBlockSize(); segmenterObject.loadPreviewcolorString(); int actual = settingsload.getGlobalPosition(); segmenterObject.globalposition = actual; segmenterObject.globalpositionbefore = actual; //Load Content String text = settingsload.getTexttoRead() + ""; String textdefault = getString(R.string.support_standarttext); Log.i("fullscreen", "text is: " + text); segmenterObject.loadTexttoRead(textdefault); if (text.equals("standarttext")) { segmenterObject.loadTexttoRead(textdefault); segmenterObject.globalposition = 0; segmenterObject.emphasiscolor = Color.parseColor("#ffee00"); segmenterObject.textcolor = Color.parseColor("#ffffff"); } else { segmenterObject.loadTexttoRead(text); } if (text.length() > 16) { } else { //it is importanted that the default text is already segmentable. } Log.i("fullscreen 2", " real text is: " + segmenterObject.texttoread); segmenterObject.loadallprehtmls(); String out = ""; return out; } @Override protected void onPostExecute(String htmlCode) { // do stuff on UI thread with the html contentView.setTextSize(settingsload.getFontSize()); contentView.setBackgroundColor(settingsload.getBackgroundColor()); String parole = settingsload.getOrientationMode(); Log.i("Fullscreen", "orientation loading" + parole); if (parole.equals("1")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (parole.equals("2")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (parole.equals("0")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } parole = settingsload.getFontName(); Log.i("Fullscreen", "orientation loading" + parole); if (parole.equals("sans")) { contentView.setTypeface(Typeface.SANS_SERIF); } else if (parole.equals("serif")) { contentView.setTypeface(Typeface.SERIF); } else if (parole.equals("mono")) { contentView.setTypeface(Typeface.MONOSPACE); } spinner.setVisibility(View.GONE); switchofallmenus = false; previousButtonClicked(null); nextButtonClicked(null); } }.execute(eins); //Line Spacing... // contentView.setLineSpacing(0,(float) 1.28); //actual = retrieveNumber("maxlinelength"); //settingsload.adjustGlobalPositionToPercentage(settingsload.getGlobalPositionSeekbarValue()); //Log.i("fullscreen", "globalposition:" + actual); // get the seekbar etc right... // startdialog(); }
From source file:it.readbeyond.minstrel.commander.Commander.java
private void orient(final String option, final CallbackContext callbackContext) { try {/* w w w . j a v a 2s . c o m*/ Activity activity = cordova.getActivity(); if (option.equals(ORIENT_OPTION_PORTRAIT)) { // portrait or reverse portrait activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (option.equals(ORIENT_OPTION_LANDSCAPE)) { // landscape or reverse portrait activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (option.equals(ORIENT_OPTION_AUTO)) { // unlock orientation activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else { // default: unlock orientation activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } callbackContext.success(""); } catch (Exception e) { // nop callbackContext.error("Exception " + e); } }
From source file:com.caseystalnaker.android.popinvideodemo.fragments.Camera2VideoFragment.java
private void lockOrientation() { Log.d(LOGTAG, "lockOrientation()"); final int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else {/*from ww w . j a v a 2s .c o m*/ getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } }