mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
renaming some variables, no real code change
This commit is contained in:
parent
25131bd75b
commit
855f9abad5
2 changed files with 117 additions and 117 deletions
|
@ -62,29 +62,29 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
"google nexus 5x"
|
||||
)
|
||||
|
||||
private var isFragmentVisible = false
|
||||
private var isFullscreen = false
|
||||
private var wasInit = false
|
||||
private var isPanorama = false
|
||||
private var isSubsamplingVisible = false // checking view.visibility is unreliable, use an extra variable for it
|
||||
private var imageOrientation = -1
|
||||
private var mIsFragmentVisible = false
|
||||
private var mIsFullscreen = false
|
||||
private var mWasInit = false
|
||||
private var mIsPanorama = false
|
||||
private var mIsSubsamplingVisible = false // checking view.visibility is unreliable, use an extra variable for it
|
||||
private var mImageOrientation = -1
|
||||
private var mOriginalSubsamplingScale = 0f
|
||||
private var loadZoomableViewHandler = Handler()
|
||||
private var mIoadZoomableViewHandler = Handler()
|
||||
private var mScreenWidth = 0
|
||||
private var mScreenHeight = 0
|
||||
|
||||
private var storedShowExtendedDetails = false
|
||||
private var storedHideExtendedDetails = false
|
||||
private var storedAllowDeepZoomableImages = false
|
||||
private var storedShowHighestQuality = false
|
||||
private var storedAllowOneFingerZoom = false
|
||||
private var storedExtendedDetails = 0
|
||||
private var mStoredShowExtendedDetails = false
|
||||
private var mStoredHideExtendedDetails = false
|
||||
private var mStoredAllowDeepZoomableImages = false
|
||||
private var mStoredShowHighestQuality = false
|
||||
private var mStoredAllowOneFingerZoom = false
|
||||
private var mStoredExtendedDetails = 0
|
||||
|
||||
lateinit var view: ViewGroup
|
||||
lateinit var medium: Medium
|
||||
private lateinit var mView: ViewGroup
|
||||
private lateinit var mMedium: Medium
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
view = (inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup).apply {
|
||||
mView = (inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup).apply {
|
||||
subsampling_view.setOnClickListener { photoClicked() }
|
||||
photo_view.setOnClickListener { photoClicked() }
|
||||
gif_view.setOnClickListener { photoClicked() }
|
||||
|
@ -96,7 +96,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
instant_next_item.parentView = container
|
||||
|
||||
photo_brightness_controller.initialize(activity!!, slide_info, true, container) { x, y ->
|
||||
view.apply {
|
||||
mView.apply {
|
||||
if (subsampling_view.isVisible()) {
|
||||
subsampling_view.sendFakeClick(x, y)
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
subsampling_view.setOnTouchListener { v, event ->
|
||||
if (view.subsampling_view.scale == mOriginalSubsamplingScale) {
|
||||
if (mView.subsampling_view.scale == mOriginalSubsamplingScale) {
|
||||
handleEvent(event)
|
||||
}
|
||||
false
|
||||
|
@ -122,16 +122,16 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
checkScreenDimensions()
|
||||
storeStateVariables()
|
||||
if (!isFragmentVisible && activity is PhotoActivity) {
|
||||
isFragmentVisible = true
|
||||
if (!mIsFragmentVisible && activity is PhotoActivity) {
|
||||
mIsFragmentVisible = true
|
||||
}
|
||||
|
||||
medium = arguments!!.getSerializable(MEDIUM) as Medium
|
||||
if (medium.path.startsWith("content://") && !medium.path.startsWith("content://mms/")) {
|
||||
val originalPath = medium.path
|
||||
medium.path = context!!.getRealPathFromURI(Uri.parse(originalPath)) ?: medium.path
|
||||
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
|
||||
if (mMedium.path.startsWith("content://") && !mMedium.path.startsWith("content://mms/")) {
|
||||
val originalPath = mMedium.path
|
||||
mMedium.path = context!!.getRealPathFromURI(Uri.parse(originalPath)) ?: mMedium.path
|
||||
|
||||
if (medium.path.isEmpty()) {
|
||||
if (mMedium.path.isEmpty()) {
|
||||
var out: FileOutputStream? = null
|
||||
try {
|
||||
var inputStream = context!!.contentResolver.openInputStream(Uri.parse(originalPath))
|
||||
|
@ -148,24 +148,24 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
val file = File(context!!.externalCacheDir, Uri.parse(originalPath).lastPathSegment)
|
||||
out = FileOutputStream(file)
|
||||
rotated.compress(Bitmap.CompressFormat.JPEG, 100, out)
|
||||
medium.path = file.absolutePath
|
||||
mMedium.path = file.absolutePath
|
||||
} catch (e: Exception) {
|
||||
activity!!.toast(R.string.unknown_error_occurred)
|
||||
return view
|
||||
return mView
|
||||
} finally {
|
||||
out?.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
loadImage()
|
||||
initExtendedDetails()
|
||||
wasInit = true
|
||||
mWasInit = true
|
||||
checkIfPanorama()
|
||||
updateInstantSwitchWidths()
|
||||
|
||||
return view
|
||||
return mView
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
@ -176,17 +176,17 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
val config = context!!.config
|
||||
if (wasInit && (config.showExtendedDetails != storedShowExtendedDetails || config.extendedDetails != storedExtendedDetails)) {
|
||||
if (mWasInit && (config.showExtendedDetails != mStoredShowExtendedDetails || config.extendedDetails != mStoredExtendedDetails)) {
|
||||
initExtendedDetails()
|
||||
}
|
||||
|
||||
if (wasInit) {
|
||||
if (config.allowZoomingImages != storedAllowDeepZoomableImages || config.showHighestQuality != storedShowHighestQuality ||
|
||||
config.oneFingerZoom != storedAllowOneFingerZoom) {
|
||||
isSubsamplingVisible = false
|
||||
view.subsampling_view.beGone()
|
||||
if (mWasInit) {
|
||||
if (config.allowZoomingImages != mStoredAllowDeepZoomableImages || config.showHighestQuality != mStoredShowHighestQuality ||
|
||||
config.oneFingerZoom != mStoredAllowOneFingerZoom) {
|
||||
mIsSubsamplingVisible = false
|
||||
mView.subsampling_view.beGone()
|
||||
loadImage()
|
||||
} else if (medium.isGIF()) {
|
||||
} else if (mMedium.isGIF()) {
|
||||
loadGif()
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
val allowPhotoGestures = config.allowPhotoGestures
|
||||
val allowInstantChange = config.allowInstantChange
|
||||
|
||||
view.apply {
|
||||
mView.apply {
|
||||
photo_brightness_controller.beVisibleIf(allowPhotoGestures)
|
||||
instant_prev_item.beVisibleIf(allowInstantChange)
|
||||
instant_next_item.beVisibleIf(allowInstantChange)
|
||||
|
@ -206,9 +206,9 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
isFragmentVisible = menuVisible
|
||||
if (wasInit) {
|
||||
if (!medium.isGIF()) {
|
||||
mIsFragmentVisible = menuVisible
|
||||
if (mWasInit) {
|
||||
if (!mMedium.isGIF()) {
|
||||
photoFragmentVisibilityChanged(menuVisible)
|
||||
}
|
||||
}
|
||||
|
@ -216,12 +216,12 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun storeStateVariables() {
|
||||
context!!.config.apply {
|
||||
storedShowExtendedDetails = showExtendedDetails
|
||||
storedHideExtendedDetails = hideExtendedDetails
|
||||
storedAllowDeepZoomableImages = allowZoomingImages
|
||||
storedShowHighestQuality = showHighestQuality
|
||||
storedAllowOneFingerZoom = oneFingerZoom
|
||||
storedExtendedDetails = extendedDetails
|
||||
mStoredShowExtendedDetails = showExtendedDetails
|
||||
mStoredHideExtendedDetails = hideExtendedDetails
|
||||
mStoredAllowDeepZoomableImages = allowZoomingImages
|
||||
mStoredShowHighestQuality = showHighestQuality
|
||||
mStoredAllowOneFingerZoom = oneFingerZoom
|
||||
mStoredExtendedDetails = extendedDetails
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,26 +265,26 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
private fun loadImage() {
|
||||
imageOrientation = getImageOrientation()
|
||||
mImageOrientation = getImageOrientation()
|
||||
when {
|
||||
medium.isGIF() -> loadGif()
|
||||
medium.isSVG() -> loadSVG()
|
||||
mMedium.isGIF() -> loadGif()
|
||||
mMedium.isSVG() -> loadSVG()
|
||||
else -> loadBitmap()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadGif() {
|
||||
try {
|
||||
val pathToLoad = getPathToLoad(medium)
|
||||
val pathToLoad = getPathToLoad(mMedium)
|
||||
val source = if (pathToLoad.startsWith("content://") || pathToLoad.startsWith("file://")) {
|
||||
InputSource.UriSource(context!!.contentResolver, Uri.parse(pathToLoad))
|
||||
} else {
|
||||
InputSource.FileSource(pathToLoad)
|
||||
}
|
||||
|
||||
view.photo_view.beGone()
|
||||
view.gif_view.beVisible()
|
||||
view.gif_view.setInputSource(source)
|
||||
mView.photo_view.beGone()
|
||||
mView.gif_view.beVisible()
|
||||
mView.gif_view.setInputSource(source)
|
||||
} catch (e: Exception) {
|
||||
loadBitmap()
|
||||
} catch (e: OutOfMemoryError) {
|
||||
|
@ -296,13 +296,13 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
Glide.with(context!!)
|
||||
.`as`(PictureDrawable::class.java)
|
||||
.listener(SvgSoftwareLayerSetter())
|
||||
.load(medium.path)
|
||||
.into(view.photo_view)
|
||||
.load(mMedium.path)
|
||||
.into(mView.photo_view)
|
||||
}
|
||||
|
||||
private fun loadBitmap(degrees: Int = 0) {
|
||||
checkScreenDimensions()
|
||||
var pathToLoad = if (medium.path.startsWith("content://")) medium.path else "file://${medium.path}"
|
||||
var pathToLoad = if (mMedium.path.startsWith("content://")) mMedium.path else "file://${mMedium.path}"
|
||||
pathToLoad = pathToLoad.replace("%", "%25").replace("#", "%23")
|
||||
|
||||
try {
|
||||
|
@ -315,10 +315,10 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
picasso.rotate(degrees.toFloat())
|
||||
}
|
||||
|
||||
picasso.into(view.photo_view, object : Callback {
|
||||
picasso.into(mView.photo_view, object : Callback {
|
||||
override fun onSuccess() {
|
||||
view.photo_view.isZoomable = degrees != 0 || context?.config?.allowZoomingImages == false
|
||||
if (isFragmentVisible && degrees == 0) {
|
||||
mView.photo_view.isZoomable = degrees != 0 || context?.config?.allowZoomingImages == false
|
||||
if (mIsFragmentVisible && degrees == 0) {
|
||||
scheduleZoomableView()
|
||||
}
|
||||
}
|
||||
|
@ -337,53 +337,53 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
var targetWidth = if (mScreenWidth == 0) com.bumptech.glide.request.target.Target.SIZE_ORIGINAL else mScreenWidth
|
||||
var targetHeight = if (mScreenHeight == 0) com.bumptech.glide.request.target.Target.SIZE_ORIGINAL else mScreenHeight
|
||||
|
||||
if (imageOrientation == ORIENTATION_ROTATE_90) {
|
||||
if (mImageOrientation == ORIENTATION_ROTATE_90) {
|
||||
targetWidth = targetHeight
|
||||
targetHeight = com.bumptech.glide.request.target.Target.SIZE_ORIGINAL
|
||||
}
|
||||
|
||||
val options = RequestOptions()
|
||||
.signature(medium.path.getFileSignature())
|
||||
.signature(mMedium.path.getFileSignature())
|
||||
.format(DecodeFormat.PREFER_ARGB_8888)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.override(targetWidth, targetHeight)
|
||||
|
||||
Glide.with(context!!)
|
||||
.asBitmap()
|
||||
.load(getPathToLoad(medium))
|
||||
.load(getPathToLoad(mMedium))
|
||||
.apply(options)
|
||||
.listener(object : RequestListener<Bitmap> {
|
||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: com.bumptech.glide.request.target.Target<Bitmap>?, isFirstResource: Boolean) = false
|
||||
|
||||
override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: com.bumptech.glide.load.DataSource?, isFirstResource: Boolean): Boolean {
|
||||
if (isFragmentVisible) {
|
||||
if (mIsFragmentVisible) {
|
||||
scheduleZoomableView()
|
||||
}
|
||||
return false
|
||||
}
|
||||
}).into(view.photo_view)
|
||||
}).into(mView.photo_view)
|
||||
}
|
||||
|
||||
private fun openPanorama() {
|
||||
Intent(context, PanoramaPhotoActivity::class.java).apply {
|
||||
putExtra(PATH, medium.path)
|
||||
putExtra(PATH, mMedium.path)
|
||||
startActivity(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun scheduleZoomableView() {
|
||||
loadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
loadZoomableViewHandler.postDelayed({
|
||||
if (isFragmentVisible && context?.config?.allowZoomingImages == true && medium.isImage() && !isSubsamplingVisible) {
|
||||
mIoadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
mIoadZoomableViewHandler.postDelayed({
|
||||
if (mIsFragmentVisible && context?.config?.allowZoomingImages == true && mMedium.isImage() && !mIsSubsamplingVisible) {
|
||||
addZoomableView()
|
||||
}
|
||||
}, ZOOMABLE_VIEW_LOAD_DELAY)
|
||||
}
|
||||
|
||||
private fun addZoomableView() {
|
||||
val rotation = degreesForRotation(imageOrientation)
|
||||
val path = getPathToLoad(medium)
|
||||
isSubsamplingVisible = true
|
||||
val rotation = degreesForRotation(mImageOrientation)
|
||||
val path = getPathToLoad(mMedium)
|
||||
mIsSubsamplingVisible = true
|
||||
|
||||
val bitmapDecoder = object : DecoderFactory<ImageDecoder> {
|
||||
override fun make() = PicassoDecoder(path, Picasso.get(), rotation)
|
||||
|
@ -394,7 +394,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
val config = context!!.config
|
||||
view.subsampling_view.apply {
|
||||
mView.subsampling_view.apply {
|
||||
setMaxTileSize(if (config.showHighestQuality) Integer.MAX_VALUE else 4096)
|
||||
setMinimumTileDpi(if (config.showHighestQuality) -1 else getMinTileDpi())
|
||||
background = ColorDrawable(Color.TRANSPARENT)
|
||||
|
@ -414,8 +414,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
override fun onReady() {
|
||||
background = ColorDrawable(if (config.blackBackground) Color.BLACK else config.backgroundColor)
|
||||
val useWidth = if (imageOrientation == ORIENTATION_ROTATE_90 || imageOrientation == ORIENTATION_ROTATE_270) sHeight else sWidth
|
||||
val useHeight = if (imageOrientation == ORIENTATION_ROTATE_90 || imageOrientation == ORIENTATION_ROTATE_270) sWidth else sHeight
|
||||
val useWidth = if (mImageOrientation == ORIENTATION_ROTATE_90 || mImageOrientation == ORIENTATION_ROTATE_270) sHeight else sWidth
|
||||
val useHeight = if (mImageOrientation == ORIENTATION_ROTATE_90 || mImageOrientation == ORIENTATION_ROTATE_270) sWidth else sHeight
|
||||
setDoubleTapZoomScale(getDoubleTapZoomScale(useWidth, useHeight))
|
||||
mOriginalSubsamplingScale = scale
|
||||
}
|
||||
|
@ -427,15 +427,15 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
override fun onImageLoadError(e: Exception) {
|
||||
view.photo_view.isZoomable = true
|
||||
mView.photo_view.isZoomable = true
|
||||
background = ColorDrawable(Color.TRANSPARENT)
|
||||
isSubsamplingVisible = false
|
||||
mIsSubsamplingVisible = false
|
||||
beGone()
|
||||
}
|
||||
|
||||
override fun onPreviewLoadError(e: Exception) {
|
||||
background = ColorDrawable(Color.TRANSPARENT)
|
||||
isSubsamplingVisible = false
|
||||
mIsSubsamplingVisible = false
|
||||
beGone()
|
||||
}
|
||||
})
|
||||
|
@ -455,9 +455,9 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
private fun checkIfPanorama() {
|
||||
isPanorama = try {
|
||||
val inputStream = if (medium.path.startsWith("content:/")) context!!.contentResolver.openInputStream(Uri.parse(medium.path)) else File(medium.path).inputStream()
|
||||
val imageParser = JpegImageParser().getXmpXml(ByteSourceInputStream(inputStream, medium.name), HashMap<String, Any>())
|
||||
mIsPanorama = try {
|
||||
val inputStream = if (mMedium.path.startsWith("content:/")) context!!.contentResolver.openInputStream(Uri.parse(mMedium.path)) else File(mMedium.path).inputStream()
|
||||
val imageParser = JpegImageParser().getXmpXml(ByteSourceInputStream(inputStream, mMedium.name), HashMap<String, Any>())
|
||||
imageParser.contains("GPano:UsePanoramaViewer=\"True\"", true) || imageParser.contains("<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>", true)
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
|
@ -465,7 +465,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
false
|
||||
}
|
||||
|
||||
view.panorama_outline.beVisibleIf(isPanorama)
|
||||
mView.panorama_outline.beVisibleIf(mIsPanorama)
|
||||
}
|
||||
|
||||
private fun getImageOrientation(): Int {
|
||||
|
@ -473,11 +473,11 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
var orient = defaultOrientation
|
||||
|
||||
try {
|
||||
val pathToLoad = getPathToLoad(medium)
|
||||
val pathToLoad = getPathToLoad(mMedium)
|
||||
val exif = android.media.ExifInterface(pathToLoad)
|
||||
orient = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, defaultOrientation)
|
||||
|
||||
if (orient == defaultOrientation || medium.path.startsWith(OTG_PATH)) {
|
||||
if (orient == defaultOrientation || mMedium.path.startsWith(OTG_PATH)) {
|
||||
val uri = if (pathToLoad.startsWith("content:/")) Uri.parse(pathToLoad) else Uri.fromFile(File(pathToLoad))
|
||||
val inputStream = context!!.contentResolver.openInputStream(uri)
|
||||
val exif2 = ExifInterface()
|
||||
|
@ -510,47 +510,47 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
fun rotateImageViewBy(degrees: Int) {
|
||||
loadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
view.subsampling_view.beGone()
|
||||
isSubsamplingVisible = false
|
||||
mIoadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
mView.subsampling_view.beGone()
|
||||
mIsSubsamplingVisible = false
|
||||
loadBitmap(degrees)
|
||||
}
|
||||
|
||||
private fun initExtendedDetails() {
|
||||
if (context!!.config.showExtendedDetails) {
|
||||
view.photo_details.apply {
|
||||
mView.photo_details.apply {
|
||||
beInvisible() // make it invisible so we can measure it, but not show yet
|
||||
text = getMediumExtendedDetails(medium)
|
||||
text = getMediumExtendedDetails(mMedium)
|
||||
onGlobalLayout {
|
||||
if (isAdded) {
|
||||
val realY = getExtendedDetailsY(height)
|
||||
if (realY > 0) {
|
||||
y = realY
|
||||
beVisibleIf(text.isNotEmpty())
|
||||
alpha = if (!context!!.config.hideExtendedDetails || !isFullscreen) 1f else 0f
|
||||
alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
view.photo_details.beGone()
|
||||
mView.photo_details.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
if (activity?.isDestroyed == false) {
|
||||
view.subsampling_view.recycle()
|
||||
mView.subsampling_view.recycle()
|
||||
}
|
||||
loadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
mIoadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
|
||||
// avoid GIFs being skewed, played in wrong aspect ratio
|
||||
if (medium.isGIF()) {
|
||||
view.onGlobalLayout {
|
||||
if (mMedium.isGIF()) {
|
||||
mView.onGlobalLayout {
|
||||
Handler().postDelayed({
|
||||
loadGif()
|
||||
}, 50)
|
||||
|
@ -566,10 +566,10 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun hideZoomableView() {
|
||||
if (context?.config?.allowZoomingImages == true) {
|
||||
isSubsamplingVisible = false
|
||||
view.subsampling_view.recycle()
|
||||
view.subsampling_view.beGone()
|
||||
loadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
mIsSubsamplingVisible = false
|
||||
mView.subsampling_view.recycle()
|
||||
mView.subsampling_view.beGone()
|
||||
mIoadZoomableViewHandler.removeCallbacksAndMessages(null)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -579,17 +579,17 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun updateInstantSwitchWidths() {
|
||||
val newWidth = resources.getDimension(R.dimen.instant_change_bar_width) + if (activity?.portrait == false) activity!!.navigationBarWidth else 0
|
||||
view.instant_prev_item.layoutParams.width = newWidth.toInt()
|
||||
view.instant_next_item.layoutParams.width = newWidth.toInt()
|
||||
mView.instant_prev_item.layoutParams.width = newWidth.toInt()
|
||||
mView.instant_next_item.layoutParams.width = newWidth.toInt()
|
||||
}
|
||||
|
||||
override fun fullscreenToggled(isFullscreen: Boolean) {
|
||||
this.isFullscreen = isFullscreen
|
||||
view.photo_details.apply {
|
||||
if (storedShowExtendedDetails && isVisible()) {
|
||||
this.mIsFullscreen = isFullscreen
|
||||
mView.photo_details.apply {
|
||||
if (mStoredShowExtendedDetails && isVisible()) {
|
||||
animate().y(getExtendedDetailsY(height))
|
||||
|
||||
if (storedHideExtendedDetails) {
|
||||
if (mStoredHideExtendedDetails) {
|
||||
animate().alpha(if (isFullscreen) 0f else 1f).start()
|
||||
}
|
||||
}
|
||||
|
@ -598,8 +598,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun getExtendedDetailsY(height: Int): Float {
|
||||
val smallMargin = resources.getDimension(R.dimen.small_margin)
|
||||
val fullscreenOffset = smallMargin + if (isFullscreen) 0 else context!!.navigationBarHeight
|
||||
val actionsHeight = if (context!!.config.bottomActions && !isFullscreen) resources.getDimension(R.dimen.bottom_actions_height) else 0f
|
||||
val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight
|
||||
val actionsHeight = if (context!!.config.bottomActions && !mIsFullscreen) resources.getDimension(R.dimen.bottom_actions_height) else 0f
|
||||
return context!!.realScreenSize.y - height - actionsHeight - fullscreenOffset
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ class VideoFragment : ViewPagerFragment() {
|
|||
private lateinit var mBrightnessSideScroll: MediaSideScroll
|
||||
private lateinit var mVolumeSideScroll: MediaSideScroll
|
||||
|
||||
lateinit var mView: View
|
||||
lateinit var medium: Medium
|
||||
private lateinit var mView: View
|
||||
private lateinit var mMedium: Medium
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
mView = inflater.inflate(R.layout.pager_video_item, container, false).apply {
|
||||
|
@ -56,8 +56,8 @@ class VideoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
storeStateVariables()
|
||||
medium = arguments!!.getSerializable(MEDIUM) as Medium
|
||||
Glide.with(context!!).load(medium.path).into(mView.video_preview)
|
||||
mMedium = arguments!!.getSerializable(MEDIUM) as Medium
|
||||
Glide.with(context!!).load(mMedium.path).into(mView.video_preview)
|
||||
|
||||
mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
checkIfPanorama()
|
||||
|
@ -68,7 +68,7 @@ class VideoFragment : ViewPagerFragment() {
|
|||
video_play_outline.beGone()
|
||||
mVolumeSideScroll.beGone()
|
||||
mBrightnessSideScroll.beGone()
|
||||
Glide.with(context!!).load(medium.path).into(video_preview)
|
||||
Glide.with(context!!).load(mMedium.path).into(video_preview)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ class VideoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
private fun launchVideoPlayer() {
|
||||
activity!!.openPath(medium.path, false)
|
||||
activity!!.openPath(mMedium.path, false)
|
||||
}
|
||||
|
||||
private fun toggleFullscreen() {
|
||||
|
@ -140,7 +140,7 @@ class VideoFragment : ViewPagerFragment() {
|
|||
if (context!!.config.showExtendedDetails) {
|
||||
mView.video_details.apply {
|
||||
beInvisible() // make it invisible so we can measure it, but not show yet
|
||||
text = getMediumExtendedDetails(medium)
|
||||
text = getMediumExtendedDetails(mMedium)
|
||||
onGlobalLayout {
|
||||
if (isAdded) {
|
||||
val realY = getExtendedDetailsY(height)
|
||||
|
@ -159,8 +159,8 @@ class VideoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun checkIfPanorama() {
|
||||
try {
|
||||
val fis = FileInputStream(File(medium.path))
|
||||
context!!.parseFileChannel(medium.path, fis.channel, 0, 0, 0) {
|
||||
val fis = FileInputStream(File(mMedium.path))
|
||||
context!!.parseFileChannel(mMedium.path, fis.channel, 0, 0, 0) {
|
||||
mIsPanorama = true
|
||||
}
|
||||
} catch (ignored: Exception) {
|
||||
|
@ -170,7 +170,7 @@ class VideoFragment : ViewPagerFragment() {
|
|||
|
||||
private fun openPanorama() {
|
||||
Intent(context, PanoramaVideoActivity::class.java).apply {
|
||||
putExtra(PATH, medium.path)
|
||||
putExtra(PATH, mMedium.path)
|
||||
startActivity(this)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue