List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT
int SCREEN_ORIENTATION_PORTRAIT
To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT.
Click Source Link
portrait
in the android.R.attr#screenOrientation attribute. From source file:edu.chl.dat255.sofiase.readyforapet.viewcontroller.CreatePetActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.createpet);//from w w w . ja va 2 s .c o m setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Button create = (Button) findViewById(R.id.puppy_settings); create.setOnClickListener(this); //Dog barks when activity is started try { afd = getAssets().openFd("dogbark.m4a"); player = new MediaPlayer(); player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); //player.setLooping(true); player.prepare(); player.start(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.prey.activities.WelcomeBatchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.welcomebatch); menu();/*w w w . j a v a 2 s . c o m*/ installBatch(); }
From source file:com.google.identitytoolkit.demo.GitkitDemo.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Step 1: Create a GitkitClient. // The configurations are set in the AndroidManifest.xml. You can also set or overwrite them // by calling the corresponding setters on the GitkitClient builder. ////from ww w. ja va 2 s . c o m client = GitkitClient.newBuilder(this, new GitkitClient.SignInCallbacks() { // Implement the onSignIn method of GitkitClient.SignInCallbacks interface. // This method is called when the sign-in process succeeds. A Gitkit IdToken and the signed // in account information are passed to the callback. @Override public void onSignIn(IdToken idToken, GitkitUser user) { showProfilePage(idToken, user); // Now use the idToken to create a session for your user. // To do so, you should exchange the idToken for either a Session Token or Cookie // from your server. // Finally, save the Session Token or Cookie to maintain your user's session. } // Implement the onSignInFailed method of GitkitClient.SignInCallbacks interface. // This method is called when the sign-in process fails. @Override public void onSignInFailed() { Toast.makeText(GitkitDemo.this, "Sign in failed", Toast.LENGTH_LONG).show(); } }).build(); showSignInPage(); }
From source file:com.odt.kandani.View.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);/*from w ww .jav a2 s. c om*/ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_layout); icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message }; viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(IntroActivity.this, MainActivity.class); IntroActivity.this.startActivity(intent); overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left); IntroActivity.this.finish(); } }); justCreated = true; }
From source file:spinnersample.lalongooo.com.viewpager.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); icons = new int[] { R.drawable.app_overview_1_buy, R.drawable.app_overview_2_smartphone, R.drawable.app_overview_3_save_money, R.drawable.app_overview_4_coupons }; messages = new int[] { R.string.app_overview_1st_item_text, R.string.app_overview_2nd_item_text, R.string.app_overview_3rd_item_text, R.string.app_overview_4th_item_text }; viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton.setText(getString(R.string.StartMessaging)); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2, this), AndroidUtilities.dp(4, this)).setDuration(200)); animator.addState(new int[] {}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4, this), AndroidUtilities.dp(2, this)).setDuration(200)); startMessagingButton.setStateListAnimator(animator); }//ww w . java2s . c o m topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); indicator = (CirclePageIndicator) findViewById(R.id.indicator); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); indicator.setViewPager(viewPager); indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, ActivityMain.class); startActivity(intent2); finish(); } }); }
From source file:dev.filterme.About.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override//from ww w. j a v a 2s. co m public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:net.i2cat.app.BeeActivity.java
/** Called when the activity is first created. */ @Override/*from ww w . j a v a 2s . c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.main); myWebView = (WebView) findViewById(R.id.webview); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.getSettings().setGeolocationEnabled(true); myWebView.setWebChromeClient(new MyChromeWebViewClient()); myWebView.loadUrl("http://server1.bee-path.net/app/index.html"); }
From source file:edu.chl.dat255.sofiase.readyforapet.viewcontroller.SleepActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sleep); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //Show the Up button in the action bar. setupActionBar();/*from ww w . j a v a 2s .co m*/ startSleeping = (Button) findViewById(R.id.startsleeping); stopSleeping = (Button) findViewById(R.id.stopsleeping); sleepingDog = (ImageView) findViewById(R.id.sleepingdog); stopSleeping.setEnabled(false); startSleeping.setOnClickListener(new OnClickListener() { /** * Method onClick for the start sleeping button * * @param v - View */ public void onClick(View v) { //Snooring starts when clicking on fall asleep try { afd = getAssets().openFd("snoresoundsdog.wav"); player = new MediaPlayer(); player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); player.prepare(); player.start(); } catch (IOException e) { e.printStackTrace(); } stopSleeping.setEnabled(true); startSleeping.setEnabled(false); //Getting the time the pet starts to sleep startHour = CreatePetActivity.getPet().getPetMood().getCurrentHour(); sleepingDog.setVisibility(View.VISIBLE); sleepingDog.setBackgroundResource(R.anim.animation5); anim = (AnimationDrawable) sleepingDog.getBackground(); anim.start(); uiHandler.postDelayed(makeViewStop, 12000); } }); stopSleeping.setOnClickListener(new OnClickListener() { /** * Method onClick for the stop sleeping * * @param v - View */ public void onClick(View v) { //Calculating for how long the dog has slept if (startHour != 0) { sleepHours = (int) ((CreatePetActivity.getPet().getPetMood().getCurrentHour()) - startHour); } //Setting a resultCode with the distance walked that is sent to PetActivity SleepActivity.this.setResult(sleepHours); SleepActivity.this.finish(); } }); }
From source file:com.repay.android.adddebt.RepayDebtActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_adddebt); mDB = new DatabaseHandler(this); // If the available screen size is that of an average tablet (as defined // in the Android documentation) then allow the screen to rotate if (getResources().getBoolean(R.bool.lock_orientation)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }/* w w w . j a v a2s .co m*/ if (getIntent().getExtras() != null) { Bundle bundle = getIntent().getExtras(); try { mFriend = mDB.getFriendByRepayID(bundle.getString(AddDebtActivity.REPAY_ID)); } catch (Exception e) { Log.e(TAG, "Exception occurred when trying to retrieve friend details. Ending activity"); e.printStackTrace(); finish(); } } mActionBar = getActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setDisplayShowTitleEnabled(true); mActionBar.setSubtitle(R.string.fragment_enteramount_subtitle); mActionBar.setTitle(R.string.fragment_enteramount_title); // Instantiate fragment mEnterAmount = new EnterAmountFragment(); mFragMan = getSupportFragmentManager().beginTransaction(); mFragMan.add(R.id.activity_adddebt_framelayout, mEnterAmount); mFragMan.commit(); }
From source file:android.dstyo.com.androidtest.page.cars.CarsAddActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Inflate the layout for this fragment setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Intent intent = getIntent();// w ww . j a v a 2s .c o m Bundle bundle = intent.getExtras(); setContentView(R.layout.activity_add_car); textInputBrand = (TextInputLayout) findViewById(R.id.text_input_car_brand); textInputModel = (TextInputLayout) findViewById(R.id.text_input_car_model); textInputPlat = (TextInputLayout) findViewById(R.id.text_input_car_plat); textInputFare = (TextInputLayout) findViewById(R.id.text_input_car_fare); imageViewCar = (ImageView) findViewById(R.id.iv_car); btnSave = (Button) findViewById(R.id.btnSave); btnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (validateForm()) { setParam(false); } } }); imageViewCar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intents = new Intent(CarsAddActivity.this, CropActivity.class); startActivityForResult(intents, RequestConstant.ADD_IMAGE); } }); if (bundle != null) { int carId = bundle.getInt(RequestConstant.CAR_ID); getDetailCar(carId); btnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (validateForm()) { setParam(true); } } }); } }