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.gdgdevfest.android.apps.devfestbcn.ui.tablet.MapMultiPaneActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); boolean landscape = (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE); LinearLayout spacerView = (LinearLayout) findViewById(R.id.map_detail_spacer); spacerView.setOrientation(landscape ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); spacerView.setGravity(landscape ? Gravity.END : Gravity.BOTTOM); View popupView = findViewById(R.id.map_detail_popup); LinearLayout.LayoutParams popupLayoutParams = (LinearLayout.LayoutParams) popupView.getLayoutParams(); popupLayoutParams.width = landscape ? 0 : ViewGroup.LayoutParams.MATCH_PARENT; popupLayoutParams.height = landscape ? ViewGroup.LayoutParams.MATCH_PARENT : 0; popupView.setLayoutParams(popupLayoutParams); popupView.requestLayout();//from w w w .jav a 2 s. co m updateMapPadding(); }
From source file:com.cssweb.android.quote.KLine2Activity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD"); mHandlerThread.start();/* www . j ava 2 s . co m*/ mHandler = new MessageHandler(mHandlerThread.getLooper()); this.activityKind = Global.QUOTE_KLINE; Bundle bundle = getIntent().getExtras(); this.exchange = bundle.getString("exchange"); this.stockcode = bundle.getString("stockcode"); this.stockname = bundle.getString("stockname"); CssSystem.exchange = bundle.getString("exchange"); CssSystem.stockcode = bundle.getString("stockcode"); CssSystem.stockname = bundle.getString("stockname"); cssStock = new CssStock(); cssStock.setMarket(this.exchange); cssStock.setStkcode(this.stockcode); cssStock.setStkname(this.stockname); setContentView(R.layout.zr_klineview2); // toolbarname = new String[]{ // Global.TOOLBAR_MENU, Global.TOOLBAR_ZHIBIAO, // Global.TOOLBAR_ZHOUQI, Global.TOOLBAR_F10, // Global.TOOLBAR_ZOOMOUT, Global.TOOLBAR_ZOOMIN }; toolbarname = new String[] { Global.TOOLBAR_MENU, Global.TOOLBAR_FENSHI, Global.TOOLBAR_ZHOUQI, Global.TOOLBAR_ZHIBIAO, Global.TOOLBAR_F10, Global.TOOLBAR_REFRESH }; if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { setToolbarByScreen(2); } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setToolbarByScreen(1); } initTitle(R.drawable.njzq_title_left_back, 0, "K"); setTitleText(stockname + " " + peroidN); initKlineView(); getZhibiao(); getZhouqi(); }
From source file:com.near.chimerarevo.activities.PostContainerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) isLandscapeLarge = true;// ww w .j a v a 2 s . c om } else isLandscapeLarge = false; getToolbar().setNavigationIcon(getResources().getDrawable(R.drawable.ic_action_arrow_back)); getToolbar().setNavigationOnClickListener(this); if (!isLandscapeLarge) { pager = (ViewPager) findViewById(R.id.view_pager); pager.setOnPageChangeListener(this); } mLoading = (ProgressWheel) findViewById(R.id.post_progress); mShadow = findViewById(R.id.drop_shadow); args = getIntent().getExtras(); if (savedInstanceState != null) args = savedInstanceState.getBundle("arguments"); if (args.containsKey(Constants.KEY_DATE)) setToolbarStatusColor(args.getString(Constants.KEY_DATE).split("[\\x7C]")[1].trim()); if (getIntent().getData() != null) { List<String> params = getIntent().getData().getPathSegments(); if (params != null && params.size() > 0) { String ext_url = Constants.SITE_URL; for (String p : params) { ext_url += p + "/"; } if (ext_url.contains("/" + Constants.PRODOTTI + "/")) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(ext_url)); startActivity(i); finish(); } else { if (ext_url.contains("/" + Constants.RECENSIONI + "/")) args.putString(Constants.KEY_TYPE, Constants.RECENSIONI); else if (ext_url.contains("/" + Constants.VIDEO + "/")) args.putString(Constants.KEY_TYPE, Constants.VIDEO); OkHttpUtils.getInstance().newCall( new Request.Builder().url(URLUtils.getPostUrl(ext_url)).tag(ACTIVITY_TAG).build()) .enqueue(new GetPostCallback()); } } } if (args != null) { if (!args.containsKey("isLandscapeLarge")) args.putBoolean("isLandscapeLarge", isLandscapeLarge); if (args.containsKey(Constants.KEY_ID)) { int post_id = args.getInt(Constants.KEY_ID); OkHttpUtils.getInstance() .newCall(new Request.Builder().url(URLUtils.getPostUrl(post_id)).tag(ACTIVITY_TAG).build()) .enqueue(new GetPostCallback()); } else if (args.containsKey(Constants.KEY_URL)) { String post_url = args.getString(Constants.KEY_URL); OkHttpUtils.getInstance() .newCall(new Request.Builder().url(URLUtils.getPostUrl(post_url)).tag(ACTIVITY_TAG).build()) .enqueue(new GetPostCallback()); } } }
From source file:com.jpventura.popularmovies.app.TabPageFragment.java
/** * @return The the span count according the device rotation. *///from ww w . ja va2 s . c om protected int getSpanCount() { int orientation = getResources().getConfiguration().orientation; return Configuration.ORIENTATION_LANDSCAPE == orientation ? SPAN_LANDSCAPE : SPAN_PORTRAIT; }
From source file:com.intel.xdk.accelerometer.Accelerometer.java
public void onSensorChanged(int sensor, float[] values) { if (sensor != SensorManager.SENSOR_ACCELEROMETER || values.length < 3) return;//from w ww .ja v a 2 s. c o m long curTime = System.currentTimeMillis(); if (lastUpdate == -1 || (curTime - lastUpdate) > mTime) { lastUpdate = curTime; //android reports 0-10 - make it 0-1 for consistency with iPhone float x = values[DATA_X] / 10; float y = values[DATA_Y] / 10; float z = values[DATA_Z] / 10; //if in landscape, android swaps x and y axes - swap them back for consistency with iPhone if (activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { float oldx = x, oldy = y; y = oldx * -1; x = oldy; } //wrapped in try/catch to fix errors after closing can roll in appLab String js = "javascript:try{intel.xdk.accelerometer.setAcceleration(new intel.xdk.acceleration.Acceleration(" + x + "," + y + "," + z + ",false));}catch(e){}"; //String js = "javascript:new intel.xdk.acceleration.Acceleration("+x+","+y+","+z+",false);"; //String js = "javascript:console.log('before'); new intel.xdk.acceleration.Acceleration("+x+","+y+","+z+",false);console.log('after'); "; //String js = "javascript:alert('0');"; //would be nice to have a roundtrip feedback loop in order to stop injecting when it is causing errors webView.loadUrl(js); } }
From source file:com.grarak.kerneladiutor.activities.MainActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Don't initialize analytics with debug build if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); }/*from w w w . ja v a2 s. c o m*/ setContentView(R.layout.activity_main); View splashBackground = findViewById(R.id.splash_background); mRootAccess = (TextView) findViewById(R.id.root_access_text); mBusybox = (TextView) findViewById(R.id.busybox_text); mCollectInfo = (TextView) findViewById(R.id.info_collect_text); // Hide huge banner in landscape mode if (Utils.getOrientation(this) == Configuration.ORIENTATION_LANDSCAPE) { splashBackground.setVisibility(View.GONE); } if (savedInstanceState == null) { /** * Launch password activity when one is set, * otherwise run {@link CheckingTask} */ String password; if (!(password = Prefs.getString("password", "", this)).isEmpty()) { Intent intent = new Intent(this, SecurityActivity.class); intent.putExtra(SecurityActivity.PASSWORD_INTENT, password); startActivityForResult(intent, 1); } else { new CheckingTask().execute(); } } }
From source file:com.klinker.android.twitter.activities.search.SearchPager.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); try {// www .j ava2 s.co m 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 } context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0); settings = AppSettings.getInstance(this); try { searchQuery = getIntent().getStringExtra(SearchManager.QUERY); } catch (Exception e) { searchQuery = ""; } if (searchQuery == null) { searchQuery = ""; } handleIntent(getIntent()); if (Build.VERSION.SDK_INT > 18 && settings.uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet))) { translucent = true; getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); try { int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode"); if (immersive == 1) { translucent = false; } } catch (Exception e) { } } else { translucent = false; } Utils.setUpTheme(context, settings); setContentView(R.layout.search_pager); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.search)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); View statusBar = findViewById(R.id.activity_status_bar); mViewPager = (ViewPager) findViewById(R.id.pager); if (translucent) { statusBar.setVisibility(View.VISIBLE); int statusBarHeight = Utils.getStatusBarHeight(context); LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } else { mViewPager.setPadding(0, 0, 0, 0); } mSectionsPagerAdapter = new SearchPagerAdapter(getFragmentManager(), context, onlyStatus, onlyProfile, searchQuery, translucent); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(3); if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); } mViewPager.setCurrentItem(1); Utils.setActionBar(context, true); if (onlyProfile) { mViewPager.setCurrentItem(2); } }
From source file:com.klinker.android.twitter.ui.search.SearchPager.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); try {//from www.j av a 2 s. c o m 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 } context = this; sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); settings = AppSettings.getInstance(this); try { searchQuery = getIntent().getStringExtra(SearchManager.QUERY); } catch (Exception e) { searchQuery = ""; } if (searchQuery == null) { searchQuery = ""; } handleIntent(getIntent()); if (Build.VERSION.SDK_INT > 18 && settings.uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet))) { translucent = true; getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); try { int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode"); if (immersive == 1) { translucent = false; } } catch (Exception e) { } } else { translucent = false; } Utils.setUpTheme(context, settings); setContentView(R.layout.search_pager); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.search)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); View statusBar = findViewById(R.id.activity_status_bar); mViewPager = (ViewPager) findViewById(R.id.pager); if (translucent) { statusBar.setVisibility(View.VISIBLE); int statusBarHeight = Utils.getStatusBarHeight(context); LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } else { mViewPager.setPadding(0, 0, 0, 0); } mSectionsPagerAdapter = new SearchPagerAdapter(getFragmentManager(), context, onlyStatus, onlyProfile, searchQuery, translucent); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(3); if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); } mViewPager.setCurrentItem(1); Utils.setActionBar(context, true); if (onlyProfile) { mViewPager.setCurrentItem(2); } }
From source file:com.owncloud.android.ui.activity.FileDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mFile = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_FILE); mAccount = getIntent().getParcelableExtra(FileDetailFragment.EXTRA_ACCOUNT); mStorageManager = new FileDataStorageManager(mAccount, getContentResolver()); // check if configuration changed to large-land ; for a tablet being changed from portrait to landscape when in FileDetailActivity Configuration conf = getResources().getConfiguration(); mConfigurationChangedToLandscape = (conf.orientation == Configuration.ORIENTATION_LANDSCAPE && (conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE); if (!mConfigurationChangedToLandscape) { setContentView(R.layout.file_activity_details); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); if (savedInstanceState == null) { mWaitingToPreview = false;//from w ww .j ava2s . com createChildFragment(); } else { mWaitingToPreview = savedInstanceState.getBoolean(KEY_WAITING_TO_PREVIEW); } mDownloadConnection = new DetailsServiceConnection(); bindService(new Intent(this, FileDownloader.class), mDownloadConnection, Context.BIND_AUTO_CREATE); mUploadConnection = new DetailsServiceConnection(); bindService(new Intent(this, FileUploader.class), mUploadConnection, Context.BIND_AUTO_CREATE); } else { backToDisplayActivity(false); // the 'back' won't be effective until this.onStart() and this.onResume() are completed; } }
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 {// w w w. ja v a2s . c o m setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } }