feat: raw tag ui
This commit is contained in:
1 parent
8c42bbba53
commit
4af8ce15bb
3 files changed
+24
-3
No files matched your search
@@ -21,7 +21,7 @@ data class CaptureInfo(
|
||||
|
||||
// 设备信息
|
||||
val make: String = Build.MANUFACTURER,
|
||||
val model: String = DeviceUtil.model,
|
||||
val model: String = Build.MODEL,
|
||||
val software: String = "PhotonCamera",
|
||||
|
||||
// 拍摄参数
|
||||
|
||||
@@ -1298,7 +1298,12 @@ private class GalleryPhotoItemView(context: Context) : FrameLayout(context) {
|
||||
videoDuration.text = photo.getFormattedDuration()
|
||||
motionIcon.visibility = if (photo.isMotionPhoto) VISIBLE else GONE
|
||||
burstIcon.visibility = if (photo.isBurstPhoto) VISIBLE else GONE
|
||||
rawBadge.visibility = if (photo.isImage && viewModel.isRawInGallery(photo.id)) VISIBLE else GONE
|
||||
val isRawPhoto = when (viewModel.selectedTab) {
|
||||
GalleryTab.PHOTON -> viewModel.isRawInGallery(photo.id)
|
||||
GalleryTab.SYSTEM -> photo.isSystemRawImage()
|
||||
}
|
||||
rawBadge.visibility = if (photo.isImage && isRawPhoto) VISIBLE else GONE
|
||||
rawBadge.text = context.getString(R.string.gallery_raw_badge)
|
||||
importedBadge.visibility =
|
||||
if (viewModel.selectedTab == GalleryTab.PHOTON && photo.sourceUri != null) VISIBLE else GONE
|
||||
importedBadge.text = context.getString(R.string.imported)
|
||||
@@ -1393,6 +1398,23 @@ private fun Bitmap.galleryBitmapAspectRatio(): Float {
|
||||
}
|
||||
}
|
||||
|
||||
private fun MediaData.isSystemRawImage(): Boolean {
|
||||
if (!isImage) return false
|
||||
if (mimeType?.let { type ->
|
||||
type.contains("raw", ignoreCase = true) ||
|
||||
type.contains("dng", ignoreCase = true)
|
||||
} == true
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
return displayName.substringAfterLast('.', missingDelimiterValue = "")
|
||||
.lowercase()
|
||||
.let { extension ->
|
||||
extension in setOf("dng", "arw", "cr2", "cr3", "nef", "nrw", "orf", "pef", "raf", "rw2", "srw")
|
||||
}
|
||||
}
|
||||
|
||||
private fun MediaData.galleryAspectRatio(isLandscape: Boolean): Float {
|
||||
val rawWidth = if (isVideo) {
|
||||
width
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
style="@style/GallerySmallBadge"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:text="RAW"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
|
||||
Reference in new issue
Block a user