Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_SENSOR_LANDSCAPE

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

Introduction

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

Prototype

int SCREEN_ORIENTATION_SENSOR_LANDSCAPE

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

Click Source Link

Document

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

Usage

From source file:Main.java

public static void initialize(Activity activity, int layout) {
    // Do all sorts of common task for your activities here including:
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    activity.setContentView(layout);//from  w ww.ja va  2s . co  m
    activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
    activity.getActionBar().setDisplayOptions(
            ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
    activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

From source file:htw.bui.openreskit.meter.SeriesActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mOverlayFramelayout = new FrameLayout(this);

    setContentView(mOverlayFramelayout);
    View view = getLayoutInflater().inflate(R.layout.series_fragment, mOverlayFramelayout, false);
    mOverlayFramelayout.addView(view);//from  w w w  .  j  a v a 2s  .  c  om
    mContext = this;
    mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false);

    if (Utils.isTablet(this)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }

    ActionBar bar = getActionBar();
    bar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
    bar.setDisplayShowHomeEnabled(true);

    EnterValueFragment enterValueFrag = (EnterValueFragment) mFragMan
            .findFragmentById(R.id.enter_value_fragment);
    if (enterValueFrag != null) {
        enterValueFrag.getView().setVisibility(View.INVISIBLE);
    }

}

From source file:cordova.plugins.screenorientation.CDVOrientation.java

private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) {

    String action = args.optString(0);

    String orientation = args.optString(1);

    Log.d(TAG, "Requested ScreenOrientation: " + orientation);

    Activity activity = cordova.getActivity();

    if (orientation.equals(ANY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (orientation.equals(LANDSCAPE_PRIMARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT_PRIMARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else if (orientation.equals(LANDSCAPE)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    } else if (orientation.equals(LANDSCAPE_SECONDARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT_SECONDARY)) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
    }/*from   w ww  .  j av a2s . co m*/

    callbackContext.success();
    return true;

}

From source file:com.nbplus.vbroadlauncher.fragment.RegisterFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
    }//from   w  ww.j av a2 s .  c om
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    getActivity().setTitle("RegisterFragment");

    if (!NetworkUtils.isConnected(getActivity())) {
        ((BaseActivity) getActivity()).showNetworkConnectionAlertDialog();
        return;
    }
}

From source file:net.yoik.cordova.plugins.screenorientation.YoikScreenOrientation.java

private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext) {

    String action = args.optString(0);

    if (action.equals("set")) {

        String orientation = args.optString(1);

        Log.d(TAG, "Requested ScreenOrientation: " + orientation);

        Activity activity = cordova.getActivity();

        if (orientation.equals(UNLOCKED)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        } else if (orientation.equals(LANDSCAPE_PRIMARY)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        } else if (orientation.equals(PORTRAIT_PRIMARY)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        } else if (orientation.equals(LANDSCAPE)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
        } else if (orientation.equals(PORTRAIT)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
        } else if (orientation.equals(LANDSCAPE_SECONDARY)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        } else if (orientation.equals(PORTRAIT_SECONDARY)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
        }//from w  w w .  j av  a 2  s.  co m

        callbackContext.success();
        return true;

    } else {
        callbackContext.error("ScreenOrientation not recognised");
        return false;
    }
}

From source file:com.vsc.google.api.services.samples.calendar.android.bilik.BaseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    configuration = Configuration.getInstance(this);
    doBindServices();/*from  w  w  w .  j a va 2 s. c o m*/
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}

From source file:com.klinker.android.twitter.ui.drawer_activities.lists.ChoosenListActivity.java

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

    overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);

    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {/*  ww  w .  j  ava2 s .c o m*/
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }

    context = this;
    sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    settings = AppSettings.getInstance(this);

    if (settings.advanceWindowed) {
        setUpWindow();
    }

    Utils.setUpPopupTheme(this, settings);

    actionBar = getActionBar();
    actionBar.setTitle(getResources().getString(R.string.lists));

    setContentView(R.layout.ptr_list_layout);

    if (!settings.isTwitterLoggedIn) {
        Intent login = new Intent(context, LoginActivity.class);
        startActivity(login);
        finish();
    }

    mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    spinner = (LinearLayout) findViewById(R.id.list_progress);

    mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            onRefreshStarted();
        }
    });
    if (settings.addonTheme) {
        mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt,
                SwipeProgressBar.COLOR3);
    } else {
        if (settings.theme != AppSettings.THEME_LIGHT) {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color),
                    SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color),
                    SwipeProgressBar.COLOR3);
        } else {
            mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color),
                    getResources().getColor(R.color.light_ptr_1),
                    context.getResources().getColor(R.color.app_color),
                    getResources().getColor(R.color.light_ptr_2));
        }
    }

    listView = (AsyncListView) findViewById(R.id.listView);

    listView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {

        }

        @Override
        public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount,
                int totalItemCount) {
            final int lastItem = firstVisibleItem + visibleItemCount;
            if (lastItem == totalItemCount && canRefresh) {
                getLists();
            }
        }
    });

    BitmapLruCache cache = App.getInstance(context).getBitmapCache();
    ArrayListLoader loader = new ArrayListLoader(cache, context);

    ItemManager.Builder builder = new ItemManager.Builder(loader);
    builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50);
    builder.setThreadPoolSize(4);

    listView.setItemManager(builder.build());

    listName = getIntent().getStringExtra("list_name");

    listId = Integer.parseInt(getIntent().getStringExtra("list_id"));
    actionBar.setTitle(listName);

    getLists();

    Utils.setActionBar(context);

}

From source file:htw.bui.openreskit.discard.InspectionActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mOverlayFramelayout = new FrameLayout(this);

    setContentView(mOverlayFramelayout);
    View view = getLayoutInflater().inflate(R.layout.inspection_fragment, mOverlayFramelayout, false);
    mOverlayFramelayout.addView(view);// w  w w  .  java2s.  co m
    mContext = this;
    mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
    mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false);
    mInspFrag = (InspectionFragment) mFragMan.findFragmentById(R.id.inspection_fragment);
    mAddInspectionButton = (Button) mOverlayFramelayout.findViewById(R.id.addInspectionButton);
    mAddInspectionButton.setOnClickListener(mButtonListener);

    if (Utils.isTablet(this)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
        if (findViewById(R.id.inspectionLayoutContainer) != null) {
            // if we are being restored from a previous state, then we dont need to do anything and should
            // return or else we could end up with overlapping fragments.
            if (savedInstanceState != null)
                return;

            // Create an instance of inspectionInfoFragment
            mInspectionInfoFragment = new InspectionInfoFragment();
            // Create an instance of RunningInspectionFragment               
            mRunningInspectionFragment = new RunningInspectionFragment();

            // add fragment to the fragment container layout
            FragmentTransaction ft = mFragMan.beginTransaction();
            ft.add(R.id.inspectionFrameLayout, mInspectionInfoFragment);
            ft.hide(mInspectionInfoFragment).commit();

            FragmentTransaction ft1 = mFragMan.beginTransaction();
            ft1.add(R.id.inspectionFrameLayout, mRunningInspectionFragment);
            ft1.hide(mRunningInspectionFragment).commit();
        }
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }

    ActionBar bar = getActionBar();
    bar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
    bar.setDisplayShowHomeEnabled(true);
}

From source file:org.xwalk.runtime.extension.api.screenorientation.ScreenOrientationExtension.java

@Override
public void onMessage(int instanceId, String message) {
    String value = getValueString(message, JS_VALUE_TYPE);
    if (value.isEmpty())
        return;// w w w.jav a  2s . c  o  m

    int orientation;
    try {
        orientation = Integer.valueOf(value);
    } catch (Exception e) {
        e.printStackTrace();
        return;
    }

    int screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    switch (orientation) {
    case ANY:
    case UA_DEFAULTS: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        break;
    }
    case LANDSCAPE_PRIMARY: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
        break;
    }
    case PORTRAIT_PRIMARY: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        break;
    }
    case LANDSCAPE_SECONDARY: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        break;
    }
    case PORTRAIT_SECONDARY: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        break;
    }
    case LANDSCAPE: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
        break;
    }
    case PORTRAIT: {
        screen_orientation_value = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
        break;
    }
    default:
        Log.e(TAG, "Invalid orientation value.");
        return;
    }
    mExtensionContext.getActivity().setRequestedOrientation(screen_orientation_value);
}

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

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    builder = new AlertDialog.Builder(getActivity());
    View signInDialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_sign_in, null);
    builder.setView(signInDialogView);//from w  w  w  .j av  a2s  . c o  m
    builder.setMessage(R.string.upload_your_song);

    checkBox = (CheckBox) signInDialogView.findViewById(R.id.checkBox2);

    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);
    }

    check1 = false;
    check2 = false;
    check3 = false;
    // Log.d(AuthTag, "onCreateDialog " + check1 + " " + check2 + " " + check3);

    this.mGoogleApiClient = OrderActivity.getmGoogleApiClient();
    mAuth = FirebaseAuth.getInstance();

    selectFileButton = (Button) signInDialogView.findViewById(R.id.selectFileButton);
    selectFileButton.setOnClickListener(new customButtonClickListener());

    signInButton = (SignInButton) signInDialogView.findViewById(R.id.sign_in_button);
    signInButton.setStyle(SignInButton.SIZE_WIDE, SignInButton.COLOR_AUTO);
    signInButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            signIn();
        }
    });

    builder.setPositiveButton(getString(R.string.next), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO upload song
        }
    });

    builder.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });

    SpannableString ss = new SpannableString(getString(R.string.you_accepting_license_agreement));
    ClickableSpan clickableSpan = new ClickableSpan() {
        @Override
        public void onClick(View textView) {
            Log.d(AuthTag, "click");
            LicenseDialog licenseDialog = new LicenseDialog();
            licenseDialog.show(getFragmentManager(), "Sing in dialog");
        }

        @Override
        public void updateDrawState(TextPaint ds) {
            super.updateDrawState(ds);
            ds.setUnderlineText(true);
        }
    };
    ss.setSpan(clickableSpan, 14, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    TextView textView = (TextView) signInDialogView.findViewById(R.id.textView);
    textView.setText(ss);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setHighlightColor(Color.TRANSPARENT);

    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            check2 = isChecked;
            Log.d(AuthTag, "Checked: " + isChecked);
            buttonStatus();
        }
    });

    mStorageRef = FirebaseStorage.getInstance().getReference();

    alert = builder.create();
    return alert;
}