Java Code Examples for android.content.pm.ActivityInfo#SCREEN_ORIENTATION_USER

The following examples show how to use android.content.pm.ActivityInfo#SCREEN_ORIENTATION_USER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EBrowserActivity.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public final int intoOrientation(int flag) {
    int or = ActivityInfo.SCREEN_ORIENTATION_USER;
    if (flag == 1) {// portrait
        or = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else if (flag == 2) {// landscape
        or = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (flag == 4) {// reverse portrait
        or = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    } else if (flag == 8) {// reverse landscape
        or = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    } else if (flag == 5) {// portrait and reverse portrait, Some devices only portrait effective
        if (Build.VERSION.SDK_INT >= 18) {
            or = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT;
        } else {
            or = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
        }
    } else if (flag == 10) {// landscape and reverse landscape
        if (Build.VERSION.SDK_INT >= 18) {
            or = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;
        } else {
            or = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
        }
    }
    return or;
}
 
Example 2
Source File: GSYBaseVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * 旋转处理
 *
 * @param activity         页面
 * @param newConfig        配置
 * @param orientationUtils 旋转工具类
 * @param hideActionBar    是否隐藏actionbar
 * @param hideStatusBar    是否隐藏statusbar
 */
public void onConfigurationChanged(Activity activity, Configuration newConfig, OrientationUtils orientationUtils, boolean hideActionBar, boolean hideStatusBar) {
    super.onConfigurationChanged(newConfig);
    //如果旋转了就全屏
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        if (!isIfCurrentIsFullscreen()) {
            startWindowFullscreen(activity, hideActionBar, hideStatusBar);
        }
    } else {
        //新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
        if (isIfCurrentIsFullscreen() && !isVerticalFullByVideoSize()) {
            backFromFull(activity);
        }
        if (orientationUtils != null) {
            orientationUtils.setEnable(true);
        }
    }

}
 
Example 3
Source File: AutoPlayRecyclerViewActivity.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    //如果旋转了就全屏
    if (newConfig.orientation != ActivityInfo.SCREEN_ORIENTATION_USER) {
        mFull = false;
    } else {
        mFull = true;
    }

}
 
Example 4
Source File: EBrowserActivity.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
private int getOrientationForRotation() {
    int ori = ActivityInfo.SCREEN_ORIENTATION_USER;
    int rotation = this.getWindowManager().getDefaultDisplay().getRotation();
    if (rotation == Surface.ROTATION_0) {
        ori = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else if (rotation == Surface.ROTATION_90) {
        ori = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (rotation == Surface.ROTATION_180) {
        ori = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
    } else if (rotation == Surface.ROTATION_270) {
        ori = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    }
    return ori;
}
 
Example 5
Source File: EBrowserActivity.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
public final void setAutorotateEnable(int enabled) {
    int ori = ActivityInfo.SCREEN_ORIENTATION_USER;
    if (enabled == 1) {
        ori = getOrientationForRotation();
    }
    final int orientation = ori;
    new Handler(Looper.getMainLooper()) {
        @Override
        public void handleMessage(Message msg) {
            setRequestedOrientation(orientation);
            ;
        }
    }.sendEmptyMessageDelayed(0, 100);
}
 
Example 6
Source File: HiSettingsHelper.java    From hipda with GNU General Public License v2.0 5 votes vote down vote up
private int getScreenOrietationFromPref() {
    try {
        mScreenOrientation = Integer.parseInt(mSharedPref.getString(PERF_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_USER + ""));
    } catch (Exception e) {
        mScreenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
    }
    return mScreenOrientation;
}
 
Example 7
Source File: Utils.java    From Android-Applications-Info with Apache License 2.0 5 votes vote down vote up
public static String getOrientationString(int orientation) {
    switch (orientation) {
        case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED:
            return "Unspecified";
        case ActivityInfo.SCREEN_ORIENTATION_BEHIND:
            return "Behind";
        case ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR:
            return "Full sensor";
        case ActivityInfo.SCREEN_ORIENTATION_FULL_USER:
            return "Full user";
        case ActivityInfo.SCREEN_ORIENTATION_LOCKED:
            return "Locked";
        case ActivityInfo.SCREEN_ORIENTATION_NOSENSOR:
            return "No sensor";
        case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
            return "Landscape";
        case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
            return "Portrait";
        case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:
            return "Reverse portrait";
        case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
            return "Reverse landscape";
        case ActivityInfo.SCREEN_ORIENTATION_USER:
            return "User";
        case ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
            return "Sensor landscape";
        case ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT:
            return "Sensor portrait";
        case ActivityInfo.SCREEN_ORIENTATION_SENSOR:
            return "Sensor";
        case ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE:
            return "User landscape";
        case ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT:
            return "User portrait";
        default:
            return "null";
    }
}
 
Example 8
Source File: ScreenUtils.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
public static String screenOrientationDesc(int curScreenOr) {
    String oriDesc = curScreenOr + "";
    switch (curScreenOr) {
        case ActivityInfo.SCREEN_ORIENTATION_BEHIND:
            oriDesc = "在后面BEHIND";
            break;
        case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
            oriDesc = "竖屏";
            break;
        case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
            oriDesc = "横屏";
            break;
        case ActivityInfo.SCREEN_ORIENTATION_USER:
            oriDesc = "跟随用户";
            break;
        case ActivityInfo.SCREEN_ORIENTATION_SENSOR:
            oriDesc = "跟随传感器";
            break;
        case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED:
            oriDesc = "未指明的";
            break;
        case ActivityInfo.SCREEN_ORIENTATION_LOCKED:
            oriDesc = "locked";
            break;
    }
    return oriDesc;
}
 
Example 9
Source File: VideoListFragment.java    From DoingDaily with Apache License 2.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    //如果旋转了就全屏
    if (newConfig.orientation != ActivityInfo.SCREEN_ORIENTATION_USER) {
        mFull = false;
    } else {
        mFull = true;
    }
}
 
Example 10
Source File: PlayPxgavActivity.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example 11
Source File: Form.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * 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";
}
 
Example 12
Source File: AxglePlayActivity.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example 13
Source File: BasePlayVideo.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example 14
Source File: PlayPxgavActivity.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example 15
Source File: KeDouPlayActivity.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example 16
Source File: AxglePlayActivity.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example 17
Source File: BasePlayVideo.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}