GalleryPreviewFragment

class GalleryPreviewFragment : RotationFragment

RotationFragment that displays a capture result image pair.

Displayed in GalleryFragment when the user clicks on a capture result image pair.

Constructors

GalleryPreviewFragment
Link copied to clipboard
fun GalleryPreviewFragment()

Functions

clearGarbage
Link copied to clipboard
open override fun clearGarbage()

Set all listeners, ViewModels and shared references to null.

deleteBothImages
Link copied to clipboard
private fun deleteBothImages()

Deletes both mFullImageFile and mCroppedImageFile from the external app directory and closes this fragment.

getFilesFromBundle
Link copied to clipboard
private fun getFilesFromBundle(bundle: Bundle)

Receives all image Files from a bundle, and saves them in mFullImageFile and mCroppedImageFile.

initViews
Link copied to clipboard
private fun initViews()

Initiates all views and calls updatePillNavigation to initiate the pill navigation.

onCreateView
Link copied to clipboard
open override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?

Returns an inflated View for this fragment.

onViewCreated
Link copied to clipboard
open override fun onViewCreated(view: View, savedInstanceState: Bundle?)

Called when the fragment is created, initializes all views, listeners and the galleryViewModel.

removeThisFragment
Link copied to clipboard
open override fun removeThisFragment(removeBackground: Boolean)

Remove this fragment to rotate it.

removeThisFragmentForRotation
Link copied to clipboard
open override fun removeThisFragmentForRotation(): ArrayList<File?>

Removes this fragment and returns the displayed image pair.

saveCurrentPreviewImage
Link copied to clipboard
private fun saveCurrentPreviewImage()

Saves either mFullImageFile or mCroppedImageFile to the phone gallery, depending on the mPillNavigationState.

setImage
Link copied to clipboard
private fun setImage()
setViewListeners
Link copied to clipboard
private fun setViewListeners()

Sets all view listeners.

shareImage
Link copied to clipboard
private fun shareImage()

Opens the share intent to share the current preview image.

togglePillNavigationSelection
Link copied to clipboard
private fun togglePillNavigationSelection()

Toggles the mPillNavigationState between 0 and 1.

updatePillNavigation
Link copied to clipboard
private fun updatePillNavigation()

Updates views to match the mPillNavigationState.

Properties

galleryViewModel
Link copied to clipboard
private var galleryViewModel: GalleryViewModel? = null

The GalleryViewModel used to obtain old capture result image pairs

mCroppedImageFile
Link copied to clipboard
private var mCroppedImageFile: File? = null

The file containing the cropped screenshot

mDeleteBoth
Link copied to clipboard
private var mDeleteBoth: AppCompatImageButton? = null

The delete both button, calls deleteBothImages when clicked

mFragmentBackground
Link copied to clipboard
private var mFragmentBackground: FrameLayout? = null

The dark background behind the fragment

mFullImageFile
Link copied to clipboard
private var mFullImageFile: File? = null

The file containing the full screenshot

mImagePreviewNextButton
Link copied to clipboard
private var mImagePreviewNextButton: AppCompatImageButton? = null

The next image button (right), used to navigate to the next image

mImagePreviewPreviousButton
Link copied to clipboard
private var mImagePreviewPreviousButton: AppCompatImageButton? = null

The previous image button (left), used to navigate to the previous image

mPillNavigationButton1
Link copied to clipboard
private var mPillNavigationButton1: AppCompatButton? = null

The first pill navigation button, used to navigate to the previous image

mPillNavigationButton2
Link copied to clipboard
private var mPillNavigationButton2: AppCompatButton? = null

The second pill navigation button, used to navigate to the next image

mPillNavigationState
Link copied to clipboard
private var mPillNavigationState: Int = 1

The current state of the pill navigation buttons, used to determine which pill navigation button is currently highlighted (0 = pill 1 = cropped screenshot, 1 = pill 2 = full screenshot)

mSaveOneButton
Link copied to clipboard
private var mSaveOneButton: AppCompatImageButton? = null

The save one button, calls saveCurrentPreviewImage when clicked

mSaveOneButtonText
Link copied to clipboard
private var mSaveOneButtonText: TextView? = null

The text view displaying the text beneath mSaveOneButton

mScreenshotImageView
Link copied to clipboard
private var mScreenshotImageView: ImageView? = null

The image view displaying the screenshot (either cropped or full)

mShareButton
Link copied to clipboard
private var mShareButton: AppCompatImageButton? = null

The share button, calls shareImage when clicked

mShareButtonText
Link copied to clipboard
private var mShareButtonText: TextView? = null

The text view displaying the text beneath mShareButton

numberOfAvailableImages
Link copied to clipboard
private var numberOfAvailableImages: Int = 0

The number of available images in the capture result image pair (1 or 2)

oldBundle
Link copied to clipboard
private lateinit var oldBundle: Bundle