List of usage examples for android.content.res Configuration ORIENTATION_PORTRAIT
int ORIENTATION_PORTRAIT
To view the source code for android.content.res Configuration ORIENTATION_PORTRAIT.
Click Source Link
From source file:com.github.akinaru.hcidebugger.activity.HciDebuggerActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean ret = super.onPrepareOptionsMenu(menu); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { toolbar.getMenu().findItem(R.id.scan_btn).setVisible(false); toolbar.getMenu().findItem(R.id.state_bt_btn).setVisible(false); toolbar.getMenu().findItem(R.id.reset_snoop_file).setVisible(false); nvDrawer.getMenu().findItem(R.id.scan_btn_nv).setVisible(true); if (mScanType == ScanType.CLASSIC_SCAN) { nvDrawer.getMenu().findItem(R.id.change_settings) .setTitle(getString(R.string.scan_settings_type_classic_scan)); } else {/*from w w w . ja v a2 s . com*/ nvDrawer.getMenu().findItem(R.id.change_settings) .setTitle(getString(R.string.scan_settings_type_ble_scan)); } if (Build.VERSION.SDK_INT <= 22) { nvDrawer.getMenu().findItem(R.id.reset_snoop_file_nv).setVisible(true); } MenuItem stateBtn = nvDrawer.getMenu().findItem(R.id.state_bt_btn_nv); stateBtn.setVisible(true); if (mBluetoothAdapter.isEnabled()) { stateBtn.setIcon(R.drawable.ic_bluetooth); } else { stateBtn.setIcon(R.drawable.ic_bluetooth_disabled); } stateBtn.setTitle(getResources().getString(R.string.menu_item_title_enable_bluetooth_portrait)); } return ret; }
From source file:com.luanthanhthai.android.liteworkouttimer.TimerFragment.java
/** * Property Animation//from w w w . j a v a2 s. co m * Animation for timer text slide to center */ public void animSlideClockToCenter() { timerClockView.animate().setDuration(animTimerDuration); if (getOrientation() == Configuration.ORIENTATION_PORTRAIT) { timerClockView.animate().y(yCenterValue); } else { ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(timerClockView, "scaleY", 1.5f); ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(timerClockView, "scaleX", 1.5f); scaleUpY.setDuration(animTimerDuration); scaleUpX.setDuration(animTimerDuration); AnimatorSet scaleUp = new AnimatorSet(); scaleUp.play(scaleUpX).with(scaleUpY); timerClockView.animate().y(yCenterValue); scaleUp.start(); } }
From source file:de.tlabs.ssr.g1.client.SourcesView.java
@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (lastTouchSoundSource == null) { if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) { translateView(velocityX * 0.3f, velocityY * 0.3f); } else if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { translateView(velocityY * 0.3f, -velocityX * 0.3f); }// w w w . ja v a 2 s. com } else { // no flinging for sound sources } return true; }
From source file:demo.camera.library.ui.CameraCaptureActivity.java
private void onResumeCameraSetup() { String previewFacts = mCameraManager.openCamera(mSessionConfig.getVideoResolutionWidth(), mSessionConfig.getVideoResolutionHeight()); // updates mCameraPreviewWidth/Height TextView text = (TextView) findViewById(R.id.cameraParams_text); text.setText(previewFacts);//w w w. java 2 s. co m // Set the preview aspect ratio. AspectFrameLayout layout = (AspectFrameLayout) findViewById(R.id.cameraPreview_afl); int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { mCameraManager.getCamera().setDisplayOrientation(90); mCurrentAspectRatio = (double) mCameraManager.getCameraPreviewHeight() / mCameraManager.getCameraPreviewWidth(); layout.setAspectRatio(mCurrentAspectRatio); } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) { mCameraManager.getCamera().setDisplayOrientation(0); mCurrentAspectRatio = (double) mCameraManager.getCameraPreviewWidth() / mCameraManager.getCameraPreviewHeight(); layout.setAspectRatio(mCurrentAspectRatio); } mGLView.onResume(); mGLView.queueEvent(new Runnable() { @Override public void run() { mRenderer.setCameraPreviewSize(mCameraManager.getCameraPreviewWidth(), mCameraManager.getCameraPreviewHeight()); } }); Log.d(TAG, "onResume complete: " + this); }
From source file:jupiter.broadcasting.live.holo.JBPlayer.java
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { spinner.setVisibility(View.VISIBLE); if ((!offline || !hasit) && (!live)) down.setVisibility(View.VISIBLE); play.setVisibility(View.VISIBLE); tw.setVisibility(View.VISIBLE); showSystemUI();/*from w w w . j ava 2 s . com*/ getSupportActionBar().show(); } else { if (start && av == 1) { spinner.setVisibility(View.GONE); down.setVisibility(View.GONE); play.setVisibility(View.GONE); tw.setVisibility(View.GONE); hideSystemUI(); getSupportActionBar().hide(); } } }
From source file:com.android.purenexussettings.TinkerActivity.java
public static void lockCurrentOrientation(Activity activity) { int currentRotation = activity.getWindowManager().getDefaultDisplay().getRotation(); int orientation = activity.getResources().getConfiguration().orientation; int frozenRotation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; switch (currentRotation) { case Surface.ROTATION_0: frozenRotation = orientation == Configuration.ORIENTATION_LANDSCAPE ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; break;//from w w w . j a v a 2 s. c om case Surface.ROTATION_90: frozenRotation = orientation == Configuration.ORIENTATION_PORTRAIT ? ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; break; case Surface.ROTATION_180: frozenRotation = orientation == Configuration.ORIENTATION_LANDSCAPE ? ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; break; case Surface.ROTATION_270: frozenRotation = orientation == Configuration.ORIENTATION_PORTRAIT ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; break; } activity.setRequestedOrientation(frozenRotation); }
From source file:com.gelakinetic.mtgfam.fragments.LifeCounterFragment.java
/** * This function adds the player's view to the GridLayout. player.newView() will inflate the view. If the counter * is in commander mode, an onClickListener will be set to display that player's information in * mCommanderPlayerView./*from ww w . j a va2 s. c o m*/ * * @param player The player to be added */ private void addPlayerView(final LcPlayer player) { try { mGridLayout.addView(player.newView(mDisplayMode, mStatDisplaying, mGridLayout, mCommanderPlayerView)); } catch (IllegalArgumentException e) { return; } if (mDisplayMode == DISPLAY_COMMANDER) { player.mCommanderRowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { /* Show this player's info in mCommanderPlayerView */ mCommanderPlayerView.removeAllViews(); mCommanderPlayerView.addView(player.mView); player.setSize(mListSizeWidth, mListSizeHeight, mDisplayMode, getActivity().getResources() .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT); } }); if (mPlayers.size() == 1) { mCommanderPlayerView.addView(mPlayers.get(0).mView); } } /* If the size has already been measured, set the player's size */ if (mListSizeHeight != -1) { player.setSize(mListSizeWidth, mListSizeHeight, mDisplayMode, getActivity().getResources() .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT); } }
From source file:org.wso2.iot.agent.activities.AlreadyRegisteredActivity.java
/** * Display unregistration confirmation dialog. *//*from ww w . j a v a 2 s .co m*/ private void showUnregisterDialog() { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } AlertDialog.Builder alertDialog = CommonDialogUtils.getAlertDialogWithTwoButtonAndTitle(context, null, getResources().getString(R.string.dialog_unregister), getResources().getString(R.string.yes), getResources().getString(R.string.no), dialogClickListener, dialogClickListener); alertDialog.show(); }
From source file:com.luanthanhthai.android.liteworkouttimer.TimerFragment.java
/** * Property Animation/*from w w w. j a v a 2 s . co m*/ * Animation for timer clock slide up to original position */ public void animSlideClockUp() { timerClockView.animate().setDuration(animTimerDuration); if (getOrientation() == Configuration.ORIENTATION_PORTRAIT) { timerClockView.animate().y(yOriginalValue); } else { ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(timerClockView, "scaleY", 1f); ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(timerClockView, "scaleX", 1f); scaleDownY.setDuration(animTimerDuration); scaleDownX.setDuration(animTimerDuration); AnimatorSet scaleDown = new AnimatorSet(); scaleDown.play(scaleDownX).with(scaleDownY); timerClockView.animate().y(yOriginalValue); scaleDown.start(); } }
From source file:cz.metaverse.android.bilingualreader.helper.BookPanelOnTouchListener.java
/** * Called when the user double taps and then swipes his finger away on the second tap. * * Warning: Gets called before the second onDown() call, which resets values used here. * But the subsequent call of this method can repair the damage. *///ww w. j a va 2 s . c o m @Override public boolean onDoubleTapEvent(MotionEvent event) { //Log.v(LOG, "[" + panelPosition + "] onDoubleTapEvent"); //: " + event.toString()); // This cannot be moved to onDoubleTap, because another onDown comes after it that wipes it out. if (!isDoubleTapSwipe) { isDoubleTapSwipe = true; webView.setDoNotScrollThisWebView(true); } /* * Detecting Double tap + swipe up/down was moved directly to onTouch(), * because this method has a limit how many times it gets called after which it isn't called * at all until the user lifts the finger in which case it gets called one last time. * That is not workable for on-the-fly resizing of panels. */ // If the finger has finally risen. if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_UP) { //Log.d(DEBUG_TAG, "onDoubleTapEvent ACTION_UP"); //: " + event.toString()); // If doubleTapSwipe escaped its vertical bounds and up/down sliding begun changing // the relative size of panels on the fly. The user has settled on a relative size he wants, // and our job now is to save this preference into PanelSizeDialog for further use in the dialog. if (doubleTapSwipeEscapedBounds) { // Save the newly set panels weight into preferences so PanelSizeDialog can acess it. SharedPreferences preferences = activity.getPreferences(Context.MODE_PRIVATE); PanelSizeDialog.saveSeekBarValue(preferences, newPanelsWeight); } else { // DoubleTapSwipe never escaped its bounds and therefore // we will evaluate if it constituted a swipe to the side. float absDiffX = Math.abs(doubleTapOriginX - event.getX()); float absDiffY = Math.abs(doubleTapOriginY - event.getY()); // PORTRAIT: If the swipe was over the threshold wide and it was wider than higher. if ((absDiffX > threshold_swipe_left_right_hide_panel_px && absDiffX > absDiffY && doubleTapSwipe_orientation == Configuration.ORIENTATION_PORTRAIT) || // LANDSCAPE: If the swipe was over the threshold high and it was higher than wider. (absDiffY > threshold_swipe_up_or_down_hide_panel_px && absDiffY > absDiffX && doubleTapSwipe_orientation != Configuration.ORIENTATION_PORTRAIT)) { // Hide or reappear panel. panelHolder.hideOrReappearPanel(); } } } return true; }