Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT

List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT.

Prototype

int SCREEN_ORIENTATION_PORTRAIT

To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_PORTRAIT.

Click Source Link

Document

Constant corresponding to portrait in the android.R.attr#screenOrientation attribute.

Usage

From source file:edu.mum.ml.group7.guessasketch.android.EasyPaint.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // it removes the title from the actionbar(more space for icons?)
    // this.getActionBar().setDisplayShowTitleEnabled(false);

    pixels5 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics());
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    LinearLayout parent = new LinearLayout(this);

    parent.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    parent.setOrientation(LinearLayout.VERTICAL);

    LinearLayout scrollViewParent = new LinearLayout(this);

    scrollViewParent.setLayoutParams(// w w  w  . j  ava 2s. c o m
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    scrollViewParent.setOrientation(LinearLayout.HORIZONTAL);

    HorizontalScrollView predictionsHorizontalScrollView = new HorizontalScrollView(this);
    //predictionsHorizontalScrollView.setLayoutParams(new ViewGroup.LayoutParams());

    predictions = new LinearLayout(this);
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    params.gravity = Gravity.CENTER_VERTICAL;
    predictions.setLayoutParams(params);

    predictions.setOrientation(LinearLayout.HORIZONTAL);

    resetPredictionsView(predictions, true);
    predictionsHorizontalScrollView.addView(predictions);

    saveButton = new Button(this);
    saveButton.setText("Send Feedback");

    predictionsHorizontalScrollView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 10.0f));

    saveButton.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1.0f));

    saveButton.setVisibility(View.INVISIBLE);

    FrameLayout frameLayout = new FrameLayout(this);
    frameLayout
            .setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    frameLayout.addView(saveButton);

    loader = new ProgressBar(this);
    loader.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    loader.setIndeterminate(true);
    loader.setVisibility(ProgressBar.INVISIBLE);

    frameLayout.addView(loader);

    scrollViewParent.addView(predictionsHorizontalScrollView);
    scrollViewParent.addView(frameLayout);

    contentView = new MyView(this);
    parent.addView(scrollViewParent);
    parent.addView(contentView);

    setContentView(parent);

    otherLabelOnClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.e("Clicked", "Other Label label '" + (String) view.getTag() + "'");
            sendScreenshot(false, feedbackType, (String) view.getTag());
        }
    };

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(Color.BLACK);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(DEFAULT_BRUSH_SIZE);

    // Where did these magic numbers come from? What do they mean? Can I change them? ~TheOpenSourceNinja
    // Absolutely random numbers in order to see the emboss. asd! ~Valerio
    mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 }, 0.4f, 6, 3.5f);

    mBlur = new BlurMaskFilter(5, BlurMaskFilter.Blur.NORMAL);

    if (isFirstTime()) {
        AlertDialog.Builder alert = new AlertDialog.Builder(this);

        alert.setTitle(R.string.app_name);
        alert.setMessage(R.string.app_description);
        alert.setNegativeButton(R.string.continue_button, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                Toast.makeText(getApplicationContext(), R.string.here_is_your_canvas, Toast.LENGTH_SHORT)
                        .show();
            }
        });

        alert.show();
    } else {
        Toast.makeText(getApplicationContext(), R.string.here_is_your_canvas, Toast.LENGTH_SHORT).show();
    }

    loadFromIntents();
}

From source file:com.teitsmch.hearthmaker.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.inject(this);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    spinners = new ArrayList<>();
    idArray = new int[] { R.array.cost, R.array.card_type, R.array.rarity, R.array.card_set };

    mTitle = mDrawerTitle = getTitle();/* w w  w  .j  a v  a 2s .  c  om*/
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    Toolbar mToolbar = (Toolbar) findViewById(R.id.activity_toolbar);
    setSupportActionBar(mToolbar);
    mHearthService = new HearthService();
    mMainActivityPresenter = new MainActivityPresenter(this, mHearthService);
    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    mDrawerList.setNavigationItemSelectedListener(this);
    mMainActivityPresenter.loadDecks(this.fileList());

    setExpand = (ImageView) findViewById(R.id.expand_set);
    setExpand.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mSetSpinner.performClick();
        }
    });

    rarityExpand = (ImageView) findViewById(R.id.expand_rarity);
    rarityExpand.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mRaritySpinner.performClick();
        }
    });

    typeExpand = (ImageView) findViewById(R.id.expand_type);
    typeExpand.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mTypeSpinner.performClick();
        }
    });

    costExpand = (ImageView) findViewById(R.id.expand_cost);
    costExpand.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCostSpinner.performClick();
        }
    });

    classExpand = (ImageView) findViewById(R.id.expand_class);
    classExpand.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mClassSpinner.performClick();
        }
    });

    clearAll = (ImageView) findViewById(R.id.clear_all);
    clearAll.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mClassSpinner.setVisibility(View.INVISIBLE);
            mClassSpinner.setSelection(0);
            mRaritySpinner.setVisibility(View.INVISIBLE);
            mRaritySpinner.setSelection(0);
            mCostSpinner.setVisibility(View.INVISIBLE);
            mCostSpinner.setSelection(0);
            mTypeSpinner.setVisibility(View.INVISIBLE);
            mTypeSpinner.setSelection(0);
            mSetSpinner.setVisibility(View.INVISIBLE);
            mSetSpinner.setSelection(0);
            searchView.setQuery("", true);
            searchView.onActionViewCollapsed();
        }
    });

    // enable ActionBar app icon to behave as action to toggle nav drawer
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
    }

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            mToolbar, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            getSupportActionBar().setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getSupportActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

    };

    mDrawerLayout.setDrawerListener(mDrawerToggle);

    dialogClasses = getResources().getStringArray(R.array.card_class_dialog);
    currentClasses = new ArrayList<>();
    currentClasses.addAll(Arrays.asList(dialogClasses));
    mClassSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.spinner_item, currentClasses);
    mClassSpinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
    mClassSpinner.setAdapter(mClassSpinnerAdapter);
    spinners.add(mCostSpinner);
    spinners.add(mTypeSpinner);
    spinners.add(mRaritySpinner);
    spinners.add(mSetSpinner);

    for (int k = 0; k < 4; k++) {
        setSpinnerAdapter(spinners.get(k), idArray[k]);
    }

    searchView = (SearchView) findViewById(R.id.searchView);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            mMainActivityPresenter.getCardFilter(mClassSpinner.getSelectedItem().toString(),
                    mCostSpinner.getSelectedItem().toString(), mTypeSpinner.getSelectedItem().toString(),
                    mRaritySpinner.getSelectedItem().toString(), mSetSpinner.getSelectedItem().toString(),
                    query);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            mMainActivityPresenter.getCardFilter(mClassSpinner.getSelectedItem().toString(),
                    mCostSpinner.getSelectedItem().toString(), mTypeSpinner.getSelectedItem().toString(),
                    mRaritySpinner.getSelectedItem().toString(), mSetSpinner.getSelectedItem().toString(),
                    newText);
            return false;
        }
    });

    mCollectibleOption = "1";
    mManifestHearthApiKey = "hearthstone_api_key";
    currentDeckClass = "";

    mSpinnerView.setVisibility(View.GONE);
    onNavigationItemSelected(mDrawerList.getMenu().findItem(CATALOG_FRAGMENT_ID));
}

From source file:ch.jeda.platform.android.CanvasFragment.java

int getOrientation(final int currentOrientation) {
    if (this.features.contains(ViewFeature.ORIENTATION_LANDSCAPE)) {
        return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (this.features.contains(ViewFeature.ORIENTATION_PORTRAIT)) {
        return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else {//from   w  ww .  j  ava 2 s. c  o  m
        return currentOrientation;
    }
}

From source file:ru.tinkoff.acquiring.sdk.PayFormActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();//from   w w w .  jav  a  2s  .  c  om
    int theme = intent.getIntExtra(EXTRA_THEME, 0);
    if (theme != 0) {
        setTheme(theme);
    }

    fragmentsCommunicator.onCreate(savedInstanceState);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.acq_activity);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(R.attr.acqPayFormTitle, tv, true);
    String title = getResources().getString(tv.resourceId);
    setTitle(title);

    dialogsManager = new DialogsManager(this);

    String terminalKey = intent.getStringExtra(EXTRA_TERMINAL_KEY);
    String password = intent.getStringExtra(EXTRA_PASSWORD);
    String publicKey = intent.getStringExtra(EXTRA_PUBLIC_KEY);
    chargeMode = intent.getBooleanExtra(EXTRA_CHARGE_MODE, false);

    sdk = new AcquiringSdk(terminalKey, password, publicKey);
    cardManager = new CardManager(sdk);
    useCustomKeyboard = intent.getBooleanExtra(EXTRA_CUSTOM_KEYBOARD, false);

    if (savedInstanceState == null) {
        isCardsReady = false;
        if (intent.hasExtra(EXTRA_PAYMENT_INFO)) {
            showRejected();
        } else if (intent.hasExtra(EXTRA_THREE_DS)) {
            showThreeDsData();
        } else {
            startFinishAuthorized();
            if (isCardChooseEnable()) {
                String customerKey = intent.getStringExtra(EXTRA_CUSTOMER_KEY);
                showProgressDialog();
                requestCards(customerKey, cardManager);
            }
        }
    } else {
        cards = new CardsArrayBundlePacker().unpack(savedInstanceState.getBundle(INSTANCE_KEY_CARDS));
        int idx = savedInstanceState.getInt(INSTANCE_KEY_CARD_INDEX, -1);
        if (idx != -1) {
            sourceCard = cards[idx];
        }
    }
}

From source file:com.imaginamos.taxisya.taxista.activities.RegisterDriverActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_register_driver);

    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    photoFilesDirectory = new File(Environment.getExternalStorageDirectory() + "/TaxisYa");
    if (!photoFilesDirectory.exists()) {
        photoFilesDirectory.mkdir();/*  ww w  .j a  v  a 2s. co m*/
    }

    registerProgressDialog = new ProgressDialog(this);
    registerProgressDialog.setIndeterminate(true);
    registerProgressDialog.setMessage(getString(R.string.register_driver_in_progress));

    //volver = (ImageView) findViewById(R.id.btn_volver);
    //volver.setOnClickListener(this);

    name = (EditText) findViewById(R.id.txtName);
    identity = (EditText) findViewById(R.id.txtIdentify);
    license = (EditText) findViewById(R.id.txtLicense);
    email = (EditText) findViewById(R.id.txtUser);
    phone = (EditText) findViewById(R.id.txtPhone);
    cellphone = (EditText) findViewById(R.id.txtCellphone);
    address = (EditText) findViewById(R.id.txtAddress);
    pass = (EditText) findViewById(R.id.txtPass);
    carPlate = (EditText) findViewById(R.id.txtCarPlate);
    carBrand = (EditText) findViewById(R.id.txtCarBrand);
    carLine = (EditText) findViewById(R.id.txtCarLine);
    //  carMobileId = (EditText) findViewById(R.id.txtCarMobileId);
    carYear = (EditText) findViewById(R.id.txtCarYear);
    carCompany = (EditText) findViewById(R.id.txtCarCompany);

    btnRegister = (Button) findViewById(R.id.btnLogin);

    photoImageView = (ImageView) findViewById(R.id.driver_photo);
    photoImageView.setOnClickListener(this);

    documentImageView = (ImageView) findViewById(R.id.driver_document);
    documentImageView.setOnClickListener(this);

    document2ImageView = (ImageView) findViewById(R.id.driver_document2);
    document2ImageView.setOnClickListener(this);

    document3ImageView = (ImageView) findViewById(R.id.driver_document3);
    document3ImageView.setOnClickListener(this);

    document4ImageView = (ImageView) findViewById(R.id.driver_document4);
    document4ImageView.setOnClickListener(this);

    getSpinnerData();

    storageRegister();

}

From source file:eu.sathra.SathraActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mCurrentSathra = this;
    mWasInitiated = false;//from  w ww  .java2 s . com

    ResourceManager.getInstance().unloadAll();

    mParams = getParameters();

    if (mParams.fullscreen) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    if (mParams.layout == 0) {
        mSurfaceView = new GLSurfaceView(this);
        setContentView(mSurfaceView);
    } else {
        setContentView(mParams.layout);
        mSurfaceView = (GLSurfaceView) findViewById(R.id.surface);
    }

    mSurfaceView.setRenderer(this);
    mSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    mSurfaceView.setPreserveEGLContextOnPause(true);

    // resize view to forced resolution
    if (mParams.width != 0 && mParams.height != 0)
        mSurfaceView.getHolder().setFixedSize(mParams.width, mParams.height);

    SathraAdapter adapter = new SathraAdapter();

    IO.getInstance().registerAdapter(SathraActivity.class, adapter);
    IO.getInstance().registerAdapter(Context.class, adapter);

    mIsRunning = true;

    // setup FPS view

    showFPS(mParams.showFPS);

    setTimeScale(1);

    setAmbientColor(mParams.ambientColor);

    setRequestedOrientation(
            mParams.orientation == Orientation.VERTICAL ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                    : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    // new CameraNode(this, null, null, true, null, null, null, null);
    // mRootNode.addChild(CameraNode.getActiveCamera());
}

From source file:com.example.android.weatherapp.view.MainActivity.java

/**
 * to prevent crash on screen orientation in middle of network operation
 * we will be locking orientation of the screen temporarily.
 *
 * @author swapnil//w w w  .ja  v a  2s .c  o  m
 */
private void lockScreenOrientation() {
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
}

From source file:com.hypodiabetic.happ.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    activity = this;
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    ins = this;// ww w .  j av  a 2 s.c  o  m
    PreferenceManager.setDefaultValues(this, R.xml.pref_aps, false); //Sets default APS Preferences if the user has not

    //xdrip start
    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    checkEula();

    startService(new Intent(getApplicationContext(), DataCollectionService.class));

    PreferenceManager.setDefaultValues(this, R.xml.pref_general, false);
    PreferenceManager.setDefaultValues(this, R.xml.pref_bg_notification, false);
    //xdrip end

    setContentView(R.layout.activity_main);
    extendedGraphBuilder = new ExtendedGraphBuilder(this);

    //Setup menu
    tickWhite = getDrawable(R.drawable.checkbox_marked_circle);
    clockWhite = getDrawable(R.drawable.clock);
    tickWhite.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
    clockWhite.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);

    insulinIntegrationApp_status = (TextView) findViewById(R.id.insulinIntegrationApp_status);
    insulinIntegrationApp_icon = (ImageView) findViewById(R.id.insulinIntegrationApp_icon);
    mDrawerList = (ListView) findViewById(R.id.navList);
    String[] osArray = { "Cancel Temp", "Settings", "Integration Report" };
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
    mDrawerList.setAdapter(mAdapter);
    mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                pumpAction.cancelTempBasal(MainActivity.activity);
                break;
            case 1:
                startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
                break;
            case 2:
                startActivity(new Intent(getApplicationContext(), Integration_Report.class));
                break;
            }
            mDrawerLayout.closeDrawers();
        }
    });
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer);
    mActivityTitle = getTitle().toString();
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open,
            R.string.drawer_close) {
        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.getInstace());
            Date now = new Date();
            Profile p = new Profile(now, MainActivity.getInstace());
            //Local device based Integrations
            String insulin_Integration_App = prefs.getString("insulin_integration", "");

            //Insulin Integration App, try and connect
            if (!insulin_Integration_App.equals("")) {
                InsulinIntegrationApp insulinIntegrationApp = new InsulinIntegrationApp(
                        MainActivity.getInstace(), insulin_Integration_App, "TEST");
                insulinIntegrationApp.connectInsulinTreatmentApp();
                insulinIntegrationApp_status.setText("Connecting...");
                insulinIntegrationApp_icon.setBackground(clockWhite);

                //listens out for connection
                insulinIntegrationAppUpdate = new BroadcastReceiver() {
                    @Override
                    public void onReceive(Context context, Intent intent) {
                        insulinIntegrationApp_status.setText(intent.getStringExtra("MSG"));
                        insulinIntegrationApp_icon.setBackground(tickWhite);

                    }
                };
                LocalBroadcastManager.getInstance(MainActivity.getInstace()).registerReceiver(
                        insulinIntegrationAppUpdate, new IntentFilter("INSULIN_INTEGRATION_TEST"));
            } else {
                insulinIntegrationApp_status.setText("No app selected or not in Closed Loop");
                insulinIntegrationApp_icon.setBackgroundResource(R.drawable.alert_circle);
            }
        }

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    mDrawerToggle.syncState();
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    // Create the adapter that will return a fragment for each of the 4 primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) this.findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    //mViewPager.setOffscreenPageLimit(4);                                                        //Do not destroy any Fragments, // TODO: 14/09/2015 casues an issue with bvb chart rendering, not sure why
    //Build Fragments
    openAPSFragmentObject = new openAPSFragment();
    iobcobActiveFragmentObject = new iobcobActiveFragment();
    iobcobFragmentObject = new iobcobFragment();
    basalvsTempBasalObject = new basalvsTempBasalFragment();

    //Updates notifications every 60 seconds
    updateEvery60Seconds = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            APSResult apsResult = APSResult.last();
            Notifications.updateCard(context, apsResult);
        }
    };
    registerReceiver(updateEvery60Seconds, new IntentFilter(Intent.ACTION_TIME_TICK));

}

From source file:com.rfo.basic.Web.java

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private void setOrientation(int orientation) { // Convert and apply orientation setting
    switch (orientation) {
    default://from  w ww . ja v a  2s.c  om
    case 1:
        orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        break;
    case 3:
        orientation = (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD)
                ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                : ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        break;
    case 0:
        orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        break;
    case 2:
        orientation = (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD)
                ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                : ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        break;
    case -1:
        orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
        break;
    }
    setRequestedOrientation(orientation);
}

From source file:com.gigigo.vuforia.core.sdkimagerecognition.cloudrecognition.CloudRecognition.java

public void on_Create() {
    try {//from   w  w w.  j a v a 2  s .c  om
        if (this.mLicenseKey == "" || this.mAccessKey == "" || this.mSecretKey == "") {
            Log.e(this.mActivity.getResources().getString(R.string.orchextra_auth_error_tag),
                    this.mActivity.getResources().getString(R.string.orchextra_auth_error_text));
            this.mActivity.finish();
        } else {
            vuforiaAppSession = new VuforiaSession(this, this.mLicenseKey);
            startLoadingAnimation();
            vuforiaAppSession.initAR(this.mActivity, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
            // Creates the GestureDetector listener for processing double tap
            mGestureDetector = new GestureDetector(this.mActivity, new GestureListener());

            mIsDroidDevice = android.os.Build.MODEL.toLowerCase().startsWith("droid");
        }
    } catch (Throwable tr) {
        GGGLogImpl.log(tr.getMessage(), LogLevel.ERROR);
    }
}