当前位置: 首页>>代码示例>>Java>>正文


Java ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT属性代码示例

本文整理汇总了Java中android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT属性的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT属性的具体用法?Java ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT怎么用?Java ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.content.pm.ActivityInfo的用法示例。


在下文中一共展示了ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentOrientation

private int getCurrentOrientation() {
    int rotation = getWindowManager().getDefaultDisplay().getRotation();
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        switch (rotation) {
            case Surface.ROTATION_0:
            case Surface.ROTATION_90:
                return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
            default:
                return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
        }
    } else {
        switch (rotation) {
            case Surface.ROTATION_0:
            case Surface.ROTATION_270:
                return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
            default:
                return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
        }
    }
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:20,代码来源:CaptureActivity.java

示例2: perform

@Override
public void perform(UiController uiController, View view) {
    uiController.loopMainThreadUntilIdle();
    int orientation = getActivityOrientation(view);
    boolean checkOrientation = false;
    switch (orientationType) {
        case PORTRAIT:
            checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT;
            break;

        case LANDSCAPE:
            checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;
            break;
    }

    if (checkOrientation) {
        isOrientation[0] = true;
    }
}
 
开发者ID:dev-labs-bg,项目名称:fullscreen-video-view,代码行数:25,代码来源:CustomChecks.java

示例3: toggleScreen

public void toggleScreen(){
    mOrEventListener.disable();
    mOrEventListener1.enable();
    int orientation = 0 ;
    if(mOrientation ==  ActivityInfo.SCREEN_ORIENTATION_PORTRAIT){
        orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    }else if(mOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){
        orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    }else if(mOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE){
        orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    }else if(mOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT){
        orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    }
    mOrientation = orientation;
    mActivity.setRequestedOrientation(mOrientation);
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:16,代码来源:ScreenOrientationUtil.java

示例4: getCurrentOrientation

private int getCurrentOrientation() {
	int rotation = getWindowManager().getDefaultDisplay().getRotation();
	if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
		switch (rotation) {
		case Surface.ROTATION_0:
		case Surface.ROTATION_90:
			return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
		default:
			return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
		}
	} else {
		switch (rotation) {
		case Surface.ROTATION_0:
		case Surface.ROTATION_270:
			return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
		default:
			return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
		}
	}
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:CaptureActivity.java

示例5: lockOrientation

/**
 * Locks the device window in actual screen mode
 */
public static void lockOrientation(Activity activity) {
    Display display = ((WindowManager) activity.
            getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    int rotation = display.getRotation();
    int orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;

    switch (activity.getResources().getConfiguration().orientation) {
        case Configuration.ORIENTATION_LANDSCAPE:
            if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90)
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
            else
                orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
            break;
        case Configuration.ORIENTATION_PORTRAIT:
            if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270)
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
            else
                orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    }
    //noinspection ResourceType
    activity.setRequestedOrientation(orientation);
}
 
开发者ID:davideas,项目名称:AndroidBlueprints,代码行数:25,代码来源:Utils.java

示例6: lockOrientation

public static void lockOrientation(@NonNull AppCompatActivity appCompatActivity) {
    int orientation;
    switch (getRotationState(appCompatActivity)) {
        case PORTRAIT:
            orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
            break;
        case LANDSCAPE:
            orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
            break;
        case REVERSE_PORTRAIT:
            orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
            break;
        case REVERSE_LANDSCAPE:
            orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
            break;
        default:
            orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    appCompatActivity.setRequestedOrientation(orientation);
}
 
开发者ID:owniz,项目名称:OzComicReader,代码行数:20,代码来源:RotationUtils.java

示例7: convert2Orientation

private int convert2Orientation(int rotation){
    int orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    if (((rotation >= 0) && (rotation <= 45)) || (rotation > 315)) {
        orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else if ((rotation > 45) && (rotation <= 135)) {
        orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    } else if ((rotation > 135) && (rotation <= 225)) {
        orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    } else if ((rotation > 225) && (rotation <= 315)) {
        orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else {
        orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    }
    return orientation;
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:15,代码来源:ScreenOrientationUtil.java

示例8: mapConfigurationOriActivityInfoOri

private int mapConfigurationOriActivityInfoOri(int configOri) {
    final Display d = getWindowManager().getDefaultDisplay();
    int naturalOri = Configuration.ORIENTATION_LANDSCAPE;
    switch (d.getRotation()) {
    case Surface.ROTATION_0:
    case Surface.ROTATION_180:
        // We are currently in the same basic orientation as the natural orientation
        naturalOri = configOri;
        break;
    case Surface.ROTATION_90:
    case Surface.ROTATION_270:
        // We are currently in the other basic orientation to the natural orientation
        naturalOri = (configOri == Configuration.ORIENTATION_LANDSCAPE) ?
                Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
        break;
    }

    int[] oriMap = {
            ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,
            ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE,
            ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT,
            ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
    };
    // Since the map starts at portrait, we need to offset if this device's natural orientation
    // is landscape.
    int indexOffset = 0;
    if (naturalOri == Configuration.ORIENTATION_LANDSCAPE) {
        indexOffset = 1;
    }
    return oriMap[(d.getRotation() + indexOffset) % 4];
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:31,代码来源:Launcher.java

示例9: getCurrentOrientation

private int getCurrentOrientation() {
    int rotation = getWindowManager().getDefaultDisplay().getRotation();
    switch (rotation) {
        case Surface.ROTATION_0:
        case Surface.ROTATION_90:
            return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
        default:
            return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    }
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:10,代码来源:CaptureActivity.java

示例10: getOffset

/**
 * Gives the given offset for a given activity orientation. Used to make sure the views
 * are oriented correctly in respect to the activity orientation.
 *
 * @return the offset view orientation for the given activity orientation.
 */
private int getOffset() {
    switch (mOrientation) {
        case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
            return 0;
        case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
            return -90;
        case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
            return 180;
        case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
            return 90;
    }
    return 0;
}
 
开发者ID:brandenfung,项目名称:GyroView,代码行数:19,代码来源:GyroViewListener.java

示例11: onResume

@Override
public void onResume() {
	super.onResume();
	if (getResources().getConfiguration().orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT) {
		Log.d(LOG_TAG, "Orientations is reverse portrait");
	}

	Log.d(LOG_TAG, "Current orientation: " + getResources().getConfiguration().orientation);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:9,代码来源:StreamActivity.java

示例12: getScreenOrientation

private int getScreenOrientation() {
    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    int height = dm.heightPixels;
    int orientation;
    // if the device's natural orientation is portrait:
    if ((rotation == Surface.ROTATION_0
            || rotation == Surface.ROTATION_180) && height > width ||
            (rotation == Surface.ROTATION_90
                    || rotation == Surface.ROTATION_270) && width > height) {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
        }
    }
    // if the device's natural orientation is landscape or if the device
    // is square:
    else {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
        }
    }

    return orientation;
}
 
开发者ID:WeDevelopTeam,项目名称:HeroVideo-master,代码行数:58,代码来源:MediaPlayer.java

示例13: getScreenOrientation

/**
 * 获取界面方向
 */
public static int getScreenOrientation(Activity activity) {
    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    int height = dm.heightPixels;
    int orientation;
    // if the device's natural orientation is portrait:
    if ((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) && height > width ||
            (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) && width > height) {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_180:
                orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            case Surface.ROTATION_270:
                orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
        }
    }
    // if the device's natural orientation is landscape or if the device
    // is square:
    else {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_180:
                orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            case Surface.ROTATION_270:
                orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
        }
    }

    return orientation;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:55,代码来源:WindowUtils.java

示例14: getScreenOrientation

private int getScreenOrientation() {
    if (activity == null) {
        return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    }
    int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    int height = dm.heightPixels;
    int orientation;
    // if the device's natural orientation is portrait:
    if ((rotation == Surface.ROTATION_0
            || rotation == Surface.ROTATION_180) && height > width ||
            (rotation == Surface.ROTATION_90
                    || rotation == Surface.ROTATION_270) && width > height) {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
        }
    }
    // if the device's natural orientation is landscape or if the device
    // is square:
    else {
        switch (rotation) {
            case Surface.ROTATION_0:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
            case Surface.ROTATION_90:
                orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                break;
            case Surface.ROTATION_180:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
                break;
            case Surface.ROTATION_270:
                orientation =
                        ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
                break;
            default:
                orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                break;
        }
    }

    return orientation;
}
 
开发者ID:tcking,项目名称:GiraffePlayer2,代码行数:61,代码来源:UIHelper.java

示例15: isPortrait

public boolean isPortrait(){
    if(mOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || mOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT){
        return true;
    }
    return false;
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:6,代码来源:ScreenOrientationUtil.java


注:本文中的android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。