List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR_LANDSCAPE
int SCREEN_ORIENTATION_SENSOR_LANDSCAPE
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR_LANDSCAPE.
Click Source Link
sensorLandscape
in the android.R.attr#screenOrientation attribute. 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();// ww w. j a v a 2 s . c o m 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;//w w w.j a va 2s. 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. jav a2 s . co m } }
From source file:com.mschlauch.comfortreader.FullscreenActivity.java
public void retreiveSavedOptions() { switchofallmenus = true;/*from w w w . j a v a 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 {//from w w w . j ava 2s .co 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 {// www.j a v a 2s .c o m getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } }
From source file:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java
private void goFullscreen(boolean force) { isFullscreen = true;//from w ww. j a v a2 s . c o m setRequestedOrientation(force ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); VideoController videoControls = (VideoController) findViewById(R.id.controller); if (videoControls != null) { videoControls.setFullscreen(true); } ThumbnailWrapper videoContainer = (ThumbnailWrapper) findViewById(R.id.video_fragment_container); videoContainer.setMaintainAspectRatio(false); if (captionFragment != null) { FragmentTransaction tx = getFragmentManager().beginTransaction(); tx.remove(captionFragment); tx.commit(); } findViewById(R.id.detail_bottom_container).setVisibility(View.GONE); if (isBigScreen) { findViewById(R.id.detail_right_container).setVisibility(View.GONE); findViewById(R.id.detail_center_divider).setVisibility(View.GONE); } setNavVisibility(videoFragment == null || !videoFragment.isPlaying()); getDecorViewTreeObserver().addOnGlobalLayoutListener(layoutFixer); }
From source file:com.jp.miaulavirtual.DisplayMessageActivity.java
@SuppressWarnings("deprecation") public void setRestrictedOrientation() { /* We don't want change screen orientation */ //---get the current display info--- WindowManager wm = getWindowManager(); Display d = wm.getDefaultDisplay();// ww w.ja v a 2 s.co m if (d.getWidth() > d.getHeight()) { //---change to landscape mode--- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { //---change to portrait mode--- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } }
From source file:com.youku.player.base.YoukuBasePlayerActivity.java
public void setPlayerFullScreen(final boolean lockSensor) { if (mediaPlayerDelegate == null) return;/*ww w.j a v a 2 s . c o m*/ if (lockSensor) { if (UIUtils.hasGingerbread() && !PreferenceUtil.getPreferenceBoolean(this, "video_lock", false)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } } mediaPlayerDelegate.onChangeOrient = true; mediaPlayerDelegate.isFullScreen = true; updatePlugin(!mediaPlayerDelegate.isAdvShowFinished() ? PLUGIN_SHOW_AD_PLAY : PLUGIN_SHOW_NOT_SET); mYoukuPlayerView.setFullscreenBack(); // ?fillpearent runOnUiThread(new Runnable() { @Override public void run() { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } }); }