Camera Activity
Main activity that displays a camera preview and allows users to take screenshots of their connected pc.
Constructors
Functions
Captures a camera image via cameraProvider and sends it to the connected server via sendCaptureRequest.
Checks whether the app is started for the first time and opens AppTutorial if that is the case.
Manual garbage collection of listeners and other resources, which could lead to memory leaks
Returns this activity
Retrieves the matching mode from sp and returns it.
Returns the current phoneOrientation
Returns the preview TextureView of the CameraActivity.
Hides the status and action bars.
Initializes all listeners and observers relevant to the activity
Initializes galleryViewModel, serverConnectionViewModel, captureViewModel and registers Observers
Callback for when the ResultsActivity is finished.
Callback for when the back button is pressed.
Closes com/pda/screenshotmatcher2/views/fragments/rotationFragments/SelectDeviceFragment.kt
Callback for when sending the match request fails.
Callback for when the server answers to a match request with a match.
Opens com/pda/screenshotmatcher2/views/fragments/ErrorFragment.kt
Opens com/pda/screenshotmatcher2/views/fragments/rotationFragments/SelectDeviceFragment.kt
Callback that updates the layout of this activity and rotates all rotationFragments.
Unregisters mSensorManager
Callback for when the server denies a match request.
Callback for permission request results. Calls verifyPermissions if a permission has not been granted.
Registers mSensorManager
Saves state of an instance when it gets finished
Listens to SensorEvents and calls onOrientationChanged when the device orientation changes.
Resumes state when an instance gets restored
Initiates the shared preferences.
Sets all view listeners.
Starts ResultsActivity.
Updates mSelectDeviceButton and mSelectDeviceButtonText to match the new connection status.
Properties
Instance of CameraActivityFragmentHandler, manages fragments
CaptureViewModel that provides two way data bindings to access CaptureModel
GalleryViewModel that provides two way data bindings to access images of the internal gallery
Sensor, used get mSensorManager
The key to access the type of matching mode via sp
Listener that listens to events of mCaptureButton
Button that opens GalleryFragment
Button that opens SelectDeviceFragment
Lister that listens to events of mSelectDeviceButton
Text that's being displayed on mSelectDeviceButton. "Disconnected" or "HOSTNAME", depending on serverConnectionViewModel connection status.
SensorManager, used to register CameraActivity as a listener for orientation changes
Button that opens SettingsFragment
The current device orientation. Possible values: Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270
ServerConnectionViewModel that provides two way data bindings to access ServerConnectionModel