#352 higher quality thumbnails
This commit is contained in:
parent
e76e49a54b
commit
d224edfbcb
6 changed files with 12 additions and 5 deletions
|
@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- higher quality thumbnails
|
||||||
- upgraded Flutter to stable v3.3.7
|
- upgraded Flutter to stable v3.3.7
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -19,10 +19,10 @@ import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.DecodeFormat
|
import com.bumptech.glide.load.DecodeFormat
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import deckers.thibault.aves.MainActivity
|
import deckers.thibault.aves.MainActivity
|
||||||
import deckers.thibault.aves.MainActivity.Companion.EXTRA_STRING_ARRAY_SEPARATOR
|
|
||||||
import deckers.thibault.aves.MainActivity.Companion.EXTRA_KEY_FILTERS_ARRAY
|
import deckers.thibault.aves.MainActivity.Companion.EXTRA_KEY_FILTERS_ARRAY
|
||||||
import deckers.thibault.aves.MainActivity.Companion.EXTRA_KEY_FILTERS_STRING
|
import deckers.thibault.aves.MainActivity.Companion.EXTRA_KEY_FILTERS_STRING
|
||||||
import deckers.thibault.aves.MainActivity.Companion.EXTRA_KEY_PAGE
|
import deckers.thibault.aves.MainActivity.Companion.EXTRA_KEY_PAGE
|
||||||
|
import deckers.thibault.aves.MainActivity.Companion.EXTRA_STRING_ARRAY_SEPARATOR
|
||||||
import deckers.thibault.aves.R
|
import deckers.thibault.aves.R
|
||||||
import deckers.thibault.aves.channel.calls.Coresult.Companion.safe
|
import deckers.thibault.aves.channel.calls.Coresult.Companion.safe
|
||||||
import deckers.thibault.aves.channel.calls.Coresult.Companion.safeSuspend
|
import deckers.thibault.aves.channel.calls.Coresult.Companion.safeSuspend
|
||||||
|
@ -159,7 +159,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.format(DecodeFormat.PREFER_RGB_565)
|
.format(DecodeFormat.PREFER_ARGB_8888)
|
||||||
.override(size, size)
|
.override(size, size)
|
||||||
val target = Glide.with(context)
|
val target = Glide.with(context)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
|
|
|
@ -42,8 +42,9 @@ class MediaFetchBytesHandler(private val context: Context) : MethodCallHandler {
|
||||||
val heightDip = call.argument<Number>("heightDip")?.toDouble()
|
val heightDip = call.argument<Number>("heightDip")?.toDouble()
|
||||||
val pageId = call.argument<Int>("pageId")
|
val pageId = call.argument<Int>("pageId")
|
||||||
val defaultSizeDip = call.argument<Number>("defaultSizeDip")?.toDouble()
|
val defaultSizeDip = call.argument<Number>("defaultSizeDip")?.toDouble()
|
||||||
|
val quality = call.argument<Int>("quality")
|
||||||
|
|
||||||
if (uri == null || mimeType == null || dateModifiedSecs == null || rotationDegrees == null || isFlipped == null || widthDip == null || heightDip == null || defaultSizeDip == null) {
|
if (uri == null || mimeType == null || dateModifiedSecs == null || rotationDegrees == null || isFlipped == null || widthDip == null || heightDip == null || defaultSizeDip == null || quality == null) {
|
||||||
result.error("getThumbnail-args", "missing arguments", null)
|
result.error("getThumbnail-args", "missing arguments", null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,6 +61,7 @@ class MediaFetchBytesHandler(private val context: Context) : MethodCallHandler {
|
||||||
height = (heightDip * density).roundToInt(),
|
height = (heightDip * density).roundToInt(),
|
||||||
pageId = pageId,
|
pageId = pageId,
|
||||||
defaultSize = (defaultSizeDip * density).roundToInt(),
|
defaultSize = (defaultSizeDip * density).roundToInt(),
|
||||||
|
quality = quality,
|
||||||
result = result,
|
result = result,
|
||||||
).fetch()
|
).fetch()
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ class ThumbnailFetcher internal constructor(
|
||||||
height: Int?,
|
height: Int?,
|
||||||
private val pageId: Int?,
|
private val pageId: Int?,
|
||||||
private val defaultSize: Int,
|
private val defaultSize: Int,
|
||||||
|
private val quality: Int,
|
||||||
private val result: MethodChannel.Result,
|
private val result: MethodChannel.Result,
|
||||||
) {
|
) {
|
||||||
private val uri: Uri = Uri.parse(uri)
|
private val uri: Uri = Uri.parse(uri)
|
||||||
|
@ -79,7 +80,7 @@ class ThumbnailFetcher internal constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
result.success(bitmap.getBytes(MimeTypes.canHaveAlpha(mimeType), recycle = false))
|
result.success(bitmap.getBytes(MimeTypes.canHaveAlpha(mimeType), recycle = false, quality = quality))
|
||||||
} else {
|
} else {
|
||||||
var errorDetails: String? = exception?.message
|
var errorDetails: String? = exception?.message
|
||||||
if (errorDetails?.isNotEmpty() == true) {
|
if (errorDetails?.isNotEmpty() == true) {
|
||||||
|
@ -119,7 +120,7 @@ class ThumbnailFetcher internal constructor(
|
||||||
private fun getByGlide(): Bitmap? {
|
private fun getByGlide(): Bitmap? {
|
||||||
// add signature to ignore cache for images which got modified but kept the same URI
|
// add signature to ignore cache for images which got modified but kept the same URI
|
||||||
var options = RequestOptions()
|
var options = RequestOptions()
|
||||||
.format(DecodeFormat.PREFER_RGB_565)
|
.format(if (quality == 100) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565)
|
||||||
.signature(ObjectKey("$dateModifiedSecs-$rotationDegrees-$isFlipped-$width-$pageId"))
|
.signature(ObjectKey("$dateModifiedSecs-$rotationDegrees-$isFlipped-$width-$pageId"))
|
||||||
.override(width, height)
|
.override(width, height)
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,7 @@ class PlatformMediaFetchService implements MediaFetchService {
|
||||||
'heightDip': extent,
|
'heightDip': extent,
|
||||||
'pageId': pageId,
|
'pageId': pageId,
|
||||||
'defaultSizeDip': _thumbnailDefaultSize,
|
'defaultSizeDip': _thumbnailDefaultSize,
|
||||||
|
'quality': 100,
|
||||||
});
|
});
|
||||||
if (result != null) return result as Uint8List;
|
if (result != null) return result as Uint8List;
|
||||||
} on PlatformException catch (e, stack) {
|
} on PlatformException catch (e, stack) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:aves/app_flavor.dart';
|
import 'package:aves/app_flavor.dart';
|
||||||
import 'package:aves/flutter_version.dart';
|
import 'package:aves/flutter_version.dart';
|
||||||
|
import 'package:aves/model/device.dart';
|
||||||
import 'package:aves/model/settings/enums/enums.dart';
|
import 'package:aves/model/settings/enums/enums.dart';
|
||||||
import 'package:aves/model/settings/settings.dart';
|
import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/ref/mime_types.dart';
|
import 'package:aves/ref/mime_types.dart';
|
||||||
|
@ -149,6 +150,7 @@ class _BugReportState extends State<BugReport> with FeedbackMixin {
|
||||||
'Android version: ${androidInfo.version.release} (SDK ${androidInfo.version.sdkInt})',
|
'Android version: ${androidInfo.version.release} (SDK ${androidInfo.version.sdkInt})',
|
||||||
'Android build: ${androidInfo.display}',
|
'Android build: ${androidInfo.display}',
|
||||||
'Device: ${androidInfo.manufacturer} ${androidInfo.model}',
|
'Device: ${androidInfo.manufacturer} ${androidInfo.model}',
|
||||||
|
'Geocoder: ${device.hasGeocoder ? 'ready' : 'not available'}',
|
||||||
'Mobile services: ${mobileServices.isServiceAvailable ? 'ready' : 'not available'}',
|
'Mobile services: ${mobileServices.isServiceAvailable ? 'ready' : 'not available'}',
|
||||||
'System locales: ${WidgetsBinding.instance.window.locales.join(', ')}',
|
'System locales: ${WidgetsBinding.instance.window.locales.join(', ')}',
|
||||||
'Aves locale: ${settings.locale ?? 'system'} -> ${settings.appliedLocale}',
|
'Aves locale: ${settings.locale ?? 'system'} -> ${settings.appliedLocale}',
|
||||||
|
|
Loading…
Reference in a new issue