List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE
int SCREEN_ORIENTATION_LANDSCAPE
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.
Click Source Link
landscape
in the android.R.attr#screenOrientation attribute. From source file:com.horaapps.leafpic.PlayerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_share: Intent share = new Intent(Intent.ACTION_SEND); Media m = new Media(ContentHelper.getPath(getApplicationContext(), getIntent().getData())); share.setType(m.getMIME());// w ww. j a v a 2 s .co m share.putExtra(Intent.EXTRA_STREAM, getIntent().getData()); startActivity(Intent.createChooser(share, getString(R.string.send_to))); return true; case R.id.action_settings: startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); return true; case R.id.rotate_layout: int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation(); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); showControls(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:org.ednovo.goorusearchwidget.ResourcePlayer.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); dialog = new ProgressDialog(this); prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setContentViewLayout = new RelativeLayout(ResourcePlayer.this); prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE); token = prefsPrivate.getString("token", ""); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); Bundle extra = getIntent().getExtras(); if (extra != null) { value = extra.getInt("key"); gooruOID1 = extra.getStringArrayList("goor"); searchkeyword = extra.getString("searchkey"); limit = gooruOID1.size();/*w w w. ja v a 2 s. co m*/ gooruOID = gooruOID1.get(value); resourceGooruId = gooruOID; if (!gooruOID.isEmpty() || !gooruOID.equalsIgnoreCase("") || gooruOID != null) { if (checkInternetConnection()) { dialog = new ProgressDialog(ResourcePlayer.this); dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getResourcesInfo().execute(); } else { dialog = new ProgressDialog(ResourcePlayer.this); dialog.setTitle("gooru"); dialog.setMessage("No internet connection"); dialog.show(); } } } Editor prefsPrivateEditor = prefsPrivate.edit(); // Authentication details prefsPrivateEditor.putString("searchkeyword", searchkeyword); prefsPrivateEditor.commit(); wvPlayer = new WebView(ResourcePlayer.this); wvPlayer.resumeTimers(); wvPlayer.getSettings().setJavaScriptEnabled(true); wvPlayer.getSettings().setPluginState(PluginState.ON); wvPlayer.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); wvPlayer.setWebViewClient(new HelloWebViewClient()); wvPlayer.setWebChromeClient(new MyWebChromeClient() { }); wvPlayer.getSettings().setPluginsEnabled(true); new getResourcesInfo().execute(); RelativeLayout temp = new RelativeLayout(ResourcePlayer.this); temp.setId(668); temp.setBackgroundColor(getResources().getColor(android.R.color.transparent)); header = new RelativeLayout(ResourcePlayer.this); header.setId(1); header.setBackgroundDrawable(getResources().getDrawable(R.drawable.navbar)); RelativeLayout.LayoutParams headerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, 53); headerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); headerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, -1); ivCloseIcon = new ImageView(ResourcePlayer.this); ivCloseIcon.setId(130); ivCloseIcon.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivCloseIconIconParams = new RelativeLayout.LayoutParams(50, 50); ivCloseIconIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivCloseIconIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1); ivCloseIcon.setPadding(0, 0, 0, 0); ivCloseIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); ivCloseIcon.setBackgroundDrawable(getResources().getDrawable(R.drawable.close_corner)); header.addView(ivCloseIcon, ivCloseIconIconParams); ivmoveforward = new ImageView(ResourcePlayer.this); ivmoveforward.setId(222); if (value == limit - 1) { ivmoveforward.setVisibility(View.GONE); } ivmoveforward.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivmoveforwardIconIconParams = new RelativeLayout.LayoutParams(21, 38); ivmoveforwardIconIconParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, -1); ivmoveforwardIconIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivmoveforwardIconIconParams.setMargins(0, 0, 30, 0); imageshare = new ImageView(ResourcePlayer.this); imageshare.setId(440); imageshare.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams imageshareIconParams = new RelativeLayout.LayoutParams(50, 50); imageshareIconParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, -1); imageshareIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); imageshareIconParams.setMargins(0, 10, 100, 0); tvDescriptionn = new TextView(ResourcePlayer.this); tvDescriptionn1 = new TextView(ResourcePlayer.this); edittext_copyurl = new EditText(ResourcePlayer.this); imageshare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (desc == 0) { new getShortUrl().execute(); imageshare.setBackgroundDrawable(getResources().getDrawable(R.drawable.share_selected)); subheader.setVisibility(View.VISIBLE); subheader.removeAllViews(); tvDescriptionn.setVisibility(View.VISIBLE); tvDescriptionn1.setVisibility(View.VISIBLE); edittext_copyurl.setVisibility(View.VISIBLE); tvDescriptionn.setText("Share this with other by copying and pasting these links"); tvDescriptionn.setId(221); tvDescriptionn.setTextSize(18); tvDescriptionn.setTypeface(null, Typeface.BOLD); tvDescriptionn.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams.setMargins(20, 10, 0, 20); subheader.addView(tvDescriptionn, tvDescriptionParams); tvDescriptionn1.setText("Collections"); tvDescriptionn1.setId(226); tvDescriptionn1.setTextSize(18); tvDescriptionn1.setTypeface(null, Typeface.BOLD); tvDescriptionn1.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams1 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams1.setMargins(20, 42, 0, 20); subheader.addView(tvDescriptionn1, tvDescriptionParams1); edittext_copyurl.setId(266); edittext_copyurl.setTextSize(18); edittext_copyurl.setTypeface(null, Typeface.BOLD); edittext_copyurl.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams11 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams11.setMargins(130, 35, 0, 20); subheader.addView(edittext_copyurl, tvDescriptionParams11); desc = 1; flag = 0; } else { imageshare.setBackgroundDrawable(getResources().getDrawable(R.drawable.share_normal)); subheader.removeAllViews(); subheader.setVisibility(View.GONE); desc = 0; } } }); imageshare.setBackgroundDrawable(getResources().getDrawable(R.drawable.share_normal)); ivmoveforward.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (value < limit - 1) { Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); // extras.putString("gooruOId",s); extras.putStringArrayList("goor", gooruOID1); value++; extras.putInt("key", value); intentResPlayer.putExtras(extras); urlcheck = 0; finish(); startActivity(intentResPlayer); } } }); ivmoveforward.setBackgroundDrawable(getResources().getDrawable(R.drawable.arrowright)); ivmoveback = new ImageView(ResourcePlayer.this); ivmoveback.setId(220); if (value == 0) { ivmoveback.setVisibility(View.GONE); } ivmoveback.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivmovebackIconIconParams = new RelativeLayout.LayoutParams(21, 38); ivmovebackIconIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); ivmovebackIconIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivmovebackIconIconParams.setMargins(55, 0, 0, 0); ivmoveback.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!(value <= 0)) { value--; Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putStringArrayList("goor", gooruOID1); extras.putInt("key", value); intentResPlayer.putExtras(extras); urlcheck = 0; finish(); startActivity(intentResPlayer); } } }); ivmoveback.setBackgroundDrawable(getResources().getDrawable(R.drawable.left)); webViewBack = new ImageView(ResourcePlayer.this); webViewBack.setId(323); webViewBack.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewBackIconParams = new RelativeLayout.LayoutParams(25, 26); webViewBackIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); webViewBackIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewBackIconParams.setMargins(175, 0, 0, 0); webViewBack.setBackgroundDrawable(getResources().getDrawable(R.drawable.arrow_leftactive)); webViewBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (wvPlayer.canGoBack()) { wvPlayer.goBack(); } } }); webViewRefresh = new ImageView(ResourcePlayer.this); webViewRefresh.setId(322); webViewRefresh.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewRefreshIconParams = new RelativeLayout.LayoutParams(30, 30); webViewRefreshIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); webViewRefreshIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewRefreshIconParams.setMargins(305, 0, 0, 0); webViewRefresh.setBackgroundDrawable(getResources().getDrawable(R.drawable.refresh)); webViewRefresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { wvPlayer.reload(); } }); webViewForward = new ImageView(ResourcePlayer.this); webViewForward.setId(321); webViewForward.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewForwardIconParams = new RelativeLayout.LayoutParams(25, 26); webViewForwardIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); webViewForwardIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewForwardIconParams.setMargins(245, 0, 0, 0); webViewForward.setBackgroundDrawable(getResources().getDrawable(R.drawable.arrow_rightactive)); webViewForward.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (wvPlayer.canGoForward()) { wvPlayer.goForward(); } } }); ivResourceIcon = new ImageView(ResourcePlayer.this); ivResourceIcon.setId(30); ivResourceIcon.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivResourceIconParams = new RelativeLayout.LayoutParams(50, 25); ivResourceIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivResourceIconParams.addRule(RelativeLayout.LEFT_OF, 130); ivResourceIcon.setPadding(50, 0, 0, 0); ivResourceIcon.setBackgroundDrawable(getResources().getDrawable(R.drawable.handouts)); header.addView(ivResourceIcon, ivResourceIconParams); tvLearn = new TextView(this); tvLearn.setText("Learn More"); tvLearn.setId(20); tvLearn.setPadding(100, 0, 0, 0); tvLearn.setTextSize(20); tvLearn.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvLearnParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvLearnParams.addRule(RelativeLayout.CENTER_VERTICAL, 1); tvLearnParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1); tvAbout = new ImageView(ResourcePlayer.this); tvAbout.setId(21); tvAbout.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewForwardIconParamsa = new RelativeLayout.LayoutParams(32, 32); webViewForwardIconParamsa.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, -1); webViewForwardIconParamsa.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewForwardIconParamsa.setMargins(0, 0, 200, 0); tvAbout.setBackgroundDrawable(getResources().getDrawable(R.drawable.info)); header.addView(tvAbout, webViewForwardIconParamsa); RelativeLayout fortvtitle = new RelativeLayout(this); RelativeLayout.LayoutParams tvTitleParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvTitleParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); tvTitleParams.addRule(RelativeLayout.CENTER_VERTICAL, 1); tvTitleParams.addRule(RelativeLayout.RIGHT_OF, 322); tvTitleParams.addRule(RelativeLayout.LEFT_OF, 21); header.addView(fortvtitle, tvTitleParams); tvTitle = new TextView(this); tvTitle.setText(""); tvTitle.setId(22); tvTitle.setPadding(0, 0, 0, 0); tvTitle.setTextSize(25); tvTitle.setSingleLine(true); tvTitle.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvTitleParamstv = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvTitleParamstv.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); tvTitleParamstv.addRule(RelativeLayout.CENTER_VERTICAL, 1); fortvtitle.addView(tvTitle, tvTitleParamstv); tvViewsNLikes = new TextView(this); tvViewsNLikes.setText(""); tvViewsNLikes.setId(23); tvViewsNLikes.setPadding(0, 0, 5, 5); tvViewsNLikes.setTextSize(18); tvViewsNLikes.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvViewsNLikesParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvViewsNLikesParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1); tvViewsNLikesParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1); subheader = new RelativeLayout(ResourcePlayer.this); subheader.setId(100); subheader.setVisibility(View.GONE); subheader.setBackgroundDrawable(getResources().getDrawable(R.drawable.navbar)); RelativeLayout.LayoutParams subheaderParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, 100); subheaderParams.addRule(RelativeLayout.BELOW, 1); subheaderParams.addRule(RelativeLayout.CENTER_IN_PARENT, 1); RelativeLayout.LayoutParams wvPlayerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); wvPlayerParams.addRule(RelativeLayout.BELOW, 100); wvPlayerParams.addRule(RelativeLayout.CENTER_IN_PARENT, 100); LinearLayout videoLayout = new LinearLayout(this); videoLayout.setVisibility(View.GONE); header.addView(webViewBack, webViewBackIconParams); header.addView(webViewRefresh, webViewRefreshIconParams); header.addView(webViewForward, webViewForwardIconParams); header.addView(ivmoveforward, ivmoveforwardIconIconParams); header.addView(imageshare, imageshareIconParams); header.addView(ivmoveback, ivmovebackIconIconParams); temp.addView(header, headerParams); temp.addView(subheader, subheaderParams); temp.addView(wvPlayer, wvPlayerParams); temp.addView(videoLayout, wvPlayerParams); setContentViewLayout.addView(temp, layoutParams); setContentView(setContentViewLayout); tvDescription = new TextView(ResourcePlayer.this); tvDescription1 = new TextView(ResourcePlayer.this); tvAbout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (flag == 0) { subheader.setVisibility(View.VISIBLE); subheader.removeAllViews(); // tvDescriptionn.setVisibility(View.INVISIBLE); tvDescription1.setVisibility(View.VISIBLE); tvDescription.setVisibility(View.VISIBLE); tvDescription.setText("Description"); tvDescription.setId(221); tvDescription.setTextSize(18); tvDescription.setTypeface(null, Typeface.BOLD); tvDescription.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams.setMargins(20, 10, 0, 20); tvDescriptionParams.addRule(RelativeLayout.BELOW, 220); tvDescription1.setText(description); tvDescription1.setLines(3); tvDescription1.setId(321); tvDescription1.setTextSize(15); tvDescription1.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescription1Params = new RelativeLayout.LayoutParams(1100, 100); tvDescription1Params.addRule(RelativeLayout.CENTER_IN_PARENT, -1); tvDescription1.setPadding(100, 20, 100, 0); subheader.addView(tvDescription1, tvDescription1Params); desc = 0; flag = 1; flag1 = 0; } else { subheader.removeAllViews(); subheader.setVisibility(View.GONE); flag = 0; } } }); }
From source file:com.jinfukeji.jinyihuiup.indexBannerClick.ZhiboActivity.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); this.setContentView(R.layout.activity_zhibo); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); screen_direction = SCREEN_LAND;// w w w. j a v a2s . co m initLandView(); setLandOnClick(); isShowLayout = true; if (isPlayed) { player.leave(); player.setGSVideoView(mGSzhiboLand); initplayer(); mivPlayLand.setVisibility(View.GONE); } } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); this.setContentView(R.layout.activity_zhibo); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); screen_direction = SCREEN_PORT; initView(); zhibo_viewpager.addOnPageChangeListener(new ZhiboOnPageChangeListener()); initClickListener(); zhiboVPAdapter = new ZhiboVPAdapter(getSupportFragmentManager(), mFragments); zhibo_viewpager.setAdapter(zhiboVPAdapter); setOnClick(); isShowLayout = true; if (isPlayed) { mIvplayer.setVisibility(View.GONE); player.leave(); player.setGSVideoView(mGSzhibo); initplayer(); } } }
From source file:com.jaspersoft.android.jaspermobile.activities.share.AnnotationActivity.java
private void lockScreenOrientation() { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); else/* www . j a v a 2 s . co m*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
From source file:org.horaapps.leafpic.activities.PlayerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case org.horaapps.leafpic.R.id.action_share: Intent share = new Intent(Intent.ACTION_SEND); Media m = new Media(ContentHelper.getMediaPath(getApplicationContext(), getIntent().getData())); share.setType(m.getMimeType());//from w ww . j a v a 2s. c o m share.putExtra(Intent.EXTRA_STREAM, getIntent().getData()); startActivity(Intent.createChooser(share, getString(org.horaapps.leafpic.R.string.send_to))); return true; case org.horaapps.leafpic.R.id.action_settings: startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); return true; case org.horaapps.leafpic.R.id.rotate_layout: int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation(); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); showControls(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.nbplus.vbroadlauncher.BroadcastWebViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }//from ww w. j av a 2 s . c o m overridePendingTransition(R.anim.fade_in, R.anim.fade_out); setContentView(R.layout.activity_broadcast_webview); Log.d(TAG, "BroadcastWebViewActivity onCreate()"); WebView webView = (WebView) findViewById(R.id.webview); mWebViewClient = new BroadcastWebViewClient(this, webView); IntentFilter filter = new IntentFilter(); filter.addAction(Constants.ACTION_BROWSER_ACTIVITY_CLOSE); filter.addAction(Constants.ACTION_IOT_DEVICE_LIST); LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter); Intent i = getIntent(); String url = null; if (i != null && Constants.ACTION_SHOW_NOTIFICATION_CONTENTS.equals(getIntent().getAction())) { url = getIntent().getStringExtra(Constants.EXTRA_SHOW_NOTIFICATION_CONTENTS); } else { mShortcutData = i.getParcelableExtra(Constants.EXTRA_NAME_SHORTCUT_DATA); url = mShortcutData.getDomain() + mShortcutData.getPath(); } //url="http://183.98.53.165:8010/web_test/audio_autoplay.html"; if (StringUtils.isEmptyString(url) || !Patterns.WEB_URL.matcher(url).matches()) { Log.e(TAG, "Wrong url ...."); new AlertDialog.Builder(this).setMessage(R.string.alert_wrong_page_url) //.setTitle(R.string.alert_network_title) .setCancelable(true) .setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finishActivity(); } }).show(); return; } else { mWebViewClient.loadWebUrl(url); } Log.d(TAG, "start URL = " + url); setContentViewByOrientation(); }
From source file:ch.jeda.platform.android.Main.java
private int getScreenOrientation(final ViewRequest request) { if (request.getFeatures().contains(WindowFeature.ORIENTATION_LANDSCAPE)) { return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else if (request.getFeatures().contains(WindowFeature.ORIENTATION_PORTRAIT)) { return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else {//from w ww. jav a 2 s . c o m final int rotation = this.getWindowManager().getDefaultDisplay().getRotation(); if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) { return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else { return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; } } else { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) { return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else { return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; } } } }
From source file:com.Beat.RingdroidEditActivity.java
/** Called when the activity is first created. */ @Override/*from w w w. j a v a 2 s. com*/ public void onCreate(Bundle icicle) { super.onCreate(icicle); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); mRecordingFilename = null; mRecordingUri = null; mPlayer = null; mIsPlaying = false; Intent intent = getIntent(); if (intent.getBooleanExtra("privacy", false)) { showServerPrompt(true); return; } // If the Ringdroid media select activity was launched via a // GET_CONTENT intent, then we shouldn't display a "saved" // message when the user saves, we should just return whatever // they create. mWasGetContentIntent = intent.getBooleanExtra("was_get_content_intent", false); mFilename = intent.getData().toString(); mSoundFile = null; mKeyDown = false; if (mFilename.equals("record")) { try { Intent recordIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); startActivityForResult(recordIntent, REQUEST_CODE_RECORD); } catch (Exception e) { showFinalAlert(e, R.string.record_error); } } mHandler = new Handler(); loadGui(); mHandler.postDelayed(mTimerRunnable, 100); if (!mFilename.equals("record")) { loadFromFile(); } }
From source file:ru.neverdark.phototools.fragments.TitlesFragment.java
/** * Replace current fragment to other/*from ww w.j a v a 2 s . c o m*/ * * @param index * index fragment */ private void replaceFragment(int index) { Log.message("Enter"); boolean isOperationNeed = false; Fragment details = getFragmentManager().findFragmentById(R.id.main_detailFragment); switch (index) { case Constants.DOF_CHOICE: if ((details instanceof DofFragment) == false) { details = new DofFragment(); isOperationNeed = true; mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } break; case Constants.EV_CHOICE: if ((details instanceof EvpairsFragment) == false) { details = new EvpairsFragment(); isOperationNeed = true; mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } break; case Constants.SUNSET_CHOICE: if ((details instanceof SunsetFragment) == false) { details = new SunsetFragment(); isOperationNeed = true; mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } break; case Constants.ABOUT_CHOICE: if ((details instanceof AboutFragment) == false) { details = new AboutFragment(); isOperationNeed = true; mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } break; case Constants.PLUGIN_CHOICE: if ((details instanceof PluginsFragment) == false) { details = new PluginsFragment(); isOperationNeed = true; mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } break; } if (isOperationNeed == true) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.main_detailFragment, details); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } }
From source file:org.fossasia.phimpme.leafpic.activities.PlayerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_share: Intent share = new Intent(Intent.ACTION_SEND); Media m = new Media(ContentHelper.getMediaPath(getApplicationContext(), getIntent().getData())); share.setType(m.getMimeType());/*from w w w . j a v a2 s . c om*/ share.putExtra(Intent.EXTRA_STREAM, getIntent().getData()); startActivity(Intent.createChooser(share, getString(R.string.send_to))); return true; case R.id.action_settings: startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); return true; case R.id.rotate_layout: int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation(); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); showControls(); return true; default: return super.onOptionsItemSelected(item); } }