Example usage for android.content.res Configuration ORIENTATION_UNDEFINED

List of usage examples for android.content.res Configuration ORIENTATION_UNDEFINED

Introduction

In this page you can find the example usage for android.content.res Configuration ORIENTATION_UNDEFINED.

Prototype

int ORIENTATION_UNDEFINED

To view the source code for android.content.res Configuration ORIENTATION_UNDEFINED.

Click Source Link

Document

Constant for #orientation : a value indicating that no value has been set.

Usage

From source file:com.shipdream.lib.android.mvc.samples.note.view.fragment.MainFragment.java

@Override
public void onViewReady(View view, Bundle savedInstanceState, Reason reason) {
    super.onViewReady(view, savedInstanceState, reason);
    toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    drawerLayout = (DrawerLayout) view.findViewById(R.id.drawer_container);
    mainContainer = (ViewGroup) view.findViewById(R.id.main_container);
    navContainer = (ViewGroup) view.findViewById(R.id.nav_container);
    drawerToggle = new ActionBarDrawerToggle(this.getActivity(), drawerLayout, R.string.app_name,
            R.string.app_name);//from  www  .  ja  v a  2 s .c  o  m
    drawerLayout.setDrawerListener(drawerToggle);

    navHome = navContainer.findViewById(R.id.nav_item_home);
    navHome.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /**
             * Note the 3rd parameter which indicates navigating to locations on main menu will
             * clear all history where back key will exit the app
             */
            navigationController.navigateTo(v, LocId.NOTE_HANDSET_LIST, null);
            drawerLayout.closeDrawers();
        }
    });

    navWeather = navContainer.findViewById(R.id.nav_item_weather);
    navContainer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /**
             * Note the 3rd parameter which indicates navigating to locations on main menu will
             * clear all history where back key will exit the app
             */
            navigationController.navigateTo(v, LocId.WEATHERS, null);
            drawerLayout.closeDrawers();
        }
    });

    updateNavigationUi();

    appController.notifyOrientationChanged(convertOrientation(Configuration.ORIENTATION_UNDEFINED),
            convertOrientation(getCurrentOrientation()));
}

From source file:org.mozilla.gecko.home.RemoteTabsPanel.java

private void showSubPanel(Account account) {
    final Action actionNeeded = getActionNeeded(account);
    final String actionString = actionNeeded != null ? actionNeeded.name() : NO_ACCOUNT;
    final int orientation = HardwareUtils.isTablet()
            ? GeckoScreenOrientation.getInstance().getAndroidOrientation()
            : Configuration.ORIENTATION_UNDEFINED;

    // Check if fragment for given action and orientation is in the back-stack.
    final Pair<String, Integer> actionOrientationPair = getActionAndOrientationForFragmentInBackStack();
    if (actionOrientationPair != null && actionOrientationPair.first.equals(actionString)
            && (actionOrientationPair.second == orientation)) {
        return;//from   w  ww  . j av  a 2 s .c om
    }

    // Instantiate the fragment for the action and update the arguments.
    Fragment subPanel = makeFragmentForAction(actionNeeded);
    final Bundle args = new Bundle();
    args.putBoolean(HomePager.CAN_LOAD_ARG, getCanLoadHint());
    args.putString(FRAGMENT_ACTION, actionString);
    args.putInt(FRAGMENT_ORIENTATION, orientation);
    subPanel.setArguments(args);

    // Add the fragment to the back-stack.
    getChildFragmentManager().beginTransaction().addToBackStack(null)
            .replace(R.id.remote_tabs_container, subPanel, FRAGMENT_TAG).commitAllowingStateLoss();
}

From source file:count.ly.messaging.CrashDetails.java

/**
 * Returns the current device orientation.
 *//*from ww  w  .jav  a2s .c  o m*/
static String getOrientation(Context context) {
    int orientation = context.getResources().getConfiguration().orientation;
    switch (orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        return "Landscape";
    case Configuration.ORIENTATION_PORTRAIT:
        return "Portrait";
    case Configuration.ORIENTATION_SQUARE:
        return "Square";
    case Configuration.ORIENTATION_UNDEFINED:
        return "Unknown";
    default:
        return null;
    }
}

From source file:com.tdispatch.passenger.core.TDApplication.java

@SuppressWarnings("deprecation")
protected void initEnvInfo() {

    DisplayMetrics dm = getResources().getDisplayMetrics();

    String orientation = "???";
    switch (getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        orientation = "Landscape";
        break;//w w w .  j a v  a  2  s .c o  m
    case Configuration.ORIENTATION_PORTRAIT:
        orientation = "Portrait";
        break;
    case Configuration.ORIENTATION_SQUARE:
        orientation = "Square";
        break;
    case Configuration.ORIENTATION_UNDEFINED:
        orientation = "Undef";
        break;
    default:
        orientation = "Unknown";
        break;
    }

    try {
        mEnvInfoJson.put("type", isTablet() ? "tablet" : "phone");
        mEnvInfoJson.put("build_manufacturer", Build.MANUFACTURER);
        mEnvInfoJson.put("build_model", Build.MODEL);
        mEnvInfoJson.put("build_board", Build.BOARD);
        mEnvInfoJson.put("build_device", Build.DEVICE);
        mEnvInfoJson.put("build_product", Build.PRODUCT);
        mEnvInfoJson.put("api", Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ")");
        mEnvInfoJson.put("screen",
                dm.widthPixels + "x" + dm.heightPixels + " (" + dm.densityDpi + "DPI) " + orientation);

        mEnvInfoJson.put("locale", Locale.getDefault());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:me.drakeet.meizhi.ui.GankFragment.java

private void setVideoViewPosition(Configuration newConfig) {
    switch (newConfig.orientation) {
    case Configuration.ORIENTATION_LANDSCAPE: {
        if (mIsVideoViewInflated) {
            mVideoViewStub.setVisibility(View.VISIBLE);
        } else {//from w  w w .j  a v a  2 s .  c om
            mVideoView = (LoveVideoView) mVideoViewStub.inflate();
            mIsVideoViewInflated = true;
            String tip = getString(R.string.tip_video_play);
            // @formatter:off
            new Once(mVideoView.getContext()).show(tip, () -> Snackbar
                    .make(mVideoView, tip, Snackbar.LENGTH_INDEFINITE).setAction(R.string.i_know, v -> {
                    }).show());
            // @formatter:on
        }
        if (mGankList.size() > 0 && mGankList.get(0).type.equals("?")) {
            mVideoView.loadUrl(mGankList.get(0).url);
        }
        break;
    }
    case Configuration.ORIENTATION_PORTRAIT:
    case Configuration.ORIENTATION_UNDEFINED:
    default: {
        mVideoViewStub.setVisibility(View.GONE);
        break;
    }
    }
}

From source file:com.air.mobilebrowser.BrowserActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    //Update the device status with the new orientation, and notify
    int orientation = newConfig.orientation;
    String orientationString = "none";

    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        orientationString = "portrait";
    } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        orientationString = "landscape";
    } else if (orientation == Configuration.ORIENTATION_UNDEFINED) {
        orientationString = "none";
    }//www.  j a  v a  2s  .c  o  m

    this.mDeviceStatus.orientation = orientationString;

    super.onConfigurationChanged(newConfig);

    handleOrientationChange();
}

From source file:RhodesService.java

public static int getScreenOrientation() {
    if (BaseActivity.getScreenProperties() != null)
        return BaseActivity.getScreenProperties().getOrientation();
    else//from w  w  w .  j av a  2 s  .  co m
        return Configuration.ORIENTATION_UNDEFINED;
}

From source file:com.codename1.impl.android.AndroidImplementation.java

public boolean isPortrait() {
    int orientation = getContext().getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_UNDEFINED || orientation == Configuration.ORIENTATION_SQUARE) {
        return super.isPortrait();
    }//from  w  w w .j  a va 2s.c o  m
    return orientation == Configuration.ORIENTATION_PORTRAIT;
}