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:net.olejon.spotcommander.PlaylistsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Allow landscape? if (!mTools.allowLandscape()) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Intent//from w w w .j a v a2 s. c om final Intent intent = getIntent(); // Computer final long computerId = mTools.getSharedPreferencesLong( "WIDGET_" + intent.getStringExtra(WidgetLarge.WIDGET_LARGE_INTENT_EXTRA) + "_COMPUTER_ID"); final String[] computer = mTools.getComputer(computerId); // Layout setContentView(R.layout.activity_playlists); // Toolbar final Toolbar toolbar = (Toolbar) findViewById(R.id.playlists_toolbar); toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); toolbar.setTitle(getString(R.string.playlists_title)); setSupportActionBar(toolbar); // Progress bar mProgressBar = (ProgressBar) findViewById(R.id.playlists_progressbar); mProgressBar.setVisibility(View.VISIBLE); // Listview mListView = (ListView) findViewById(R.id.playlists_list); // Get playlists final Cache cache = new DiskBasedCache(getCacheDir(), 0); final Network network = new BasicNetwork(new HurlStack()); final RequestQueue requestQueue = new RequestQueue(cache, network); requestQueue.start(); final JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, computer[0] + "/playlists.php?get_playlists_as_json", null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { requestQueue.stop(); try { final ArrayList<String> playlistNames = new ArrayList<>(); final Iterator<?> iterator = response.keys(); while (iterator.hasNext()) { String key = (String) iterator.next(); playlistNames.add(key); } Collections.sort(playlistNames, new Comparator<String>() { @Override public int compare(String string1, String string2) { return string1.compareToIgnoreCase(string2); } }); for (String playlistName : playlistNames) { mPlaylistUris.add(response.getString(playlistName)); } final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(mContext, R.layout.activity_playlists_list_item, playlistNames); mProgressBar.setVisibility(View.GONE); mListView.setAdapter(arrayAdapter); mListView.setVisibility(View.VISIBLE); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mTools.remoteControl(computerId, "shuffle_play_uri", mPlaylistUris.get(position)); finish(); } }); } catch (Exception e) { mProgressBar.setVisibility(View.GONE); final TextView textView = (TextView) findViewById(R.id.playlists_error); textView.setVisibility(View.VISIBLE); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { requestQueue.stop(); mProgressBar.setVisibility(View.GONE); final TextView textView = (TextView) findViewById(R.id.playlists_error); textView.setVisibility(View.VISIBLE); } }) { @Override public HashMap<String, String> getHeaders() { final HashMap<String, String> hashMap = new HashMap<>(); if (!computer[1].equals("") && !computer[2].equals("")) hashMap.put("Authorization", "Basic " + Base64.encodeToString((computer[1] + ":" + computer[2]).getBytes(), Base64.NO_WRAP)); return hashMap; } }; jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(2500, 0, 0)); requestQueue.add(jsonObjectRequest); }
From source file:dheeraj.com.trafficsolution.FeedsActivity.java
void init() { setContentView(R.layout.activity_feeds); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); ViewPager viewPager = (ViewPager) findViewById(R.id.feeds_view_pager); FeedsPagerAdapter adapter = new FeedsPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new GeoFenceFragment(), "Pedestrian"); adapter.addFragment(PostsFragment.newInstance(PostsFragment.TYPE_FEED), "Feed"); adapter.addFragment(new ParkingFragment(), "Parking"); viewPager.setAdapter(adapter);/*from w w w. j av a2 s .c o m*/ viewPager.setCurrentItem(1); TabLayout tabLayout = (TabLayout) findViewById(R.id.feeds_tab_layout); tabLayout.setupWithViewPager(viewPager); }
From source file:org.wheelmap.android.activity.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mCredentials = new UserCredentials(getApplicationContext()); setResult(mCredentials.isLoggedIn() ? RESULT_OK : RESULT_CANCELED); if (UtilsMisc.isTablet(getApplicationContext())) { UtilsMisc.showAsPopup(this); } else {/*from w ww . j a v a 2 s .com*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } setContentView(R.layout.activity_frame_empty); Log.d(TAG, "onCreate"); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayShowTitleEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } FragmentManager fm = getSupportFragmentManager(); if (!mCredentials.isLoggedIn()) { mFragment = new LoginFragment(); setTitle(R.string.login_activity_title); } else { setTitle(R.string.logout_activity_title); mFragment = new LogoutFragment(); } fm.beginTransaction().add(R.id.content, mFragment, LoginFragment.TAG).commit(); if (UtilsMisc.isTablet(getApplicationContext())) { View v = findViewById(R.id.content); while (v != null && v instanceof ViewGroup) { v.setBackgroundColor(Color.TRANSPARENT); if (v.getParent() instanceof View) { v = (View) v.getParent(); } else { break; } } } }
From source file:net.bluehack.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);/* ww w .j a v a2s . co m*/ super.onCreate(savedInstanceState); Theme.loadRecources(this); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); View imageView = findViewById(R.id.background_image_intro); BitmapDrawable drawable = (BitmapDrawable) getResources().getDrawable(R.drawable.catstile); drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); imageView.setBackgroundDrawable(drawable); } 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:org.linphone.CallOutgoingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getBoolean(R.bool.orientation_portrait_only)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }/*from w ww . j a v a2 s .co m*/ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.call_outgoing); name = (TextView) findViewById(R.id.contact_name); number = (TextView) findViewById(R.id.contact_number); contactPicture = (ImageView) findViewById(R.id.contact_picture); isMicMuted = false; isSpeakerEnabled = false; micro = (ImageView) findViewById(R.id.micro); micro.setOnClickListener(this); speaker = (ImageView) findViewById(R.id.speaker); speaker.setOnClickListener(this); // set this flag so this activity will stay in front of the keyguard int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; getWindow().addFlags(flags); hangUp = (ImageView) findViewById(R.id.outgoing_hang_up); hangUp.setOnClickListener(this); mListener = new LinphoneCoreListenerBase() { @Override public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { if (call == mCall && State.Connected == state) { if (!LinphoneActivity.isInstanciated()) { return; } LinphoneActivity.instance().startIncallActivity(mCall); finish(); return; } else if (state == State.Error) { // Convert LinphoneCore message for internalization if (message != null && call.getErrorInfo().getReason() == Reason.Declined) { displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT); } else if (message != null && call.getErrorInfo().getReason() == Reason.NotFound) { displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT); } else if (message != null && call.getErrorInfo().getReason() == Reason.Media) { displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT); } else if (message != null && call.getErrorInfo().getReason() == Reason.Busy) { displayCustomToast(getString(R.string.error_user_busy), Toast.LENGTH_SHORT); } else if (message != null) { displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT); } } if (LinphoneManager.getLc().getCallsNb() == 0) { finish(); return; } } }; instance = this; }
From source file:dheeraj.com.trafficsolution.ProfileActivity.java
void init() { setContentView(R.layout.activity_profile); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mAuth = FirebaseAuth.getInstance();//from w ww . java 2 s . c o m mProfileUi = (ViewGroup) findViewById(R.id.profile); points = (TextView) findViewById(R.id.points); mProfilePhoto = (CircularImageView) findViewById(R.id.profile_user_photo); mProfileUsername = (TextView) findViewById(R.id.profile_user_name); findViewById(R.id.show_feeds_button).setOnClickListener(this); findViewById(R.id.sign_out_button).setOnClickListener(this); showSignedInUI(mAuth.getCurrentUser()); }
From source file:com.repay.android.adddebt.AddDebtActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // 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); }/* www. j a v a 2 s . com*/ mActionBar = getActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setDisplayShowTitleEnabled(true); mActionBar.setSubtitle(R.string.fragment_choosefriend_subtitle); super.onCreate(savedInstanceState); setContentView(R.layout.activity_adddebt); mSelectedFriends = new ArrayList<Friend>(); mDB = new DatabaseHandler(this); // Instantiate Fragments mChoosePerson = new ChoosePersonFragment(); mEnterAmount = new EnterAmountFragment(); mSummary = new DebtSummaryFragment(); mFrameLayoutRes = R.id.activity_adddebt_framelayout; if (getIntent().getExtras() != null) { Bundle bundle = getIntent().getExtras(); if (bundle.containsKey(NO_OF_FRIENDS_SELECTED)) { try { int count = bundle.getInt(NO_OF_FRIENDS_SELECTED); mSelectedFriends = new ArrayList<Friend>(); for (int i = 1; i <= count; i++) { mSelectedFriends .add(mDB.getFriendByRepayID(bundle.getString(REPAY_ID + Integer.toString(i)))); } } catch (SQLException e) { e.printStackTrace(); } } Log.i(TAG, "Friend data from FriendDetailsActivity, not selected from the list"); } else if (savedInstanceState != null && savedInstanceState.containsKey(NO_OF_FRIENDS_SELECTED)) { int count = savedInstanceState.getInt(NO_OF_FRIENDS_SELECTED); mSelectedFriends = new ArrayList<Friend>(); for (int i = 1; i <= count; i++) { mSelectedFriends .add(mDB.getFriendByRepayID(savedInstanceState.getString(REPAY_ID + Integer.toString(i)))); } } if (savedInstanceState != null && savedInstanceState.containsKey(AddDebtActivity.AMOUNT)) { mAmount = new BigDecimal(savedInstanceState.getString(AddDebtActivity.AMOUNT)); } // Show the first fragment mFragMan = getSupportFragmentManager().beginTransaction(); mFragMan.add(mFrameLayoutRes, mChoosePerson); mFragMan.commit(); }
From source file:co.taqat.call.CallOutgoingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getBoolean(R.bool.orientation_portrait_only)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }// w w w. j a va2 s. c om getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.call_outgoing); name = (TextView) findViewById(R.id.contact_name); number = (TextView) findViewById(R.id.contact_number); contactPicture = (ImageView) findViewById(R.id.contact_picture); isMicMuted = false; isSpeakerEnabled = false; micro = (ImageView) findViewById(R.id.micro); micro.setOnClickListener(this); speaker = (ImageView) findViewById(R.id.speaker); speaker.setOnClickListener(this); // set this flag so this activity will stay in front of the keyguard int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; getWindow().addFlags(flags); hangUp = (ImageView) findViewById(R.id.outgoing_hang_up); hangUp.setOnClickListener(this); mListener = new LinphoneCoreListenerBase() { @Override public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { if (call == mCall && State.Connected == state) { if (!LinphoneActivity.isInstanciated()) { return; } LinphoneActivity.instance().startIncallActivity(mCall); finish(); return; } else if (state == State.Error) { // Convert LinphoneCore message for internalization if (message != null && call.getErrorInfo().getReason() == Reason.Declined) { displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT); } else if (message != null && call.getErrorInfo().getReason() == Reason.NotFound) { displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT); } else if (message != null && call.getErrorInfo().getReason() == Reason.Media) { displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT); } else if (message != null && call.getErrorInfo().getReason() == Reason.Busy) { displayCustomToast(getString(R.string.error_user_busy), Toast.LENGTH_SHORT); } else if (message != null) { displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT); } } if (call == mCall && State.OutgoingRinging == state) { number.setText("Ringing.."); } if (LinphoneManager.getLc().getCallsNb() == 0) { finish(); return; } } }; instance = this; }
From source file:org.apps8os.logger.android.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().setFormat(PixelFormat.RGBA_8888); // update the locale final String lan = AppManager.getCurrentLocaleLanguage(); if (!TextUtils.isEmpty(lan)) { LoggerApp.getInstance().updateLocale(new Locale(lan)); }//from w w w . j a va 2s .c o m AppManager.refreshLocale(); super.onCreate(savedInstanceState); setContentView(R.layout.act_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); getSupportFragmentManager().addOnBackStackChangedListener(this); setupActionBar(); // root fragment onFragmentChanged(R.layout.frag_logger_panel, null); }
From source file:com.prey.activities.PreyConfigurationSMSActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences_sms); PreyStatus.getInstance().setPreyConfigurationActivityResume(true); try {//www . ja v a2 s .c om CheckBoxPreference pSMS = (CheckBoxPreference) findPreference("PREFS_SMS_COMMAND"); PreyConfig preyConfig = PreyConfig.getPreyConfig(getApplicationContext()); PreyLogger.i("preyConfig.isSmsCommand:" + preyConfig.isSmsCommand()); pSMS.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { CheckBoxPreference pSMS = (CheckBoxPreference) findPreference("PREFS_SMS_COMMAND"); PreyLogger.i("preyConfig.newValue:" + newValue); boolean value = ((Boolean) newValue).booleanValue(); PreyConfig.getPreyConfig(getApplicationContext()).setSmsCommand(value); pSMS.setChecked(value); pSMS.setDefaultValue(value); if (value) { requestPermission(); ; } return false; } }); if (!preyConfig.isSmsCommand()) { pSMS.setChecked(false); pSMS.setDefaultValue(false); } else { pSMS.setChecked(true); pSMS.setDefaultValue(true); } } catch (Exception e) { } setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }