Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_UNSPECIFIED

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_UNSPECIFIED

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

Click Source Link

Document

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

Usage

From source file:com.mediatek.miravision.ui.MiraVisionActivity.java

private void selectItem(int position) {
    Log.d(TAG, "selectItem position: " + position);
    DrawerListViewEntry entry = (DrawerListViewEntry) sDrawerListAdapter.getItem(position);
    Fragment fragment = mFragments[(int) entry.mId]; // default fragment
    int orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; // default
    // LANDSCAPE/*  w w w.jav  a  2  s.c  om*/

    if (fragment instanceof ResetDialogFragment) {
        ResetDialogFragment resetDialog = (ResetDialogFragment) fragment;
        resetDialog.setResetListener(new ResetListener() {
            @Override
            public void reset() {
                resetPQ();
                getActionBar().setTitle(R.string.mira_vision_tm);
                show(getFragmentManager(), new IntroductionFragment(),
                        ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
            }
        });
        resetDialog.show(getFragmentManager(), null);
        mDrawerList.setItemChecked(position, true);
        mDrawerLayout.closeDrawer(mDrawerList);
        return;
    }

    // AAL and picture mode is UNSPECIFIED
    if (fragment instanceof AalSettingsFragment || fragment instanceof PictureModeFragment) {
        orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    // Basic and Advance tuning need know which item being selected
    if (fragment instanceof BasicColorTuningFragment) {
        fragment = new BasicColorTuningFragment(entry.mTitle);
    } else if (fragment instanceof AdvanceColorTuningFragment) {
        fragment = new AdvanceColorTuningFragment(entry.mTitle);
    }
    show(getFragmentManager(), fragment, orientation);

    mDrawerList.setItemChecked(position, true);
    setTitle(entry.mFragmentTitle);
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:ru.neverdark.phototools.fragments.TitlesFragment.java

/**
 * Replace current fragment to other/*from   ww  w  .  java 2 s . c  om*/
 * 
 * @param index
 *            index fragment
 */
private void replaceFragment(int index) {
    Log.message("Enter");
    boolean isOperationNeed = false;
    Fragment details = getFragmentManager().findFragmentById(R.id.main_detailFragment);

    switch (index) {
    case Constants.DOF_CHOICE:
        if ((details instanceof DofFragment) == false) {
            details = new DofFragment();
            isOperationNeed = true;
            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }
        break;
    case Constants.EV_CHOICE:
        if ((details instanceof EvpairsFragment) == false) {
            details = new EvpairsFragment();
            isOperationNeed = true;
            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }
        break;
    case Constants.SUNSET_CHOICE:
        if ((details instanceof SunsetFragment) == false) {
            details = new SunsetFragment();
            isOperationNeed = true;
            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        }
        break;
    case Constants.ABOUT_CHOICE:
        if ((details instanceof AboutFragment) == false) {
            details = new AboutFragment();
            isOperationNeed = true;
            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        }
        break;
    case Constants.PLUGIN_CHOICE:
        if ((details instanceof PluginsFragment) == false) {
            details = new PluginsFragment();
            isOperationNeed = true;
            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        }
        break;
    }

    if (isOperationNeed == true) {
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.main_detailFragment, details);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        ft.commit();
    }
}

From source file:com.cypress.cysmart.HomePageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isTablet(this)) {
        Logger.d("tablet");
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else {//from  w w w . j  a  v a2s  .com
        Logger.d("Phone");
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    setContentView(R.layout.activity_main);
    Paired = getResources().getString(R.string.bluetooth_pair);
    Unpaired = getResources().getString(R.string.bluetooth_unpair);
    parentView = (DrawerLayout) findViewById(R.id.drawer_layout);
    containerView = (FrameLayout) findViewById(R.id.container);
    mpdia = new ProgressDialog(this);
    mpdia.setCancelable(false);
    mAlert = new AlertDialog.Builder(this).create();
    mAlert.setMessage(getResources().getString(R.string.alert_message_bluetooth_reconnect));
    mAlert.setCancelable(false);
    mAlert.setTitle(getResources().getString(R.string.app_name));
    mAlert.setButton(Dialog.BUTTON_POSITIVE, getResources().getString(R.string.alert_message_exit_ok),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    Intent intentActivity = getIntent();
                    finish();
                    overridePendingTransition(R.anim.slide_left, R.anim.push_left);
                    startActivity(intentActivity);
                    overridePendingTransition(R.anim.slide_right, R.anim.push_right);
                }
            });
    mAlert.setCanceledOnTouchOutside(false);
    getTitle();

    // Getting the id of the navigation fragment from the attached xml
    mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));

    Intent gattServiceIntent = new Intent(getApplicationContext(), BluetoothLeService.class);
    startService(gattServiceIntent);

    /**
     * Attaching the profileScanning fragment to start scanning for nearby
     * devices
     */
    ProfileScanningFragment profileScanningFragment = new ProfileScanningFragment();
    displayView(profileScanningFragment, Constants.PROFILE_SCANNING_FRAGMENT_TAG);

}

From source file:com.glacialsoftware.googolplex.GoogolplexDisplayActivity.java

@Override
public void updateOrientation(Boolean newValue) {
    if (newValue) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {//from  w  w  w. j  a v a2  s  .c  o  m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:com.mediatek.miravision.ui.MiraVisionActivity.java

@Override
public void onBackPressed() {
    if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
        mDrawerLayout.closeDrawer(mDrawerList);
        return;/*from w  w w  . j  a va  2  s.  co m*/
    }

    if (getFragmentManager().findFragmentById(R.id.content_frame) instanceof IntroductionFragment) {
        super.onBackPressed();
    } else {
        mDrawerLayout.openDrawer(mDrawerList);
        show(getFragmentManager(), new IntroductionFragment(), ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }
}

From source file:com.jecelyin.editor.v2.ui.MainActivity.java

private void setScreenOrientation() {
    int orgi = pref.getScreenOrientation();

    if (Pref.SCREEN_ORIENTATION_AUTO == orgi) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (Pref.SCREEN_ORIENTATION_LANDSCAPE == orgi) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (Pref.SCREEN_ORIENTATION_PORTRAIT == orgi) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }/*from w  w w  .  j av a  2  s  .  co  m*/
}

From source file:de.schildbach.wallet.ui.scan.ScanActivity.java

@Override
protected void onDestroy() {
    // cancel background thread
    cameraHandler.removeCallbacksAndMessages(null);
    cameraThread.quit();/*from   w w  w.  j a  v a  2s  .  com*/

    previewView.setSurfaceTextureListener(null);

    // We're removing the requested orientation because if we don't, somehow the requested orientation is
    // bleeding through to the calling activity, forcing it into a locked state until it is restarted.
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    super.onDestroy();
}

From source file:com.infthink.demo.webrtc.MainActivity.java

@Override
public void onParamInitDone(SignalingParameters params) {

    // TODO Auto-generated method stub
    logAndToast("onInitDone...");

    if (mAudioManager != null) {
        // Store existing audio settings and change audio mode to
        // MODE_IN_COMMUNICATION for best possible VoIP performance.
        logAndToast("Initializing the audio manager...");
        mAudioManager.init();//from   www  .  j  a v  a  2 s  . c  om
    }
    mSignalingParameters = params;
    abortUnless(PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true,
            VideoRendererGui.getEGLContext()), "Failed to initializeAndroidGlobals");
    logAndToast("Creating peer connection...");
    if (mPeerConn != null) {
        mPeerConn.close();
        mPeerConn = null;
    }

    mPeerConn = new PeerConnectionClient(this, mLocalRender, mRemoteRender, mSignalingParameters, this,
            mStartBitrate);
    /*
     * if (mPeerConn.isHDVideo()) {
     * setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
     * else {
     * setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
     * }
     */
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    if (mApiClient != null && mApiClient.isConnected()) {
        mPeerConn.createOffer();
    }
    // if (mApiClient != null && mApiClient.isConnected()) {
    // mWebrtcChannel.sendHello(mApiClient);
    // }
}

From source file:com.nextgis.maplibui.util.ControlHelper.java

public static void unlockScreenOrientation(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}

From source file:com.github.guwenk.smuradio.SignInDialog.java

private void uploadFile() {

    if (filepath != null) {
        Log.d(AuthTag, "UPLOAD FILE " + filepath);

        final ProgressDialog progressDialog = new ProgressDialog(getActivity());
        progressDialog.setTitle(getString(R.string.uploading));
        progressDialog.setCancelable(false);
        progressDialog.show();/*from  w w  w . ja v  a  2s  .  c o  m*/

        int currentOrientation = getResources().getConfiguration().orientation;
        if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
        } else {
            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
        }

        Log.d(AuthTag, "UPLOAD FILE progress dialog showing");

        StorageReference musicRef = mStorageRef.child("audio/" + songTitle);

        Log.d(AuthTag, "UPLOAD FILE storage referense: " + musicRef);

        try {
            user = mAuth.getCurrentUser();
        } catch (Exception ignored) {
        }

        StorageMetadata metadata = new StorageMetadata.Builder().setCustomMetadata("By", user.getUid()).build();

        musicRef.putFile(filepath, metadata)
                .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                    @Override
                    public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                        // if upload success
                        progressDialog.dismiss();
                        Toast.makeText(getActivity(), R.string.file_uploaded, Toast.LENGTH_SHORT).show();
                        alert.dismiss();
                        Log.d(AuthTag, "UPLOAD FILE success");
                        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
                    }
                }).addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception exception) {
                        // if upload failed
                        progressDialog.dismiss();
                        Toast.makeText(getActivity(),
                                getString(R.string.uploading_error) + exception.getMessage(),
                                Toast.LENGTH_SHORT).show();
                        alert.dismiss();
                        Log.d(AuthTag, "UPLOAD FILE FAILED");
                        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
                    }
                }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
                    @Override
                    public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
                        double progress = (100.0 * taskSnapshot.getBytesTransferred())
                                / taskSnapshot.getTotalByteCount();
                        try {
                            progressDialog.setMessage((int) progress + getString(R.string.uploaded_procents));
                            Log.d(AuthTag, "UPLOAD FILE progress update: " + progress);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
    } else {
        Toast.makeText(getActivity(), R.string.wrong_file, Toast.LENGTH_SHORT).show();
    }
}