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: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 . jav a2 s .com*/ 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 {//from w ww.j av a 2s .c o m 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:htw.bui.openreskit.meter.SeriesActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mOverlayFramelayout = new FrameLayout(this); setContentView(mOverlayFramelayout); View view = getLayoutInflater().inflate(R.layout.series_fragment, mOverlayFramelayout, false); mOverlayFramelayout.addView(view);/* ww w. j av a 2s . c o m*/ mContext = this; mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false); if (Utils.isTablet(this)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } ActionBar bar = getActionBar(); bar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayShowHomeEnabled(true); EnterValueFragment enterValueFrag = (EnterValueFragment) mFragMan .findFragmentById(R.id.enter_value_fragment); if (enterValueFrag != null) { enterValueFrag.getView().setVisibility(View.INVISIBLE); } }
From source file:cordova.plugins.screenorientation.CDVOrientation.java
private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) { String action = args.optString(0); String orientation = args.optString(1); Log.d(TAG, "Requested ScreenOrientation: " + orientation); Activity activity = cordova.getActivity(); if (orientation.equals(ANY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(LANDSCAPE_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(PORTRAIT_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); }//from w w w . j a v a 2 s . co m callbackContext.success(); return true; }
From source file:net.yoik.cordova.plugins.screenorientation.YoikScreenOrientation.java
private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) { String action = args.optString(0); if (action.equals("set")) { String orientation = args.optString(1); Log.d(TAG, "Requested ScreenOrientation: " + orientation); Activity activity = cordova.getActivity(); if (orientation.equals(UNLOCKED)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else if (orientation.equals(LANDSCAPE_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (orientation.equals(PORTRAIT_PRIMARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (orientation.equals(LANDSCAPE)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (orientation.equals(PORTRAIT)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (orientation.equals(LANDSCAPE_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else if (orientation.equals(PORTRAIT_SECONDARY)) { activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); }/*from ww w . jav a2 s . c o m*/ callbackContext.success(); return true; } else { callbackContext.error("ScreenOrientation not recognised"); return false; } }
From source file:com.klinker.android.twitter.ui.drawer_activities.lists.ChoosenListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else {/*from w w w. j a v a 2s.c o m*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } context = this; sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); settings = AppSettings.getInstance(this); if (settings.advanceWindowed) { setUpWindow(); } Utils.setUpPopupTheme(this, settings); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.lists)); setContentView(R.layout.ptr_list_layout); if (!settings.isTwitterLoggedIn) { Intent login = new Intent(context, LoginActivity.class); startActivity(login); finish(); } mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); spinner = (LinearLayout) findViewById(R.id.list_progress); mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { onRefreshStarted(); } }); if (settings.addonTheme) { mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3); } else { if (settings.theme != AppSettings.THEME_LIGHT) { mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3); } else { mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2)); } } listView = (AsyncListView) findViewById(R.id.listView); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { final int lastItem = firstVisibleItem + visibleItemCount; if (lastItem == totalItemCount && canRefresh) { getLists(); } } }); BitmapLruCache cache = App.getInstance(context).getBitmapCache(); ArrayListLoader loader = new ArrayListLoader(cache, context); ItemManager.Builder builder = new ItemManager.Builder(loader); builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50); builder.setThreadPoolSize(4); listView.setItemManager(builder.build()); listName = getIntent().getStringExtra("list_name"); listId = Integer.parseInt(getIntent().getStringExtra("list_id")); actionBar.setTitle(listName); getLists(); Utils.setActionBar(context); }
From source file:org.xwalk.runtime.extension.api.screenorientation.ScreenOrientationExtension.java
@Override public void onMessage(int instanceId, String message) { String value = getValueString(message, JS_VALUE_TYPE); if (value.isEmpty()) return;/* w w w . j a v a 2s.c o m*/ int orientation; try { orientation = Integer.valueOf(value); } catch (Exception e) { e.printStackTrace(); return; } int screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; switch (orientation) { case ANY: case UA_DEFAULTS: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; break; } case LANDSCAPE_PRIMARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; break; } case PORTRAIT_PRIMARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; break; } case LANDSCAPE_SECONDARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; break; } case PORTRAIT_SECONDARY: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; break; } case LANDSCAPE: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; break; } case PORTRAIT: { screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; break; } default: Log.e(TAG, "Invalid orientation value."); return; } mExtensionContext.getActivity().setRequestedOrientation(screen_orientation_value); }
From source file:com.github.guwenk.smuradio.SignInDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { builder = new AlertDialog.Builder(getActivity()); View signInDialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_sign_in, null); builder.setView(signInDialogView);/*from w ww .j a v a2s .com*/ builder.setMessage(R.string.upload_your_song); checkBox = (CheckBox) signInDialogView.findViewById(R.id.checkBox2); 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); } check1 = false; check2 = false; check3 = false; // Log.d(AuthTag, "onCreateDialog " + check1 + " " + check2 + " " + check3); this.mGoogleApiClient = OrderActivity.getmGoogleApiClient(); mAuth = FirebaseAuth.getInstance(); selectFileButton = (Button) signInDialogView.findViewById(R.id.selectFileButton); selectFileButton.setOnClickListener(new customButtonClickListener()); signInButton = (SignInButton) signInDialogView.findViewById(R.id.sign_in_button); signInButton.setStyle(SignInButton.SIZE_WIDE, SignInButton.COLOR_AUTO); signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { signIn(); } }); builder.setPositiveButton(getString(R.string.next), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO upload song } }); builder.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); SpannableString ss = new SpannableString(getString(R.string.you_accepting_license_agreement)); ClickableSpan clickableSpan = new ClickableSpan() { @Override public void onClick(View textView) { Log.d(AuthTag, "click"); LicenseDialog licenseDialog = new LicenseDialog(); licenseDialog.show(getFragmentManager(), "Sing in dialog"); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(true); } }; ss.setSpan(clickableSpan, 14, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); TextView textView = (TextView) signInDialogView.findViewById(R.id.textView); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setHighlightColor(Color.TRANSPARENT); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { check2 = isChecked; Log.d(AuthTag, "Checked: " + isChecked); buttonStatus(); } }); mStorageRef = FirebaseStorage.getInstance().getReference(); alert = builder.create(); return alert; }
From source file:de.limexcomputer.cordova.plugin.rotationlock.RotationLock.java
/** * Executes the request./*w w w .j a v a2s . co m*/ * * 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:com.skubit.android.SkubitAndroidActivity.java
private void lockOrientation() { Log.d(TAG, "Lock Orientation"); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else {/*from w w w.j av a 2s. co m*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } }