Skip to content

Commit

Permalink
Lossless/lossy WebP
Browse files Browse the repository at this point in the history
Fix #296

Show lossy webp on Android 9 and lower and lossless on Android 10 and higher
  • Loading branch information
cvzi committed Feb 21, 2023
1 parent 2212f6a commit 7e9bb23
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ class SettingAdvancedFragment : PreferenceFragmentCompat() {
"PNG (quality parameter has no effect)"
} else if (compressionOptions.format == Bitmap.CompressFormat.WEBP) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && compressionOptions.quality == 100) {
"WEBP (Lossless 100%)"
"WebP (Lossless 100%)"
} else {
"WEBP (Lossy ${compressionOptions.quality}%)"
"WebP (Lossy ${compressionOptions.quality}%)"
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (compressionOptions.format == Bitmap.CompressFormat.WEBP_LOSSY) {
"WEBP (Lossy ${compressionOptions.quality}%)"
"WebP (Lossy ${compressionOptions.quality}%)"
} else if (compressionOptions.format == Bitmap.CompressFormat.WEBP_LOSSLESS) {
"WEBP (Lossless ${compressionOptions.quality}%)"
"WebP (Lossless ${compressionOptions.quality}%)"
} else {
"${compressionOptions.format.name} ${compressionOptions.quality}%"
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-v29/strings_untranslatable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="setting_file_format_entry_webp" translatable="false">WebP (lossless)</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings_untranslatable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
<item>jpg_70</item>
</string-array>
<string name="setting_file_format_entry_default" translatable="false">PNG</string>
<string name="setting_file_format_entry_webp" translatable="false">WEBP (lossless)</string>
<string name="setting_file_format_entry_webp_95" translatable="false">WEBP (95%)</string>
<string name="setting_file_format_entry_webp_70" translatable="false">WEBP (70%)</string>
<string name="setting_file_format_entry_webp" translatable="false">WebP (100% lossy)</string>
<string name="setting_file_format_entry_webp_95" translatable="false">WebP (95% lossy)</string>
<string name="setting_file_format_entry_webp_70" translatable="false">WebP (70% lossy)</string>
<string name="setting_file_format_entry_jpg_100" translatable="false">JPG (100%)</string>
<string name="setting_file_format_entry_jpg_90" translatable="false">JPG (90%)</string>
<string name="setting_file_format_entry_jpg_70" translatable="false">JPG (70%)</string>
Expand Down

0 comments on commit 7e9bb23

Please sign in to comment.