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:com.near.chimerarevo.fragments.SettingsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); boolean isLandscapeLarge = false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) isLandscapeLarge = true;/*from w w w . j a v a2 s .co m*/ } else isLandscapeLarge = false; if (!isLandscapeLarge) getListView().setPadding(0, getResources().getDimensionPixelSize(R.dimen.actionbar_height), 0, 0); }
From source file:com.inovex.zabbixmobile.activities.ChecksActivity.java
@Override public void onApplicationSelected(int position) { // Selecting an application never makes the item details visible. If // item details are already visible, we select the first item of the // chosen application. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && mItemDetailsFragment.isVisible()) { mItemDetailsFragment.setItem(null); mApplicationsFragment.selectItem(0); }/*from w ww .j a v a 2 s.co m*/ }
From source file:com.klinker.android.twitter.activities.tweet_viewer.TweetPager.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down); try {/*from w w w . j a v a 2s . co m*/ getWindow().requestFeature(Window.FEATURE_PROGRESS); } catch (Exception e) { } context = this; settings = AppSettings.getInstance(this); try { 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 } getFromIntent(); mSectionsPagerAdapter = new TweetPagerAdapter(getFragmentManager(), context, name, screenName, tweet, time, retweeter, webpage, proPic, tweetId, picture, users, hashtags, otherLinks, isMyTweet, isMyRetweet, secondAcc, animatedGif); // methods for advancing windowed boolean settingsVal = settings.advanceWindowed; boolean fromWidget = getIntent().getBooleanExtra("from_widget", false); final boolean youtube; youtube = mSectionsPagerAdapter.getHasYoutube() || mSectionsPagerAdapter.getHasGif() || mSectionsPagerAdapter.hasVine(); if (fromWidget || settingsVal) { setUpWindow(youtube); } setUpTheme(); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } if (getIntent().getBooleanExtra("clicked_youtube", false)) { IntentFilter i = new IntentFilter("com.klinker.android.twitter.YOUTUBE_READY"); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { TweetYouTubeFragment.resume(); context.unregisterReceiver(this); } }, i); } setContentView(R.layout.tweet_pager); pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(mSectionsPagerAdapter); pager.setOffscreenPageLimit(5); final int numberOfPages = mSectionsPagerAdapter.getCount(); pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) { } @Override public void onPageSelected(int i) { if (youtube) { try { switch (numberOfPages) { case 3: case 4: if (i != 0) { TweetYouTubeFragment.pause(); } else { TweetYouTubeFragment.resume(); } break; case 5: if (i != 1) { TweetYouTubeFragment.pause(); } else { TweetYouTubeFragment.resume(); } break; } } catch (Exception e) { } } } @Override public void onPageScrollStateChanged(int i) { } }); switch (numberOfPages) { case 2: if (settings.pageToOpen == AppSettings.PAGE_CONVO) { pager.setCurrentItem(1); } else { pager.setCurrentItem(0); } break; case 3: if (mSectionsPagerAdapter.getHasWebpage()) { switch (settings.pageToOpen) { case AppSettings.PAGE_CONVO: pager.setCurrentItem(2); break; case AppSettings.PAGE_WEB: pager.setCurrentItem(0); break; default: pager.setCurrentItem(1); break; } } else { // no web page switch (settings.pageToOpen) { case AppSettings.PAGE_CONVO: pager.setCurrentItem(2); break; default: pager.setCurrentItem(1); break; } } break; case 4: // webpage and youtube switch (settings.pageToOpen) { case AppSettings.PAGE_CONVO: pager.setCurrentItem(3); break; case AppSettings.PAGE_WEB: pager.setCurrentItem(1); break; default: pager.setCurrentItem(0); break; } break; } if (getIntent().getBooleanExtra("clicked_youtube", false)) { pager.setCurrentItem(0); } if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); if (!settings.showTitleStrip) { strip.setVisibility(View.GONE); } } }
From source file:com.twolinessoftware.smarterlist.fragment.BaseRecyclerViewFragment.java
protected int getSpanCount() { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE || UIUtils.isTablet(getActivity())) return 2; else/* w w w . j ava2s .co m*/ return 1; }
From source file:net.mEmoZz.PopMovies.frags.MoviesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_main, container, false); setHasOptionsMenu(true);// w w w.j a v a 2 s.co m noConn = (ImageView) v.findViewById(R.id.noConn); noConnTxt = (TextView) v.findViewById(R.id.noConnTxt); gridView = (RecyclerView) v.findViewById(R.id.mainGrid); mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.refreshLayout); mRefreshLayout.setColorSchemeColors(0xff6b4d9c); conf = getResources().getConfiguration(); int rotation = getResources().getConfiguration().orientation; LinearLayoutManager tabPort = manager = new GridLayoutManager(getActivity(), 1); LinearLayoutManager tabLand = manager = new GridLayoutManager(getActivity(), 2); LinearLayoutManager mobPort = manager = new GridLayoutManager(getActivity(), 2); LinearLayoutManager mobLand = manager = new GridLayoutManager(getActivity(), 3); if (conf.smallestScreenWidthDp >= 600) { switch (rotation) { case Configuration.ORIENTATION_PORTRAIT: gridView.setLayoutManager(tabPort); loadMore(tabPort); break; case Configuration.ORIENTATION_LANDSCAPE: gridView.setLayoutManager(tabLand); loadMore(tabLand); break; } } else { switch (rotation) { case Configuration.ORIENTATION_PORTRAIT: gridView.setLayoutManager(mobPort); loadMore(mobPort); break; case Configuration.ORIENTATION_LANDSCAPE: gridView.setLayoutManager(mobLand); loadMore(mobLand); break; } } return v; }
From source file:org.openremote.android.console.GroupActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); Log.i("OpenRemote-ORIENTATION", "onCreate:" + display.getOrientation()); if (display != null && display.getOrientation() == 1) { isLandscape = true;/* w w w. j av a 2 s .com*/ lastConfigurationOrientation = Configuration.ORIENTATION_LANDSCAPE; } else { isLandscape = false; lastConfigurationOrientation = Configuration.ORIENTATION_PORTRAIT; } this.gestureScanner = new GestureDetector(this); if (groupViews == null) { groupViews = new HashMap<Integer, GroupView>(); } if (navigationHistory == null) { navigationHistory = new ArrayList<Navigate>(); } recoverLastGroupScreen(); addControllerRefreshEventListener(); initOrientationListener(); }
From source file:dev.ronlemire.commoncontrols.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Test whether if enough display space for 2 panes. Only if tablet and // landscape. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) { // 2 panes - list on left - sample on right setContentView(R.layout.main_land); StartEmptyFragment(); // clear sample pane } else {//from w ww .j a v a 2 s. c om // 1 pane - list and sample will overlay each other setContentView(R.layout.main); } // Save reference to List in order to replace later sampleListView = this.findViewById(R.id.sampleList_replacer); messagesEditText = (EditText) this.findViewById(R.id.etMessages); messagesEditText.setEnabled(false); messagesEditText.setTextColor(Color.parseColor("#000000")); // black // Receiver to catch message sent from List after a sample has been picked sampleListReceiver = new SampleListReceiver(); sampleListFilter = new IntentFilter(ListOfControlsFragment.SAMPLE_LIST_FRAGMENT_BROADCAST_INTENT); // Messages from controls messageFromButtonsReceiver = new MessageFromButtonsReceiver(); messageFromButtonsFilter = new IntentFilter(ButtonsFragment.MESSAGE_FROM_BUTTONS_INTENT); messageFromCheckBoxesReceiver = new MessageFromCheckBoxesReceiver(); messageFromCheckBoxesFilter = new IntentFilter(CheckBoxesFragment.MESSAGE_FROM_CHECKBOXES_INTENT); messageFromDateTimeReceiver = new MessageFromDateTimeReceiver(); messageFromDateTimeFilter = new IntentFilter(DateTimeFragment.MESSAGE_FROM_DATETIME_INTENT); messageFromGalleryReceiver = new MessageFromGalleryReceiver(); messageFromGalleryFilter = new IntentFilter(GalleryFragment.MESSAGE_FROM_GALLERY_INTENT); messageFromGridViewReceiver = new MessageFromGridViewReceiver(); messageFromGridViewFilter = new IntentFilter(GridViewFragment.MESSAGE_FROM_GRIDVIEW_INTENT); messageFromGridViewCustomReceiver = new MessageFromGridViewCustomReceiver(); messageFromGridViewCustomFilter = new IntentFilter( GridViewCustomFragment.MESSAGE_FROM_GRIDVIEWCUSTOM_INTENT); messageFromImageViewReceiver = new MessageFromImageViewReceiver(); messageFromImageViewFilter = new IntentFilter(ImageViewFragment.MESSAGE_FROM_IMAGEVIEW_INTENT); messageFromLayoutFrameReceiver = new MessageFromLayoutFrameReceiver(); messageFromLayoutFrameFilter = new IntentFilter(LayoutFrameFragment.MESSAGE_FROM_LAYOUTFRAME_INTENT); messageFromLayoutRelativeReceiver = new MessageFromLayoutRelativeReceiver(); messageFromLayoutRelativeFilter = new IntentFilter( LayoutRelativeFragment.MESSAGE_FROM_LAYOUTRELATIVE_INTENT); messageFromLayoutTable1Receiver = new MessageFromLayoutTable1Receiver(); messageFromLayoutTable1Filter = new IntentFilter(LayoutTable1Fragment.MESSAGE_FROM_LAYOUTTABLE1_INTENT); messageFromLayoutTable2Receiver = new MessageFromLayoutTable2Receiver(); messageFromLayoutTable2Filter = new IntentFilter(LayoutTable2Fragment.MESSAGE_FROM_LAYOUTTABLE2_INTENT); messageFromLayoutTable3Receiver = new MessageFromLayoutTable3Receiver(); messageFromLayoutTable3Filter = new IntentFilter(LayoutTable3Fragment.MESSAGE_FROM_LAYOUTTABLE3_INTENT); messageFromListView1Receiver = new MessageFromListView1Receiver(); messageFromListView1Filter = new IntentFilter(ListView1Fragment.MESSAGE_FROM_LISTVIEW1_INTENT); messageFromListView2Receiver = new MessageFromListView2Receiver(); messageFromListView2Filter = new IntentFilter(ListView2Fragment.MESSAGE_FROM_LISTVIEW2_INTENT); messageFromListView3Receiver = new MessageFromListView3Receiver(); messageFromListView3Filter = new IntentFilter(ListView3Fragment.MESSAGE_FROM_LISTVIEW3_INTENT); messageFromListView4Receiver = new MessageFromListView4Receiver(); messageFromListView4Filter = new IntentFilter(ListView4Fragment.MESSAGE_FROM_LISTVIEW4_INTENT); messageFromRadioButtonReceiver = new MessageFromRadioButtonReceiver(); messageFromRadioButtonFilter = new IntentFilter(RadioButtonFragment.MESSAGE_FROM_RADIOBUTTON_INTENT); messageFromSpinnerReceiver = new MessageFromSpinnerReceiver(); messageFromSpinnerFilter = new IntentFilter(SpinnerFragment.MESSAGE_FROM_SPINNER_INTENT); messageFromStylesReceiver = new MessageFromStylesReceiver(); messageFromStylesFilter = new IntentFilter(StylesFragment.MESSAGE_FROM_STYLES_INTENT); messageFromTextViewReceiver = new MessageFromTextViewReceiver(); messageFromTextViewFilter = new IntentFilter(TextViewFragment.MESSAGE_FROM_TEXTVIEW_INTENT); messageFromWeightGravityReceiver = new MessageFromWeightGravityReceiver(); messageFromWeightGravityFilter = new IntentFilter(WeightGravityFragment.MESSAGE_FROM_WEIGHTGRAVITY_INTENT); messageFromEditTextReceiver = new MessageFromEditTextReceiver(); messageFromEditTextFilter = new IntentFilter(EditTextFragment.MESSAGE_FROM_EDITTEXT_INTENT); // Fill list pane with sample list StartListofControlsFragment(); }
From source file:com.actionbarsherlock.internal.app.ActionBarHandlerWatson.java
@Override protected void onMenuInflated(Menu menu) { int maxItems = MAX_ACTION_BAR_ITEMS_PORTRAIT; if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { maxItems = MAX_ACTION_BAR_ITEMS_LANDSCAPE; }//from w ww .j a v a2s.c o m //Iterate and grab as many actions as we can up to maxItems honoring //their showAsAction values int ifItems = 0; final int count = menu.size(); List<MenuItemImpl> keep = new ArrayList<MenuItemImpl>(); for (int i = 0; i < count; i++) { MenuItemImpl item = (MenuItemImpl) menu.getItem(i); //Items without an icon or items without a title when the title //is enabled are forced into the normal options menu if (!mIsActionItemTextEnabled && (item.getIcon() == null)) { continue; } else if (mIsActionItemTextEnabled && ((item.getTitle() == null) || item.getTitle().equals(""))) { continue; } if ((item.getShowAsAction() & MenuItem.SHOW_AS_ACTION_ALWAYS) != 0) { //Show always therefore add to keep list keep.add(item); if ((keep.size() > maxItems) && (ifItems > 0)) { //If we have exceeded the max and there are "ifRoom" items //then iterate backwards to remove one and add it to the //head of the classic items list. for (int j = keep.size() - 1; j >= 0; j--) { if ((keep.get(j).getShowAsAction() & MenuItem.SHOW_AS_ACTION_IF_ROOM) != 0) { keep.remove(j); ifItems -= 1; break; } } } } else if (((item.getShowAsAction() & MenuItem.SHOW_AS_ACTION_IF_ROOM) != 0) && (keep.size() < maxItems)) { //"ifRoom" items are added if we have not exceeded the max. keep.add(item); ifItems += 1; } } //Mark items that will be shown on the action bar as such so they do //not show up on the activity options menu mActionBar.removeAllItems(); mActionBar.setIsActionItemTextEnabled(mIsActionItemTextEnabled); for (MenuItemImpl item : keep) { item.setIsShownOnActionBar(true); //Get a new item for this menu item ActionBarWatson.Item watsonItem = mActionBar.newItem(); //Create and initialize a watson itemview wrapper WatsonItemViewWrapper watsonWrapper = new WatsonItemViewWrapper(watsonItem); watsonWrapper.initialize(item, MenuBuilder.TYPE_WATSON); //Associate the itemview with the item so changes will be reflected item.setItemView(MenuBuilder.TYPE_WATSON, watsonWrapper); //Add to the action bar for display mActionBar.addItem(watsonItem); } }
From source file:com.ohso.omgubuntu.BaseFragment.java
public static int getColumnByScreenSize() { int columnNumber = 1; final int sizeMask = OMGUbuntuApplication.getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; final int orientation = OMGUbuntuApplication.getContext().getResources().getConfiguration().orientation; switch (sizeMask) { case (Configuration.SCREENLAYOUT_SIZE_LARGE): if (orientation == Configuration.ORIENTATION_LANDSCAPE) { columnNumber = 2;// w w w. jav a 2s . c o m } break; case (Configuration.SCREENLAYOUT_SIZE_XLARGE): if (orientation == Configuration.ORIENTATION_LANDSCAPE) { columnNumber = 3; } else { columnNumber = 2; } break; } return columnNumber; }
From source file:com.klinker.android.twitter.ui.tweet_viewer.TweetPager.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down); try {/*from w ww. j ava 2 s . c o m*/ getWindow().requestFeature(Window.FEATURE_PROGRESS); } catch (Exception e) { } context = this; settings = AppSettings.getInstance(this); try { 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 } getFromIntent(); // methods for advancing windowed boolean settingsVal = settings.advanceWindowed; boolean fromWidget = getIntent().getBooleanExtra("from_widget", false); final boolean youtube; if (webpage != null && linkString != null) { youtube = webpage.contains("youtu") || linkString.contains("youtu"); } else { youtube = true; } // cases: (youtube will ALWAYS be full screen...) // from widget // the user set the preference to advance windowed // has a webview and want to advance windowed if (fromWidget || settingsVal) { setUpWindow(youtube); } setUpTheme(); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } if (getIntent().getBooleanExtra("clicked_youtube", false)) { IntentFilter i = new IntentFilter("com.klinker.android.twitter.YOUTUBE_READY"); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { TweetYouTubeFragment.resume(); context.unregisterReceiver(this); } }, i); } setContentView(R.layout.tweet_pager); pager = (ViewPager) findViewById(R.id.pager); mSectionsPagerAdapter = new TweetPagerAdapter(getFragmentManager(), context, name, screenName, tweet, time, retweeter, webpage, proPic, tweetId, picture, users, hashtags, otherLinks, isMyTweet, isMyRetweet); pager.setAdapter(mSectionsPagerAdapter); pager.setOffscreenPageLimit(5); final int numberOfPages = mSectionsPagerAdapter.getCount(); pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) { } @Override public void onPageSelected(int i) { if (youtube) { try { switch (numberOfPages) { case 3: case 4: if (i != 0) { TweetYouTubeFragment.pause(); } else { TweetYouTubeFragment.resume(); } break; case 5: if (i != 1) { TweetYouTubeFragment.pause(); } else { TweetYouTubeFragment.resume(); } break; } } catch (Exception e) { } } } @Override public void onPageScrollStateChanged(int i) { } }); switch (numberOfPages) { case 2: if (settings.pageToOpen == AppSettings.PAGE_CONVO) { pager.setCurrentItem(1); } else { pager.setCurrentItem(0); } break; case 3: if (mSectionsPagerAdapter.getHasWebpage()) { switch (settings.pageToOpen) { case AppSettings.PAGE_CONVO: pager.setCurrentItem(2); break; case AppSettings.PAGE_WEB: pager.setCurrentItem(0); break; default: pager.setCurrentItem(1); break; } } else { // no web page switch (settings.pageToOpen) { case AppSettings.PAGE_CONVO: pager.setCurrentItem(2); break; default: pager.setCurrentItem(1); break; } } break; case 4: // webpage and youtube switch (settings.pageToOpen) { case AppSettings.PAGE_CONVO: pager.setCurrentItem(3); break; case AppSettings.PAGE_WEB: pager.setCurrentItem(1); break; default: pager.setCurrentItem(0); break; } break; } if (getIntent().getBooleanExtra("clicked_youtube", false)) { pager.setCurrentItem(0); } if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); if (!settings.showTitleStrip) { strip.setVisibility(View.GONE); } } }