mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
show a panorama button over images if appropriate
This commit is contained in:
parent
280559c7c3
commit
727c42f7bd
7 changed files with 27 additions and 0 deletions
|
@ -55,6 +55,7 @@ dependencies {
|
|||
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.8.2'
|
||||
implementation 'org.apache.sanselan:sanselan:0.97-incubator'
|
||||
|
||||
kapt "android.arch.persistence.room:compiler:1.1.1"
|
||||
implementation "android.arch.persistence.room:runtime:1.1.1"
|
||||
|
|
|
@ -36,6 +36,8 @@ import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO
|
|||
import com.simplemobiletools.gallery.models.Medium
|
||||
import it.sephiroth.android.library.exif2.ExifInterface
|
||||
import kotlinx.android.synthetic.main.pager_photo_item.view.*
|
||||
import org.apache.sanselan.common.byteSources.ByteSourceInputStream
|
||||
import org.apache.sanselan.formats.jpeg.JpegImageParser
|
||||
import pl.droidsonroids.gif.GifDrawable
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
|
@ -46,6 +48,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
private var isFullscreen = false
|
||||
private var wasInit = false
|
||||
private var useHalfResolution = false
|
||||
private var isPanorama = false
|
||||
private var imageOrientation = -1
|
||||
private var gifDrawable: GifDrawable? = null
|
||||
|
||||
|
@ -118,6 +121,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
loadImage()
|
||||
initExtendedDetails()
|
||||
wasInit = true
|
||||
checkIfPanorama()
|
||||
|
||||
return view
|
||||
}
|
||||
|
@ -329,6 +333,18 @@ 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>())
|
||||
imageParser.contains("GPano:UsePanoramaViewer=\"True\"", true)
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
view.panorama_outline.beVisibleIf(isPanorama)
|
||||
}
|
||||
|
||||
private fun getImageOrientation(): Int {
|
||||
val defaultOrientation = -1
|
||||
var orient = defaultOrientation
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_panorama.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_panorama.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_panorama.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_panorama.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_panorama.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_panorama.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_panorama.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_panorama.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -18,6 +18,16 @@
|
|||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panorama_outline"
|
||||
android:layout_width="@dimen/play_outline_size_big"
|
||||
android:layout_height="@dimen/play_outline_size_big"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:padding="@dimen/big_margin"
|
||||
android:src="@drawable/ic_panorama"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/photo_details"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue