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:org.wso2.iot.agent.activities.AuthenticationActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {/*from w  w w  .j  av a2s.c om*/
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }

    setContentView(R.layout.activity_authentication);
    RelativeLayout relativeLayout = (RelativeLayout) this.findViewById(R.id.relavtiveLayoutAuthentication);

    if (Constants.DEFAULT_OWNERSHIP.equals(Constants.OWNERSHIP_COSU)) {
        relativeLayout.setVisibility(RelativeLayout.GONE);
    }
    deviceInfo = new DeviceInfo(context);
    etDomain = (EditText) findViewById(R.id.etDomain);
    etUsername = (EditText) findViewById(R.id.etUsername);
    etPassword = (EditText) findViewById(R.id.etPassword);
    etDomain.setFocusable(true);
    etDomain.requestFocus();
    btnSignIn = (Button) findViewById(R.id.btnSignIn);
    btnSignIn.setOnClickListener(onClickAuthenticate);
    btnSignIn.setEnabled(false);

    // change button color background till user enters a valid input
    btnSignIn.setBackgroundResource(R.drawable.btn_grey);
    btnSignIn.setTextColor(ContextCompat.getColor(this, R.color.black));
    TextView textViewSignIn = (TextView) findViewById(R.id.textViewSignIn);
    LinearLayout loginLayout = (LinearLayout) findViewById(R.id.loginLayout);

    if (Preference.hasPreferenceKey(context, Constants.TOKEN_EXPIRED)) {
        etDomain.setEnabled(false);
        etDomain.setTextColor(ContextCompat.getColor(this, R.color.black));
        etUsername.setEnabled(false);
        etUsername.setTextColor(ContextCompat.getColor(this, R.color.black));
        btnSignIn.setText(R.string.btn_sign_in);
        etPassword.setFocusable(true);
        etPassword.requestFocus();
        String tenantedUserName = Preference.getString(context, Constants.USERNAME);
        int tenantSeparator = tenantedUserName.lastIndexOf('@');
        etUsername.setText(tenantedUserName.substring(0, tenantSeparator));
        etDomain.setText(tenantedUserName.substring(tenantSeparator + 1, tenantedUserName.length()));
        isReLogin = true;
        textViewSignIn.setText(R.string.msg_need_to_sign_in);
    } else if (Constants.CLOUD_MANAGER != null) {
        isCloudLogin = true;
        etDomain.setVisibility(View.GONE);
        textViewSignIn.setText(R.string.txt_sign_in_cloud);
    }

    if (Preference.getBoolean(context, Constants.PreferenceFlag.DEVICE_ACTIVE) && !isReLogin) {
        Intent intent = new Intent(AuthenticationActivity.this, AlreadyRegisteredActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        finish();
        return;
    }

    TextView textViewSignUp = (TextView) findViewById(R.id.textViewSignUp);
    if (!isReLogin && Constants.SIGN_UP_URL != null) {
        Linkify.TransformFilter transformFilter = new Linkify.TransformFilter() {
            @Override
            public String transformUrl(Matcher match, String url) {
                return Constants.SIGN_UP_URL;
            }
        };
        Pattern pattern = Pattern.compile(getResources().getString(R.string.txt_sign_up_linkify));
        Linkify.addLinks(textViewSignUp, pattern, null, null, transformFilter);
    } else {
        textViewSignUp.setVisibility(View.GONE);
    }

    if (Constants.HIDE_LOGIN_UI) {
        loginLayout.setVisibility(View.GONE);
    }

    if (Constants.OWNERSHIP_COSU.equals(Constants.DEFAULT_OWNERSHIP)) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            startLockTask();
        }
    }

    TextView textViewWipeData = (TextView) this.findViewById(R.id.textViewWipeData);
    if (Constants.OWNERSHIP_COSU.equals(Constants.DEFAULT_OWNERSHIP) && Constants.DISPLAY_WIPE_DEVICE_BUTTON) {
        textViewWipeData.setVisibility(View.VISIBLE);
        textViewWipeData.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                new AlertDialog.Builder(AuthenticationActivity.this).setTitle(getString(R.string.app_name))
                        .setMessage(R.string.wipe_confirmation)
                        .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                                DevicePolicyManager devicePolicyManager = (DevicePolicyManager) getApplicationContext()
                                        .getSystemService(Context.DEVICE_POLICY_SERVICE);
                                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
                                    devicePolicyManager.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE
                                            | DevicePolicyManager.WIPE_RESET_PROTECTION_DATA);
                                } else {
                                    devicePolicyManager.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE);
                                }
                            }
                        }).setNegativeButton(android.R.string.no, null).show();
            }
        });
    }

    ImageView logo = (ImageView) findViewById(R.id.imageViewLogo);
    if (Constants.COSU_SECRET_EXIT) {
        logo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                kioskExit++;
                if (kioskExit == 6) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                        stopLockTask();
                    }
                    finish();
                }
            }
        });
    }

    etUsername.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            enableSubmitIfReady();
        }

        @Override
        public void afterTextChanged(Editable s) {
            enableSubmitIfReady();
        }
    });

    etPassword.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            enableSubmitIfReady();
        }

        @Override
        public void afterTextChanged(Editable s) {
            enableSubmitIfReady();
        }
    });

    if (org.wso2.iot.agent.proxy.utils.Constants.Authenticator.AUTHENTICATOR_IN_USE
            .equals(org.wso2.iot.agent.proxy.utils.Constants.Authenticator.MUTUAL_SSL_AUTHENTICATOR)) {

        AuthenticatorFactory authenticatorFactory = new AuthenticatorFactory();
        ClientAuthenticator authenticator = authenticatorFactory.getClient(
                org.wso2.iot.agent.proxy.utils.Constants.Authenticator.AUTHENTICATOR_IN_USE,
                AuthenticationActivity.this, Constants.AUTHENTICATION_REQUEST_CODE);
        authenticator.doAuthenticate();
    }

    //This is an override to ownership type.
    if (Constants.DEFAULT_OWNERSHIP != null) {
        deviceType = Constants.DEFAULT_OWNERSHIP;
        Preference.putString(context, Constants.DEVICE_TYPE, deviceType);
    } else {
        deviceType = Constants.OWNERSHIP_BYOD;
    }

    if (Constants.OWNERSHIP_COSU.equals(Constants.DEFAULT_OWNERSHIP)) {
        Intent intent = getIntent();
        if (intent.hasExtra("android.app.extra.token")) {
            adminAccessToken = intent.getStringExtra("android.app.extra.token");
            proceedToAuthentication();
        }
    }

    // This is added so that in case due to an agent customisation, if the authentication
    // activity is called the AUTO_ENROLLMENT_BACKGROUND_SERVICE_ENABLED is set, the activity
    // must be finished.
    if (Constants.AUTO_ENROLLMENT_BACKGROUND_SERVICE_ENABLED) {
        finish();
    }
}

