|
| 1 | +package com.programminghoch10.RotationControl |
| 2 | + |
| 3 | +import android.content.pm.ActivityInfo |
| 4 | + |
| 5 | +enum class ROTATION_MODE(val key: String, val value: Int, val title: String, val summary: String) { |
| 6 | + // yoinked from https://developer.android.com/reference/android/R.attr.html#screenOrientation |
| 7 | + |
| 8 | + SCREEN_ORIENTATION_UNSET( |
| 9 | + "UNSET", |
| 10 | + -2, |
| 11 | + "UNSET", |
| 12 | + "Do not override screen orientation. " + |
| 13 | + "You might as well disable the module instead of using this option.", |
| 14 | + ), |
| 15 | + SCREEN_ORIENTATION_UNSPECIFIED( |
| 16 | + "UNSPECIFIED", |
| 17 | + ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, |
| 18 | + "UNSPECIFIED", |
| 19 | + "No preference specified: " + |
| 20 | + "let the system decide the best orientation. " + |
| 21 | + "This will either be the orientation selected by the activity below, " + |
| 22 | + "or the user's preferred orientation if this activity is the bottom of a task. " + |
| 23 | + "If the user explicitly turned off sensor based orientation " + |
| 24 | + "through settings sensor based device rotation will be ignored. " + |
| 25 | + "If not by default sensor based orientation will be taken into account " + |
| 26 | + "and the orientation will changed based on how the user rotates the device.", |
| 27 | + ), |
| 28 | + SCREEN_ORIENTATION_LANDSCAPE( |
| 29 | + "LANDSCAPE", |
| 30 | + ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, |
| 31 | + "LANDSCAPE", |
| 32 | + "Would like to have the screen in a landscape orientation: " + |
| 33 | + "that is, with the display wider than it is tall, ignoring sensor data.", |
| 34 | + ), |
| 35 | + SCREEN_ORIENTATION_PORTRAIT( |
| 36 | + "PORTRAIT", |
| 37 | + ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, |
| 38 | + "PORTRAIT", |
| 39 | + "Would like to have the screen in a portrait orientation: " + |
| 40 | + "that is, with the display taller than it is wide, ignoring sensor data.", |
| 41 | + ), |
| 42 | + SCREEN_ORIENTATION_USER( |
| 43 | + "USER", |
| 44 | + ActivityInfo.SCREEN_ORIENTATION_USER, |
| 45 | + "USER", |
| 46 | + "Use the user's current preferred orientation of the handset.", |
| 47 | + ), |
| 48 | + SCREEN_ORIENTATION_BEHIND( |
| 49 | + "BEHIND", |
| 50 | + ActivityInfo.SCREEN_ORIENTATION_BEHIND, |
| 51 | + "BEHIND", |
| 52 | + "Keep the screen in the same orientation as whatever is behind this activity.", |
| 53 | + ), |
| 54 | + SCREEN_ORIENTATION_SENSOR( |
| 55 | + "SENSOR", |
| 56 | + ActivityInfo.SCREEN_ORIENTATION_SENSOR, |
| 57 | + "SENSOR", |
| 58 | + "Orientation is determined by a physical orientation sensor: " + |
| 59 | + "the display will rotate based on how the user moves the device. " + |
| 60 | + "Ignores user's setting to turn off sensor-based rotation.", |
| 61 | + ), |
| 62 | + SCREEN_ORIENTATION_NOSENSOR( |
| 63 | + "NOSENSOR", |
| 64 | + ActivityInfo.SCREEN_ORIENTATION_NOSENSOR, |
| 65 | + "NOSENSOR", |
| 66 | + "Always ignore orientation determined by orientation sensor: " + |
| 67 | + "the display will not rotate when the user moves the device.", |
| 68 | + ), |
| 69 | + SCREEN_ORIENTATION_SENSOR_LANDSCAPE( |
| 70 | + "SENSOR_LANDSCAPE", |
| 71 | + ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, |
| 72 | + "SENSOR_LANDSCAPE", |
| 73 | + "Would like to have the screen in landscape orientation, " + |
| 74 | + "but can use the sensor to change which direction the screen is facing. ", |
| 75 | + ), |
| 76 | + SCREEN_ORIENTATION_SENSOR_PORTRAIT( |
| 77 | + "SENSOR_PORTRAIT", |
| 78 | + ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT, |
| 79 | + "SENSOR_PORTRAIT", |
| 80 | + "Would like to have the screen in portrait orientation, " + |
| 81 | + "but can use the sensor to change which direction the screen is facing.", |
| 82 | + ), |
| 83 | + SCREEN_ORIENTATION_REVERSE_LANDSCAPE( |
| 84 | + "REVERSE_LANDSCAPE", |
| 85 | + ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE, |
| 86 | + "REVERSE_LANDSCAPE", |
| 87 | + "Would like to have the screen in landscape orientation, " + |
| 88 | + "turned in the opposite direction from normal landscape.", |
| 89 | + ), |
| 90 | + SCREEN_ORIENTATION_REVERSE_PORTRAIT( |
| 91 | + "REVERSE_PORTRAIT", |
| 92 | + ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, |
| 93 | + "REVERSE_PORTRAIT", |
| 94 | + "Would like to have the screen in portrait orientation, " + |
| 95 | + "turned in the opposite direction from normal portrait.", |
| 96 | + ), |
| 97 | + SCREEN_ORIENTATION_FULL_SENSOR( |
| 98 | + "FULL_SENSOR", |
| 99 | + ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR, |
| 100 | + "FULL_SENSOR", |
| 101 | + "Orientation is determined by a physical orientation sensor: " + |
| 102 | + "the display will rotate based on how the user moves the device. " + |
| 103 | + "This allows any of the 4 possible rotations, " + |
| 104 | + "regardless of what the device will normally do " + |
| 105 | + "(for example some devices won't normally use 180 degree rotation).", |
| 106 | + ), |
| 107 | + SCREEN_ORIENTATION_USER_LANDSCAPE( |
| 108 | + "USER_LANDSCAPE", |
| 109 | + ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE, |
| 110 | + "USER_LANDSCAPE", |
| 111 | + "Would like to have the screen in landscape orientation, " + |
| 112 | + "but if the user has enabled sensor-based rotation " + |
| 113 | + "then we can use the sensor to change which direction the screen is facing.", |
| 114 | + ), |
| 115 | + SCREEN_ORIENTATION_USER_PORTRAIT( |
| 116 | + "USER_PORTRAIT", |
| 117 | + ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT, |
| 118 | + "USER_PORTRAIT", |
| 119 | + "Would like to have the screen in portrait orientation, " + |
| 120 | + "but if the user has enabled sensor-based rotation " + |
| 121 | + "then we can use the sensor to change which direction the screen is facing.", |
| 122 | + ), |
| 123 | + SCREEN_ORIENTATION_FULL_USER( |
| 124 | + "FULL_USER", |
| 125 | + ActivityInfo.SCREEN_ORIENTATION_FULL_USER, |
| 126 | + "FULL_USER", |
| 127 | + "Respect the user's sensor-based rotation preference, " + |
| 128 | + "but if sensor-based rotation is enabled " + |
| 129 | + "then allow the screen to rotate in all 4 possible directions " + |
| 130 | + "regardless of what the device will normally do " + |
| 131 | + "(for example some devices won't normally use 180 degree rotation).", |
| 132 | + ), |
| 133 | + SCREEN_ORIENTATION_LOCKED( |
| 134 | + "LOCKED", |
| 135 | + ActivityInfo.SCREEN_ORIENTATION_LOCKED, |
| 136 | + "LOCKED", |
| 137 | + "Screen is locked to its current rotation, whatever that is.", |
| 138 | + ), |
| 139 | +} |
0 commit comments