Module: BubbleWrap::Device
- Defined in:
- motion/core/device.rb,
motion/core/device/camera.rb,
motion/core/device/screen.rb,
motion/core/device/camera_wrapper.rb
Defined Under Namespace
Modules: CameraWrapper, Screen Classes: Camera
Class Method Summary collapse
-
.camera ⇒ Device::Camera::CameraWrapper
Use this to make a DSL-style call for picking images.
-
.front_camera?(picker = UIImagePickerController) ⇒ TrueClass, FalseClass
Verifies that the device running has a front facing camera.
-
.ipad?(idiom = UIDevice.currentDevice.userInterfaceIdiom) ⇒ TrueClass, FalseClass
Verifies that the device running the app is an iPad.
-
.iphone?(idiom = UIDevice.currentDevice.userInterfaceIdiom) ⇒ TrueClass, FalseClass
Verifies that the device running the app is an iPhone.
-
.orientation ⇒ Object
Delegates to BubbleWrap::Screen.orientation.
-
.rear_camera?(picker = UIImagePickerController) ⇒ TrueClass, FalseClass
Verifies that the device running has a rear facing camera.
-
.retina? ⇒ Boolean
Delegates to BubbleWrap::Screen.retina?.
-
.screen ⇒ Object
Shameless shorthand for accessing BubbleWrap::Screen.
- .simulator? ⇒ Boolean
Class Method Details
.camera ⇒ Device::Camera::CameraWrapper
Use this to make a DSL-style call for picking images
20 21 22 |
# File 'motion/core/device.rb', line 20 def camera BubbleWrap::Device::CameraWrapper end |
.front_camera?(picker = UIImagePickerController) ⇒ TrueClass, FalseClass
Verifies that the device running has a front facing camera.
26 27 28 29 |
# File 'motion/core/device.rb', line 26 def front_camera?(picker=UIImagePickerController) p "This method (front_camera?) is DEPRECATED. Transition to using Device.camera.front?" picker.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceFront) end |
.ipad?(idiom = UIDevice.currentDevice.userInterfaceIdiom) ⇒ TrueClass, FalseClass
Verifies that the device running the app is an iPad.
13 14 15 |
# File 'motion/core/device.rb', line 13 def ipad?(idiom=UIDevice.currentDevice.userInterfaceIdiom) idiom == UIUserInterfaceIdiomPad end |
.iphone?(idiom = UIDevice.currentDevice.userInterfaceIdiom) ⇒ TrueClass, FalseClass
Verifies that the device running the app is an iPhone.
7 8 9 |
# File 'motion/core/device.rb', line 7 def iphone?(idiom=UIDevice.currentDevice.userInterfaceIdiom) idiom == UIUserInterfaceIdiomPhone end |
.orientation ⇒ Object
Delegates to BubbleWrap::Screen.orientation
53 54 55 |
# File 'motion/core/device.rb', line 53 def orientation screen.orientation end |
.rear_camera?(picker = UIImagePickerController) ⇒ TrueClass, FalseClass
Verifies that the device running has a rear facing camera.
33 34 35 36 |
# File 'motion/core/device.rb', line 33 def rear_camera?(picker=UIImagePickerController) p "This method (rear_camera?) is DEPRECATED. Transition to using Device.camera.rear?" picker.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceRear) end |
.retina? ⇒ Boolean
Delegates to BubbleWrap::Screen.retina?
48 49 50 |
# File 'motion/core/device.rb', line 48 def retina? screen.retina? end |
.screen ⇒ Object
Shameless shorthand for accessing BubbleWrap::Screen
43 44 45 |
# File 'motion/core/device.rb', line 43 def screen BubbleWrap::Device::Screen end |
.simulator? ⇒ Boolean
38 39 40 |
# File 'motion/core/device.rb', line 38 def simulator? @simulator_state ||= !(UIDevice.currentDevice.model =~ /simulator/i).nil? end |