From source file:edu.pitt.cidde.portico.ViewPagerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_pager);

    // Load up the intent data passed in from the parent activity
    parentIntentViewType = getIntent().getIntExtra("intType", 0); // formerly
    // intLetterData
    getIntent().getStringExtra("strURL");

    // force portrait orientation. Do this for now as...
    // 1) it is a quick fix to get around the lost image issue with changing
    // to landscape and/or
    // 2) In the FUTURE, it will be difficult for CIDDE to contend with
    // creating XML pages
    // that would support two orientations. By forcing it to portrait, it
    // eliminates this issue.
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // only
    // accept/*from  ww w .jav a2s.  c  o  m*/
    // portrait
    // alternately, add the following to the manifiest for this activity to
    // lock portrait:
    // android:screenOrientation="portrait"
    // android:configChanges="orientation|keyboardHidden"

    // Log.i("DEBUG","onCreate-1");

    // Create the adapter that returns the fragment for each of the pages
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Log.i("DEBUG","onCreate-2");

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(0);

    // Log.i("DEBUG","onCreate-3");

}

From source file:com.CloudRecognition.CloudReco.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d(LOGTAG, "onCreate");
    super.onCreate(savedInstanceState);
    comm = new ConexionSiabra(this);
    vuforiaAppSession = new SampleApplicationSession(this);

    startLoadingAnimation();/*w w w  .  j a  v a  2  s. c  o  m*/

    vuforiaAppSession.initAR(this, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // Creates the GestureDetector listener for processing double tap
    mGestureDetector = new GestureDetector(this, new GestureListener());

    mIsDroidDevice = android.os.Build.MODEL.toLowerCase().startsWith("droid");

}

From source file:info.zamojski.soft.towercollector.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(MyApplication.getCurrentAppTheme());
    super.onCreate(savedInstanceState);
    Log.d("onCreate(): Creating activity");
    // set fixed screen orientation
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.main);//from  www.j  av  a2 s  .c o m
    //setup toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
    setSupportActionBar(toolbar);
    // setup tabbed layout
    pageAdapter = new MainActivityPagerAdapter(getSupportFragmentManager(), getApplication());
    viewPager = (ViewPager) findViewById(R.id.main_pager);
    viewPager.setAdapter(pageAdapter);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.main_tab_layout);
    tabLayout.setupWithViewPager(viewPager);

    tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        @Override
        public void onTabSelected(Tab tab) {
            Log.d("onTabSelected() Switching to tab %s", tab.getPosition());
            // switch to page when tab is selected
            viewPager.setCurrentItem(tab.getPosition());
        }

        @Override
        public void onTabUnselected(Tab tab) {
            // nothing
        }

        @Override
        public void onTabReselected(Tab tab) {
            // nothing
        }
    });

    backgroundTaskHelper = new BackgroundTaskHelper(this);

    displayNotCompatibleDialog();

    // show latest developer's messages
    displayDevelopersMessages();

    // show introduction
    displayIntroduction();

    processOnStartIntent(getIntent());

    // check for availability of new version
    checkForNewVersionAvailability();
}

From source file:br.com.rescue_bots_android.bluetooth.MainActivity.java

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

    setContentView(R.layout.activity_main_blue);

    ActivityHelper.initialize(this);

    routeController = new RouteController(this);
    coordinates = new ArrayList<Path>();

    trackerController = new TrackerController(this);

    Intent intent = getIntent();/*  ww w.j ava2  s .  co m*/
    Bundle b = intent.getExtras();
    mDevice = b.getParcelable(Homescreen.DEVICE_EXTRA);
    mDeviceUUID = UUID.fromString(b.getString(Homescreen.DEVICE_UUID));
    mMaxChars = b.getInt(Homescreen.BUFFER_SIZE);

    Log.d(TAG, "Ready");

    mBtnDisconnect = (Button) findViewById(R.id.btnDisconnect);
    mBtnSend = (Button) findViewById(R.id.btnSend);
    mBtnClear = (Button) findViewById(R.id.btnClear);
    mTxtReceive = (TextView) findViewById(R.id.txtReceive);
    mEditSend = (EditText) findViewById(R.id.editSend);
    scrollView = (ScrollView) findViewById(R.id.viewScroll);
    chkScroll = (CheckBox) findViewById(R.id.chkScroll);
    chkReceiveText = (CheckBox) findViewById(R.id.chkReceiveText);
    checkBoxJoystickEnable = (CheckBox) findViewById(R.id.checkBoxJoystickEnable);
    mBtnClearInput = (Button) findViewById(R.id.btnClearInput);
    mBtnConfig = (Button) findViewById(R.id.buttonConfig2);
    //imageButtonClaw (Button)findViewById(R.id.imageButtonClaw);
    editTextAngle = (TextView) findViewById(R.id.editTextAngle);
    joystickView = (JoystickView) findViewById(R.id.viewJoystick);
    //Event listener that always returns the variation of the angle in degrees, motion power in percentage and direction of movement
    ibClaw = (ImageButton) findViewById(R.id.imageButtonClaw);
    clawControll = new ClawControll(ibClaw);

    joystickView.setOnJoystickMoveListener(new OnJoystickMoveListener() {

        @Override
        public void onValueChanged(int angle, int power, int direction) {
            // TODO Auto-generated method stub
            mTxtReceive.append(" " + String.valueOf(angle) + "");
            mTxtReceive.append(" " + String.valueOf(power) + "%");
            switch (direction) {
            case JoystickView.FRONT:
                mTxtReceive.append("FRONT");
                sendSerial("a");
                break;
            case JoystickView.FRONT_RIGHT:
                mTxtReceive.append("FRONT_RIGHT");
                sendSerial("c");
                break;
            case JoystickView.RIGHT:
                mTxtReceive.append("RIGHT");
                sendSerial("c");
                break;
            case JoystickView.RIGHT_BOTTOM:
                mTxtReceive.append("RIGHT_BOTTOM");
                sendSerial("f");
                break;
            case JoystickView.BOTTOM:
                mTxtReceive.append("BOTTOM");
                sendSerial("d");
                break;
            case JoystickView.BOTTOM_LEFT:
                mTxtReceive.append("BOTTOM_LEFT");
                sendSerial("e");
                break;
            case JoystickView.LEFT:
                mTxtReceive.append("LEFT");
                sendSerial("b");
                break;
            case JoystickView.LEFT_FRONT:
                mTxtReceive.append("LEFT_FRONT");
                sendSerial("b");
                break;
            default:
                mTxtReceive.append("CENTER");
                sendSerial("g");
            }
        }
    }, JoystickView.DEFAULT_LOOP_INTERVAL);

    mTxtReceive.setMovementMethod(new ScrollingMovementMethod());

    mBtnDisconnect.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mIsUserInitiatedDisconnect = true;
            new DisConnectBT().execute();
        }
    });

    mBtnSend.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            try {
                mBTSocket.getOutputStream().write(mEditSend.getText().toString().getBytes());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });

    mBtnClear.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            mEditSend.setText("");
        }
    });

    mBtnClearInput.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            //mTxtReceive.setText("");
            if (mBtnClearInput.getText().toString().equalsIgnoreCase(LocationManager.GPS_PROVIDER)) {
                mBtnClearInput.setText(LocationManager.NETWORK_PROVIDER);
                gps.setProvider(LocationManager.NETWORK_PROVIDER);
            } else {
                mBtnClearInput.setText(LocationManager.GPS_PROVIDER);
                gps.setProvider(LocationManager.GPS_PROVIDER);
            }
        }
    });
    mBtnConfig.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent i = new Intent(MainActivity.this, ConfigActivity.class);
            startActivity(i);
        }
    });

    ibClaw.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (clawControll != null) {
                clawControll.changeState();
            }
        }
    });
    checkBoxJoystickEnable.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (checkBoxJoystickEnable.isChecked()) {
                joystickEnabled = true;
                joystickView.setEnabled(true);
                ibClaw.setEnabled(true);
            } else {
                joystickEnabled = false;
                joystickView.setEnabled(false);
                ibClaw.setEnabled(false);
            }
        }
    });
    joystickView.setEnabled(true);
    ibClaw.setEnabled(true);

    initGPSListener();

    // initialize your android device sensor capabilities
    mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    image = (ImageView) findViewById(R.id.compassImg);

}

From source file:org.mitre.svmp.activities.AppRTCActivity.java

private int getDeviceDefaultOrientation() {
    WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
    Configuration config = getResources().getConfiguration();
    int rotation = windowManager.getDefaultDisplay().getRotation();

    int value = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    if (((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180)
            && config.orientation == Configuration.ORIENTATION_LANDSCAPE)
            || ((rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270)
                    && config.orientation == Configuration.ORIENTATION_PORTRAIT))
        value = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;

    return value;
}

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

protected void on_Resume() {
    // This is needed for some Droid devices to force portrait
    if (mIsDroidDevice) {
        this.mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        this.mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }/*from  ww w  .  jav a2s.c o  m*/

    try {
        if (vuforiaAppSession != null)
            vuforiaAppSession.resumeAR();
    } catch (VuforiaException e) {
        GGGLogImpl.log(e.getString(), LogLevel.ERROR);
    }

    // Resume the GL view:
    if (mGlView != null) {
        mGlView.setVisibility(View.VISIBLE);
        mGlView.onResume();
    }
}

From source file:com.vishwa.pinit.MainActivity.java

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

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    mFrameLayout = new FrameLayout(this);

    if (getResources().getBoolean(R.bool.portrait_only)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }/*www  .j a  v  a  2s . c  o  m*/

    setContentView(mFrameLayout);

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.activity_main, mFrameLayout);

    inflater.inflate(R.layout.splash_screen, mFrameLayout);
    mHandler = new Handler();
    final Runnable runnable = new Runnable() {

        @Override
        public void run() {
            Animation fadeOutAnimation = AnimationUtils.loadAnimation(getApplicationContext(),
                    android.R.anim.fade_out);
            fadeOutAnimation.setAnimationListener(new AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    mFrameLayout.removeViewAt(1);
                    if (PinItUtils.isUsersFirstLogin(mCurrentUsername, getApplicationContext())) {
                        if (!DEBUG) {
                            handleUsersFirstTime();
                        }
                    }
                }
            });
            mFrameLayout.getChildAt(1).startAnimation(fadeOutAnimation);
        }

    };
    mHandler.postDelayed(runnable, 2300);

    mCurrentUsername = ParseUser.getCurrentUser().getUsername();

    final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);

    final int cacheSize = maxMemory / 10;

    RetainFragment mRetainFragment = RetainFragment.findOrCreateRetainFragment(getSupportFragmentManager());
    mMemoryCache = mRetainFragment.mRetainedCache;
    if (mMemoryCache == null) {
        mMemoryCache = new LruCache<String, Bitmap>(cacheSize) {
            @Override
            protected int sizeOf(String key, Bitmap bitmap) {
                return bitmap.getByteCount() / 1024;
            }
        };
        mRetainFragment.mRetainedCache = mMemoryCache;
    }

    mAllNotesButton = (Button) findViewById(R.id.main_all_notes_button);
    mYourNotesButton = (Button) findViewById(R.id.main_your_notes_button);

    setProgressBarIndeterminateVisibility(false);

    mAllNotesButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            LatLngBounds mapBounds = mMap.getProjection().getVisibleRegion().latLngBounds;
            LatLng southwest = mapBounds.southwest;
            LatLng northeast = mapBounds.northeast;

            mMapViewMode = MapViewMode.ALL_NOTES;

            for (Marker marker : mMarkerList) {
                marker.remove();
            }

            mMarkerList.clear();
            mNoteStore.clear();
            mReverseNoteStore.clear();

            LatLngTuple tuple = new LatLngTuple(southwest, northeast);
            LoadNotesTask currentUserNotesTask = new LoadNotesTask(tuple, false);
            currentUserNotesTask.execute();
            setProgressBarIndeterminateVisibility(true);
        }
    });

    mYourNotesButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            LatLngBounds mapBounds = mMap.getProjection().getVisibleRegion().latLngBounds;
            LatLng southwest = mapBounds.southwest;
            LatLng northeast = mapBounds.northeast;

            for (Marker marker : mMarkerList) {
                marker.remove();
            }

            mMarkerList.clear();
            mNoteStore.clear();
            mReverseNoteStore.clear();

            mMapViewMode = MapViewMode.YOUR_NOTES;
            LatLngTuple tuple = new LatLngTuple(southwest, northeast);
            LoadNotesTask currentUserNotesTask = new LoadNotesTask(tuple, true);
            currentUserNotesTask.execute();
            setProgressBarIndeterminateVisibility(true);
        }
    });

    try {
        MapsInitializer.initialize(this);
        if (!PinItUtils.isOnline(getApplicationContext())) {
            PinItUtils.createAlert("Internet connection not found.",
                    "Connect to the Internet and press the refresh button at the top", this);
            mHasInternet = false;
        } else {
            mHasInternet = true;
            loadMapWhenOnline();
        }
    } catch (GooglePlayServicesNotAvailableException e) {
        PinItUtils.createAlert("We're sorry",
                "It seems that your phone doesn't have Google Play"
                        + "services installed, or is missing the maps application. Please download both of"
                        + "these and then try running this application",
                MainActivity.this);
    }

}

From source file:general.me.edu.dgtmovil.dgtmovil.formregisestudiante.FormEstudDosFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_form_estud_dos, container, false);
    deco = new LectorCedulasDeco();
    obli_cuatro = (TextView) view.findViewById(R.id.p9_obligatorio);

    addDesSiete = (ImageView) view.findViewById(R.id.btn_addComCole);
    addDesSiete.setOnClickListener(this);
    addDesNueve = (ImageView) view.findViewById(R.id.btn_addComEmail);
    addDesNueve.setOnClickListener(this);
    addDesDiez = (ImageView) view.findViewById(R.id.btn_addComTrama);
    addDesDiez.setOnClickListener(this);

    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    p10 = (EditText) view.findViewById(R.id.p10);
    p11 = (EditText) view.findViewById(R.id.p11);
    p9 = (Spinner) view.findViewById(R.id.p9);

    lp9 = (TextView) view.findViewById(R.id.lp9);
    lp10 = (TextView) view.findViewById(R.id.lp10);
    lp11 = (TextView) view.findViewById(R.id.lp11);

    bt_guardar = (Button) view.findViewById(R.id.buttonGuardar);
    leerCedula = (ImageView) view.findViewById(R.id.leer_cedula);
    leerCedula.setOnClickListener(this);
    Bundle bundle = getActivity().getIntent().getExtras();
    //Construimos el mensaje a mostrar

    //CODIGO PARA LA FOTO
    btnFoto = (ImageView) view.findViewById(R.id.btn_foto);
    btnFoto.setOnClickListener(new View.OnClickListener() {
        @Override/*from  w  w w .j  ava2  s . c o m*/
        public void onClick(View v) {
            Intent goCamara = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(goCamara, CONS);
        }
    });

    idUsuario = bundle.getString("idUsuario");
    idPerfil = bundle.getString("perfil");
    idEntidad = bundle.getString("idEntidad");
    idFormulario = bundle.getString("idFormulario");
    gestionDatos = new GestionDatos(getActivity());
    crearBaseDatos();
    gestionDatos.sentencias = sentencias;
    firma = (ImageView) view.findViewById(R.id.img_firma);
    firma.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Bundle b = new Bundle();
            b.putString("img", "imgSola");
            Intent intent = new Intent(getActivity(), CaptureSignature.class);
            intent.putExtras(b);
            startActivityForResult(intent, SIGNATURE_ACTIVITY);
        }
    });
    preguntas = gestionDatos.listarPreguntas(idFormulario);
    opciones = gestionDatos.listarOpciones(idEntidad);

    if (preguntas != null && preguntas.length > 0) {
        Pregunta pre = getPregunta("9");
        lp9.setText(pre.DESCRIPCION);
        pre = getPregunta("10");
        lp10.setText(pre.DESCRIPCION);
        pre = getPregunta("11");
        lp11.setText(pre.DESCRIPCION);

        fijarOpciones("9", p9);
        ;
    }

    bt_guardar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            guardarFormulario();
        }
    });
    return view;
}

From source file:net.reichholf.dreamdroid.activities.VirtualRemoteActivity.java

/**
 * Apply Gui-Element-Attributes and register OnClickListeners in dependence
 * of the active layout (Standard or QuickZap)
 *//*from  w  ww.  j  a v  a  2s . com*/
private void reinit() {
    if (mQuickZap) {
        setContentView(R.layout.virtual_remote_quick_zap);
        mBaseTitle = getString(R.string.app_name) + " - " + getString(R.string.quickzap);
    } else {
        setContentView(R.layout.virtual_remote);
        mBaseTitle = getString(R.string.app_name) + " - " + getString(R.string.virtual_remote);
    }
    setTitle(mBaseTitle);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    registerButtons(mButtonsCommon);
    if (!mQuickZap) {
        registerButtons(mButtonsStandard);
    }
}