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


Java ActivityInfo.SCREEN_ORIENTATION_PORTRAIT属性代码示例

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


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

示例1: setRequestedOrientation

@Override
public void setRequestedOrientation(int requestedOrientation) {
    super.setRequestedOrientation(requestedOrientation);
    if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        if (verticalControll != null) {
            isVertical = true;
            verticalControll.onCreate();
            horizontalControll.onDestroy();
        }

    } else {
        if (horizontalControll != null) {
            isVertical = false;
            horizontalControll.onCreate();
            verticalControll.onDestroy();
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:TvShowActivity.java

示例2: 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:xiong-it,项目名称:ZXingAndroidExt,代码行数:20,代码来源:QrCodeScannerActivity.java

示例3: 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:GrenderG,项目名称:Protestr,代码行数:20,代码来源:RotationUtils.java

示例4: onConfigurationChanged

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if(newConfig.orientation== ActivityInfo.SCREEN_ORIENTATION_PORTRAIT){
        isFullScreen = false;
        mRenderContainer.setVisibility(View.GONE);
        mRenderContainer.removeAllViews();
    }else{
        isFullScreen = true;
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mRenderContainer.getLayoutParams();
        layoutParams.topMargin = 0;
        layoutParams.width = -1;
        layoutParams.height = -1;
        mRenderContainer.setLayoutParams(layoutParams);

    }
}
 
开发者ID:jiajunhui,项目名称:PlayerBase,代码行数:17,代码来源:MainHolder.java

示例5: onResume

@Override
protected void onResume() {
    super.onResume();
    lifecycleSubject.onNext(ActivityEvent.RESUME);
    if (isRequestPermissionOnResume()) {
        checkPermission();
    } else {
        if (!isFirstResume) {
            checkPermission();
        } else {
            isFirstResume = false;
        }
    }

    if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
}
 
开发者ID:chenzj-king,项目名称:RetrofitSample,代码行数:18,代码来源:BaseCompatActivity.java

示例6: onHideCustomView

@Override
public void onHideCustomView() {

    LogUtils.i("Info", "onHideCustomView:" + moiveView);
    if (moiveView == null)
        return;
    if (mActivity!=null&&mActivity.getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    moiveView.setVisibility(View.GONE);
    if (moiveParentView != null && moiveView != null) {
        moiveParentView.removeView(moiveView);

    }
    if (moiveParentView != null)
        moiveParentView.setVisibility(View.GONE);

    if(this.mCallback!=null)
        mCallback.onCustomViewHidden();
    this.moiveView = null;
    if (mWebView != null)
        mWebView.setVisibility(View.VISIBLE);



}
 
开发者ID:Justson,项目名称:AgentWebX5,代码行数:26,代码来源:VideoImpl.java

示例7: 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

示例8: onSensorChanged

@Override
public void onSensorChanged(SensorEvent event) {
	try {
		if (event.sensor == mRotationSensor && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
			if (event.values.length > 4) {
				float[] truncatedRotationVector = new float[4];
				System.arraycopy(event.values, 0, truncatedRotationVector, 0, 4);
				update(truncatedRotationVector);
			} else {
				update(event.values);
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:16,代码来源:StreamActivity.java

示例9: onConfigurationChanged

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        //portrait
    } else {
        isLandscape = true;
        //landscape
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TvShowActivity.java

示例10: unspecified

/**
 * The requested screen orientation. Commonly used values are
    unspecified (-1), landscape (0), portrait (1), sensor (4), and user (2).  " +
    "See the Android developer documentation for ActivityInfo.Screen_Orientation for the " +
    "complete list of possible settings.
 *
 * ScreenOrientation property getter method.
 *
 * @return  screen orientation
 */
@SimpleProperty(category = PropertyCategory.APPEARANCE,
    description = "The requested screen orientation, specified as a text value.  " +
    "Commonly used values are " +
    "landscape, portrait, sensor, user and unspecified.  " +
    "See the Android developer documentation for ActivityInfo.Screen_Orientation for the " +
    "complete list of possible settings.")
public String ScreenOrientation() {
  switch (getRequestedOrientation()) {
    case ActivityInfo.SCREEN_ORIENTATION_BEHIND:
      return "behind";
    case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
      return "landscape";
    case ActivityInfo.SCREEN_ORIENTATION_NOSENSOR:
      return "nosensor";
    case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
      return "portrait";
    case ActivityInfo.SCREEN_ORIENTATION_SENSOR:
      return "sensor";
    case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED:
      return "unspecified";
    case ActivityInfo.SCREEN_ORIENTATION_USER:
      return "user";
    case 10: // ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
      return "fullSensor";
    case 8: // ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
      return "reverseLandscape";
    case 9: // ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
      return "reversePortrait";
    case 6: // ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
      return "sensorLandscape";
    case 7: // ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
      return "sensorPortrait";
  }

  return "unspecified";
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:46,代码来源:Form.java

示例11: 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:michelelacorte,项目名称:FlickLauncher,代码行数:31,代码来源:Launcher.java

示例12: 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

示例13: 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

示例14: getScreenOrientation

@RequiresApi(api = Build.VERSION_CODES.FROYO)
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:lanyan520,项目名称:Idea-ijkplayer,代码行数:52,代码来源:PlayerManager.java

示例15: orientationPortrait

public static ViewAction orientationPortrait() {
    return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
 
开发者ID:fantasy1022,项目名称:FancyTrendView,代码行数:3,代码来源:OrientationChangeAction.java


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