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.kseek.camtest.ui.CamtestActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mApplication = (CamtestApplication) getApplication(); setContentView(R.layout.camtest);/* w w w.ja v a2 s . com*/ if (findViewById(R.id.handset_pager) != null) { // Handset detected ! mAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.handset_pager); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mSurfaceView = (SurfaceView) findViewById(R.id.handset_camera_view); SessionBuilder.getInstance().setSurfaceView(mSurfaceView); SessionBuilder.getInstance().setPreviewOrientation(90); } else { // Tablet detected ! device = TABLET; mAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.tablet_pager); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); SessionBuilder.getInstance().setPreviewOrientation(0); } mViewPager.setAdapter(mAdapter); // Prevents the phone from going to sleep mode PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "net.kseek.camtest.wakelock"); // Starts the service of the HTTP server this.startService(new Intent(this, CustomHttpServer.class)); // Starts the service of the RTSP server this.startService(new Intent(this, CustomRtspServer.class)); }
From source file:com.dm.material.dashboard.candybar.fragments.dialog.WallpaperSettingsFragment.java
@Override public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); if (Preferences.getPreferences(getActivity()).isScrollWallpaper()) { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else {/*ww w . jav a 2 s . c om*/ getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } }
From source file:com.tapcentive.sdk.actions.TapMessageFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); fragmentCreated = true;/*from ww w .java 2 s .co m*/ // Always request a change to orientation in the event that a landscape type game // occupies the current view getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
From source file:net.olejon.spotcommander.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Settings//from w ww.j a v a2s . co m PreferenceManager.setDefaultValues(mContext, R.xml.settings, false); // Allow landscape? if (!mTools.allowLandscape()) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Google API client mGoogleApiClient = new GoogleApiClient.Builder(mContext).addApiIfAvailable(Wearable.API).build(); // Database mDatabase = new MainSQLiteHelper(mContext).getWritableDatabase(); // Layout setContentView(R.layout.activity_main); // Toolbar final Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); toolbar.setTitle(getString(R.string.main_title)); setSupportActionBar(toolbar); // Listview mListView = (ListView) findViewById(R.id.main_list); final View listViewHeader = getLayoutInflater().inflate(R.layout.activity_main_subheader, mListView, false); mListView.addHeaderView(listViewHeader, null, false); final View listViewEmpty = findViewById(R.id.main_empty); mListView.setEmptyView(listViewEmpty); mListView.setLongClickable(true); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { openComputer(id); } }); mListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, final long id) { new MaterialDialog.Builder(mContext).title(R.string.main_remove_computer_dialog_title) .content(getString(R.string.main_remove_computer_dialog_message)) .positiveText(R.string.main_remove_computer_dialog_positive_button) .negativeText(R.string.main_remove_computer_dialog_negative_button) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) { removeComputer(id); listComputers(); } }).contentColorRes(R.color.black).negativeColorRes(R.color.black).show(); return true; } }); // Floating action button mFloatingActionButton = (FloatingActionButton) findViewById(R.id.main_fab); mFloatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(mContext, AddComputerActivity.class); startActivity(intent); } }); // Donate button final Button button = (Button) findViewById(R.id.main_make_donation_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(mContext, DonateActivity.class); startActivity(intent); } }); // Information dialog if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { if (!mTools.getSharedPreferencesBoolean("HIDE_INFORMATION_DIALOG_75")) { new MaterialDialog.Builder(mContext).title(R.string.main_information_dialog_title) .content(getString(R.string.main_information_dialog_message)) .positiveText(R.string.main_information_dialog_positive_button) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) { mTools.setSharedPreferencesBoolean("HIDE_INFORMATION_DIALOG_75", true); } }).contentColorRes(R.color.black).show(); } } // Message dialog String version = mTools.getProjectVersionName(); String device = ""; try { device = (Build.MANUFACTURER == null || Build.MODEL == null || Build.VERSION.SDK_INT < 1) ? "" : URLEncoder.encode(Build.MANUFACTURER + " " + Build.MODEL + " " + Build.VERSION.SDK_INT, "utf-8"); } catch (Exception e) { Log.e("MainActivity", Log.getStackTraceString(e)); } 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, getString(R.string.project_website) + "api/1/android/message/?version_name=" + version + "&device=" + device, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { requestQueue.stop(); try { final long id = response.getLong("id"); final String title = response.getString("title"); final String message = response.getString("message"); final long lastId = mTools.getSharedPreferencesLong("LAST_MESSAGE_ID"); if (lastId == 0) { mTools.setSharedPreferencesLong("LAST_MESSAGE_ID", id); } else if (id != lastId) { new MaterialDialog.Builder(mContext).title(title).content(message) .positiveText(R.string.main_message_dialog_positive_button) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) { mTools.setSharedPreferencesLong("LAST_MESSAGE_ID", id); } }).contentColorRes(R.color.black).show(); } } catch (Exception e) { Log.e("MainActivity", Log.getStackTraceString(e)); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { requestQueue.stop(); Log.e("MainActivity", error.toString()); } }); jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(10000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); requestQueue.add(jsonObjectRequest); // Google analytics final GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(mContext); final Tracker tracker = googleAnalytics.newTracker(R.xml.app_tracker); tracker.send(new HitBuilders.ScreenViewBuilder().build()); }
From source file:com.rvl.android.getnzb.Search.java
protected void onCreate(Bundle savedInstanceState) { Log.d(Tags.LOG, "- Starting search activity -"); super.onCreate(savedInstanceState); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.search);/*ww w . j a v a2 s . co m*/ if (!SEARCHTERM.equals("")) { new searchNZB().execute(SEARCHTERM, SEARCHCATEGORY, SEARCHAGE); return; } TextView statusbar = (TextView) findViewById(R.id.statusbar); statusbar.setText("Enter searchterm."); createSearchCategoryMapping(); createAgeMapping(); }
From source file:com.zdhx.androidbase.ui.account.ImagePagerActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//? setContentView(R.layout.ac_image_pager); imageLoader = new ImageLoader(this); loader = new MyImageLoader(); dialog = new ECProgressDialog(this); Bundle bundle = getIntent().getExtras(); String[] imageUrls = bundle.getStringArray(IMAGES); compressImageUrls = imageUrls;/* w ww . j a va2 s . co m*/ String[] imgNames = new String[compressImageUrls.length]; int pagerPosition = bundle.getInt(IMAGE_POSITION, 0); imgNames = bundle.getStringArray("imgNames"); if (savedInstanceState != null) { pagerPosition = savedInstanceState.getInt(STATE_POSITION); } pager = (HackyViewPager) findViewById(R.id.pager); pager.setAdapter(new ImagePagerAdapter(imageUrls, this, imgNames)); pager.setCurrentItem(pagerPosition); if (imageUrls.length < 10) { mIndicator = (CirclePageIndicator) findViewById(R.id.indicator); mIndicator.setViewPager(pager); } }
From source file:com.jwetherell.quick_response_code.EncoderActivity.java
@SuppressLint("NewApi") @Override//from w w w . ja va 2 s .c om public void onCreate(Bundle bundle) { super.onCreate(bundle); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.encoder); // Action bar icon back getActionBar().setDisplayHomeAsUpEnabled(true); //getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:com.wifi.brainbreaker.mydemo.spydroid.ui.SpydroidActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mApplication = (SpydroidApplication) getApplication(); setContentView(R.layout.spydroid);/* w w w .j av a 2s .c o m*/ if (findViewById(R.id.handset_pager) != null) { // Handset detected ! mAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.handset_pager); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mSurfaceView = (SurfaceView) findViewById(R.id.handset_camera_view); SessionBuilder.getInstance().setSurfaceView(mSurfaceView); SessionBuilder.getInstance().setPreviewOrientation(90); } else { // Tablet detected ! device = TABLET; mAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.tablet_pager); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); SessionBuilder.getInstance().setPreviewOrientation(0); } mViewPager.setAdapter(mAdapter); // Remove the ads if this is the donate version of the app. // if (mApplication.DONATE_VERSION) { // ((LinearLayout)findViewById(R.id.adcontainer)).removeAllViews(); // } // Prevents the phone from going to sleep mode PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "net.majorkernelpanic.spydroid.wakelock"); // Starts the service of the HTTP server this.startService(new Intent(this, CustomHttpServer.class)); // Starts the service of the RTSP server this.startService(new Intent(this, CustomRtspServer.class)); }
From source file:com.pledgeapp.pledge.activities.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Restore from saved instance state if (savedInstanceState != null) { mIsResolving = savedInstanceState.getBoolean(KEY_IS_RESOLVING); mShouldResolve = savedInstanceState.getBoolean(KEY_SHOULD_RESOLVE); }/*from w ww . jav a 2 s .co m*/ // Build GoogleApiClient with access to basic profile mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN) .addScope(Plus.SCOPE_PLUS_PROFILE).build(); PledgeApplication.setGoogleApiClient(mGoogleApiClient); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); PledgeApplication.getPledgeModel().getMajorCategories(); PledgeApplication.getPledgeModel().getSubcategories(); }
From source file:com.gsma.rcs.ri.sharing.image.InitiateImageSharing.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.image_sharing_initiate); initialize();//from ww w . j a va 2s . c om // Register to API connection manager if (!isServiceConnected(RcsServiceName.IMAGE_SHARING)) { showMessageThenExit(R.string.label_service_not_available); return; } startMonitorServices(RcsServiceName.IMAGE_SHARING); try { mImageSharingService.addEventListener(mIshListener); } catch (RcsServiceException e) { showExceptionThenExit(e); } }