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:ir.besteveryeverapp.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);//from ww w .java 2s. c o m super.onCreate(savedInstanceState); Theme.loadRecources(this); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); } if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase()); 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), AndroidUtilities.dp(4)) .setDuration(200)); animator.addState(new int[] {}, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)) .setDuration(200)); startMessagingButton.setStateListAnimator(animator); } 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.addOnPageChangeListener(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) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); if (BuildVars.DEBUG_VERSION) { startMessagingButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { ConnectionsManager.getInstance().switchBackend(); return true; } }); } justCreated = true; }
From source file:com.glacialsoftware.googolplex.GoogolplexDisplayActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { String theme = PreferenceManager.getDefaultSharedPreferences(this).getString("theme_select", "Light"); if (theme.equals("Light")) { setTheme(R.style.lightTheme);/*from w w w. java 2 s .co m*/ currentTheme = theme; } else { setTheme(R.style.darkTheme); currentTheme = theme; } super.onCreate(savedInstanceState); setContentView(R.layout.activity_googolplex_display); //created=true; if (savedInstanceState == null) { Intent intent = getIntent(); savedInstanceState = intent.getBundleExtra("com.glacialsoftware.googolplex.manualSavedInstanceState"); } if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("tilt_lock", false)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } firstVisiblePosition = 0; overlayShowing = false; preferencesShowing = false; int overlayPosition = 0; if (savedInstanceState != null) { firstVisiblePosition = savedInstanceState.getInt("firstVisiblePosition"); overlayShowing = savedInstanceState.getBoolean("overlayShowing"); overlayPosition = savedInstanceState.getInt("overlayPosition"); preferencesShowing = savedInstanceState.getBoolean("preferencesShowing"); } googolplexDisplayFragment = new GoogolplexDisplayFragment(overlayShowing, overlayPosition); digitOverlayFragment = new DigitOverlayFragment(); googolplexPreferenceFragment = new GoogolplexPreferenceFragment(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.googolplex_display_frame, googolplexDisplayFragment); fragmentTransaction.add(R.id.googolplex_display_frame, digitOverlayFragment); fragmentTransaction.add(R.id.googolplex_display_frame, googolplexPreferenceFragment); fragmentTransaction.hide(digitOverlayFragment); fragmentTransaction.hide(googolplexPreferenceFragment); fragmentTransaction.commit(); }
From source file:com.prey.activities.DeviceReadyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.device_ready); PreyLogger.d("onCreate of DeviceReadyActivity"); final Typeface titilliumWebBold = Typeface.createFromAsset(getAssets(), "fonts/Titillium_Web/TitilliumWeb-Bold.ttf"); final Typeface magdacleanmonoRegular = Typeface.createFromAsset(getAssets(), "fonts/MagdaClean/magdacleanmono-regular.ttf"); TextView textView3_1 = (TextView) findViewById(R.id.textView3_1); TextView textView3_2 = (TextView) findViewById(R.id.textView3_2); TextView textView4_1 = (TextView) findViewById(R.id.textView4_1); TextView textView4_2 = (TextView) findViewById(R.id.textView4_2); textView3_1.setTypeface(magdacleanmonoRegular); textView3_2.setTypeface(titilliumWebBold); textView4_1.setTypeface(magdacleanmonoRegular); textView4_2.setTypeface(titilliumWebBold); LinearLayout linearLayout1 = (LinearLayout) findViewById(R.id.linearLayout1); linearLayout1.setOnClickListener(new View.OnClickListener() { @Override//from ww w. java2 s. c om public void onClick(View v) { Intent intent = null; intent = new Intent(getApplication(), PanelWebActivity.class); startActivity(intent); finish(); } }); LinearLayout linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2); linearLayout2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = null; intent = new Intent(getApplication(), PreyConfigurationActivity.class); startActivity(intent); finish(); } }); }
From source file:com.example.android.materialdesigncodelab.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (!RadioApplication.isPortrait) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); else//from w ww. ja va2 s . c o m setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); activity = this; // Adding Toolbar to Main screen Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Setting ViewPager for each Tabs viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); // Set Tabs inside Toolbar TabLayout tabs = (TabLayout) findViewById(R.id.tabs); tabs.setTabMode(TabLayout.MODE_SCROLLABLE); tabs.setupWithViewPager(viewPager); // Adding menu icon to Toolbar ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); supportActionBar.setDisplayHomeAsUpEnabled(true); } }
From source file:ua.juliazozulia.taskcollector.ui.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle(getString(R.string.all_issues)); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); bindViews();//from www . j a v a 2s . c o m setupViews(); }
From source file:com.prey.activities.InitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); this.setContentView(R.layout.home); PreyLogger.i("onCreate of MenuActivity"); onboardingPagerAdapter = new OnboardingPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(onboardingPagerAdapter); Button buttonHome = (Button) findViewById(R.id.buttonHome); buttonHome.setOnClickListener(new View.OnClickListener() { @Override/*from w w w .j av a 2 s.c o m*/ public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), SignUpActivity.class); startActivity(intent); finish(); } }); TextView textView = (TextView) findViewById(R.id.linkHome); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), SignInActivity.class); startActivity(intent); finish(); } }); Typeface titilliumWebBold = Typeface.createFromAsset(getAssets(), "fonts/Titillium_Web/TitilliumWeb-Bold.ttf"); buttonHome.setTypeface(titilliumWebBold); final LinearLayout larr = (LinearLayout) findViewById(R.id.larr); final LinearLayout rarr = (LinearLayout) findViewById(R.id.rarr); larr.setVisibility(View.GONE); larr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int currentItem = mViewPager.getCurrentItem(); larr.setVisibility(View.VISIBLE); rarr.setVisibility(View.VISIBLE); if (currentItem == 0) { larr.setVisibility(View.GONE); } mViewPager.setCurrentItem(currentItem - 1); } }); rarr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int currentItem = mViewPager.getCurrentItem(); larr.setVisibility(View.VISIBLE); rarr.setVisibility(View.VISIBLE); if (currentItem >= 5) { rarr.setVisibility(View.GONE); onboardingCompleted(); } mViewPager.setCurrentItem(currentItem + 1); } }); mViewPager.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int currentItem = mViewPager.getCurrentItem(); larr.setVisibility(View.VISIBLE); rarr.setVisibility(View.VISIBLE); PreyLogger.i("currentItem:" + currentItem); if (currentItem == 0) { larr.setVisibility(View.GONE); } if (currentItem >= 5) { rarr.setVisibility(View.GONE); onboardingCompleted(); } return false; } }); onboardingInit(); }
From source file:ru.neverdark.phototools.DetailsActivity.java
/** * Shows fragment by index delivered from MainActivity *//*from w w w. j a va2 s .co m*/ private void showFragment() { Log.message("Enter"); int index = getIntent().getIntExtra(Constants.SHOWN_INDEX, 0); Log.variable("index", String.valueOf(index)); switch (index) { case Constants.DOF_CHOICE: DofFragment dofFragment = new DofFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, dofFragment).commit(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; case Constants.EV_CHOICE: EvpairsFragment evFragment = new EvpairsFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, evFragment).commit(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; case Constants.SUNSET_CHOICE: SunsetFragment sunsetFragment = new SunsetFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, sunsetFragment).commit(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); break; case Constants.ABOUT_CHOICE: AboutFragment aboutFragment = new AboutFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, aboutFragment).commit(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); break; case Constants.PLUGIN_CHOICE: PluginsFragment pluginFragment = new PluginsFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, pluginFragment).commit(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); break; } }
From source file:com.waz.zclient.utils.ViewUtils.java
public static void lockScreenOrientation(int orientation, Activity activity) { switch (orientation) { case Configuration.ORIENTATION_PORTRAIT: activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break;/* w ww. j a va2 s .com*/ case Configuration.ORIENTATION_LANDSCAPE: activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; default: activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); break; } }
From source file:yalantis.ua.econtactapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); initToolbar();/*www.j a v a 2s. co m*/ initNavigationDrawer(); setupTab(); }