List of usage examples for android.content.res Configuration ORIENTATION_LANDSCAPE
int ORIENTATION_LANDSCAPE
To view the source code for android.content.res Configuration ORIENTATION_LANDSCAPE.
Click Source Link
From source file:de.sourcestream.movieDB.controller.GalleryPreviewSlide.java
/** * @param savedInstanceState if the fragment is being re-created from a previous saved state, this is the state. *///from w w w .j a va 2 s.c om @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (activity.getSupportActionBar() != null) activity.getSupportActionBar().hide(); if (Build.VERSION.SDK_INT >= 19) { mUIFlag ^= View.SYSTEM_UI_FLAG_IMMERSIVE; } activity.getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(activity, R.color.black)); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) activity.getWindow().getDecorView().setSystemUiVisibility(mUIFlag); else activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); }
From source file:com.near.chimerarevo.fragments.PostsRecyclerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.posts_list_layout, container, false); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) isLandscapeLarge = true;/*from ww w . ja v a 2 s. c om*/ } else isLandscapeLarge = false; if (!isLandscapeLarge) ((BaseActivity) getActivity()).getToolbar().getBackground().setAlpha(0); mListView = (RecyclerView) v.findViewById(R.id.cardList); mListView.setOverScrollMode(View.OVER_SCROLL_NEVER); mLoadingBar = (ProgressWheel) v.findViewById(R.id.loading_bar); mFab = (FloatingActionButton) v.findViewById(R.id.floating_action); mFab.setEnabled(false); mHeader = v.findViewById(R.id.header); mHeaderText = (TextView) mHeader.findViewById(R.id.header_title); mHeaderImg = (KenBurnsView) mHeader.findViewById(R.id.header_img); mSwipeRefreshLayout = new SwipeRefreshLayout(container.getContext()); mSwipeRefreshLayout.addView(v, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue_light, R.color.red_light, R.color.green_light, R.color.orange_light); return mSwipeRefreshLayout; }
From source file:org.cocos2dx.lib.Cocos2dxAccelerometer.java
@Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER) { return;/*from w ww . jav a 2s . com*/ } float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; /* * Because the axes are not swapped when the device's screen orientation changes. * So we should swap it here. * In tablets such as Motorola Xoom, the default orientation is landscape, so should * consider this. */ int orientation = mContext.getResources().getConfiguration().orientation; if ((orientation == Configuration.ORIENTATION_LANDSCAPE) && (mNaturalOrientation != Surface.ROTATION_0)) { float tmp = x; x = -y; y = tmp; } else if ((orientation == Configuration.ORIENTATION_PORTRAIT) && (mNaturalOrientation != Surface.ROTATION_0)) { float tmp = x; x = y; y = -tmp; } onSensorChanged(x, y, z, event.timestamp); // Log.d(TAG, "x = " + event.values[0] + " y = " + event.values[1] + " z = " + event.values[2]); }
From source file:com.bydavy.card.receipts.activities.ReceiptPagerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_receipt_pager); mLoadingView = findViewById(R.id.loading_container); mContentView = findViewById(R.id.content_container); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mReceiptPagerFragment = (ReceiptPagerFragment) getSupportFragmentManager() .findFragmentById(FRAGMENT_PAGER_FRAGMENT_ID); if (mReceiptPagerFragment == null) { final Bundle bundle = getIntent().getExtras(); if (bundle == null) { LogHelper.e(ErrorID.EXTRA_IS_NULL, "Attempt to open " + ReceiptPagerActivity.class.getName() + " without extras in intent", null);//w w w . ja v a 2 s.c om finish(); return; } // Load data from the intent final int index = bundle.getInt(INTENT_BUNDLE_INDEX); final String selection = bundle.getString(INTENT_BUNDLE_CURSOR_SELECTION); final String[] selectionArgs = bundle.getStringArray(INTENT_BUNDLE_CURSOR_SELECTION_ARGS); final String sortOrder = bundle.getString(INTENT_BUNDLE_CURSOR_SORT_ORDER); // Create the fragment mReceiptPagerFragment = ReceiptPagerFragment.newInstance(index, selection, selectionArgs, sortOrder); // Publish the fragment final FragmentTransaction fm = getSupportFragmentManager().beginTransaction(); fm.add(FRAGMENT_PAGER_FRAGMENT_ID, mReceiptPagerFragment); fm.commit(); } mReceiptPagerFragment.setStateListener(this, true); // If Landscape && screen lize >= Large, finish the activity if ((getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) && AndroidUtils.isScreenSizeBiggerOrEqual(getResources(), Configuration.SCREENLAYOUT_SIZE_LARGE)) { setActivityResult(); finish(); } }
From source file:com.grepsound.activities.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar);/*from w w w . ja v a 2 s. c o m*/ mDarkHoverView = findViewById(R.id.dark_hover_view); mDarkHoverView.setAlpha(0); getFragmentManager().addOnBackStackChangedListener(this); fMenu = new PlayerFragment(); mMainFrag = new MyProfileFragment(); getFragmentManager().beginTransaction().replace(R.id.move_to_back_container, mMainFrag) .replace(R.id.left_drawer, fMenu).commit(); int layoutSizeMask = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; mDrawerIsLocked = (layoutSizeMask == Configuration.SCREENLAYOUT_SIZE_LARGE || layoutSizeMask == Configuration.SCREENLAYOUT_SIZE_XLARGE) && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; setupNavigationDrawer(mDrawerIsLocked); mAccount = CreateSyncAccount(this); ContentResolver.addPeriodicSync(mAccount, AUTHORITY, new Bundle(), SYNC_INTERVAL); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); Log.i(TAG, "wifi only is " + prefs.getBoolean("wifi_only", false)); }
From source file:com.pyamsoft.dontsuckmp.artist.AllArtistListFragment.java
private void setupRecyclerView() { fastAdapter.withSelectable(true);/*from w w w . j a va 2s . com*/ fastAdapter.withOnClickListener((v, adapter, item, position) -> { Album album = item.getModel(); Timber.d("Show album track list focus for: %s", album); DialogUtil.guaranteeSingleDialogFragment(getActivity(), AlbumDialog.newInstance(album), AlbumDialog.TAG); return true; }); binding.artistList.setAdapter(fastAdapter); final int currentOrientation = getActivity().getResources().getConfiguration().orientation; final int columnCount; switch (currentOrientation) { case Configuration.ORIENTATION_PORTRAIT: columnCount = 2; break; case Configuration.ORIENTATION_LANDSCAPE: columnCount = 3; break; default: columnCount = 2; } binding.artistList.setLayoutManager(new GridLayoutManager(getContext(), columnCount)); }
From source file:nf.frex.android.FrexActivity.java
/** * Called when the activity is first created. *//*from w ww .j a va 2s . c o m*/ @Override public void onCreate(Bundle savedInstanceState) { //Log.d(TAG, "onCreate(savedInstanceState=" + savedInstanceState + ")"); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); requestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY); if (PRE_SDK14) { requestWindowFeature(Window.FEATURE_NO_TITLE); // Fix: Frex to stop working on screen orientation changes (Android 2.3.x only) if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } else { getActionBar().setBackgroundDrawable(new PaintDrawable(Color.argb(128, 0, 0, 0))); } view = new FractalView(this); setContentView(view); if (!tryReadingFrexDocIntent(getIntent())) { if (savedInstanceState != null) { view.restoreInstanceState(new BundlePropertySet(savedInstanceState)); } else { PropertySet propertySet = (PropertySet) getLastNonConfigurationInstance(); if (propertySet != null) { view.restoreInstanceState(propertySet); } } } }
From source file:com.mk4droid.IMC_Activities.FActivity_TabHost.java
/** On screen orientation change *//*from www .java 2s .c om*/ @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); onWindowFocusChanged(true); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Log.e("On Config Change", "LANDSCAPE"); } else { Log.e("On Config Change", "PORTRAIT"); } }
From source file:com.shipdream.lib.android.mvc.samples.note.view.fragment.MainFragment.java
private AppController.Orientation convertOrientation(int orientation) { if (orientation == Configuration.ORIENTATION_PORTRAIT) { return AppController.Orientation.PORTRAIT; } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) { return AppController.Orientation.LANDSCAPE; } else {/*from www . j a va2 s .c o m*/ return AppController.Orientation.UNSPECIFIED; } }
From source file:com.near.chimerarevo.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); instanceState = savedInstanceState;// w ww.jav a2s . c o m if (!getSharedPreferences(Constants.PREFS_TAG, Context.MODE_PRIVATE).getBoolean("hasTutorialShown", false)) startActivity(new Intent(this, TutorialActivity.class)); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) isLandscapeLarge = true; } else isLandscapeLarge = false; mDrawerList = (ExpandableListView) findViewById(R.id.left_drawer_list); mFooter = LayoutInflater.from(this).inflate(R.layout.drawer_list_footer, mDrawerList, false); mDrawerList.addFooterView(mFooter); mShadow = findViewById(R.id.drop_shadow); if (!isLandscapeLarge) { mDrawerList.addHeaderView( LayoutInflater.from(this).inflate(R.layout.drawer_list_header, mDrawerList, false), null, false); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); mDrawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.colorPrimaryDark)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) SysUtils.setTopStatusMargin(this, mDrawerLayout); } mDrawerList.setGroupIndicator(null); mDrawerList.setOnGroupClickListener(this); mDrawerList.setOnChildClickListener(this); mDrawerList.setOnGroupExpandListener(this); mMenuAdapter = new MenuAdapter(this); mDrawerList.setAdapter(mMenuAdapter); if (!isLandscapeLarge) { mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, getToolbar(), R.string.drawer_open, R.string.drawer_close); mDrawerLayout.setDrawerListener(mDrawerToggle); } mFooter.findViewById(R.id.unlock_premium_btn).setVisibility(View.GONE); try { mHelper = new IabHelper(this, Constants.LICENSE_KEY); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { isLicensed = result.isSuccess(); if (isLicensed) mHelper.queryInventoryAsync(MainActivity.this); else SysUtils.toggleAppWidgets(MainActivity.this, false); } }); } catch (Exception e) { e.printStackTrace(); } if (savedInstanceState != null) { prevSelection = savedInstanceState.getByte("prevSelection"); mMenuAdapter.toggleSelection(0); if (prevSelection != 2) mMenuAdapter.toggleSelection(prevSelection); selectMenuItem(prevSelection); } else selectMenuItem(0); }