use dark play/gif button as overlay when image is mostly light
|
@ -64,5 +64,5 @@
|
|||
d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z"
|
||||
clip-path="url(#b)"
|
||||
id="path10"
|
||||
style="fill:#ffffff;fill-opacity:0.7019608" />
|
||||
style="fill:#000000;fill-opacity:0.54" />
|
||||
</svg>
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
68
art/play_gif_white.svg
Normal file
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="play_gif.svg">
|
||||
<metadata
|
||||
id="metadata14">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1200"
|
||||
id="namedview12"
|
||||
showgrid="false"
|
||||
inkscape:zoom="9.8333333"
|
||||
inkscape:cx="1.5762712"
|
||||
inkscape:cy="11.084746"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<defs
|
||||
id="defs4">
|
||||
<path
|
||||
id="a"
|
||||
d="M24 24H0V0h24v24z" />
|
||||
</defs>
|
||||
<clipPath
|
||||
id="b">
|
||||
<use
|
||||
xlink:href="#a"
|
||||
overflow="visible"
|
||||
id="use8" />
|
||||
</clipPath>
|
||||
<path
|
||||
d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z"
|
||||
clip-path="url(#b)"
|
||||
id="path10"
|
||||
style="fill:#ffffff;fill-opacity:0.70" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
|
@ -55,5 +55,5 @@
|
|||
<path
|
||||
d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"
|
||||
id="path6"
|
||||
style="fill:#ffffff;fill-opacity:0.7019608;opacity:1;stroke:none;stroke-opacity:0.38039216" />
|
||||
style="fill:#000000;fill-opacity:0.54;opacity:1;stroke:none;stroke-opacity:0.38039216" />
|
||||
</svg>
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
59
art/play_video_white.svg
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="48"
|
||||
height="48"
|
||||
viewBox="0 0 48 48"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="play_video.svg">
|
||||
<metadata
|
||||
id="metadata12">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs10" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1916"
|
||||
inkscape:window-height="1156"
|
||||
id="namedview8"
|
||||
showgrid="false"
|
||||
inkscape:zoom="4.9166667"
|
||||
inkscape:cx="0.91525424"
|
||||
inkscape:cy="24"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="20"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<path
|
||||
d="M0 0h48v48H0z"
|
||||
fill="none"
|
||||
id="path4" />
|
||||
<path
|
||||
d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"
|
||||
id="path6"
|
||||
style="fill:#ffffff;fill-opacity:0.70;opacity:1;stroke:none;stroke-opacity:0.38039216" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -18,8 +18,10 @@ images = {
|
|||
'ic_search_white.svg' => ['ic_search_background_white', 144],
|
||||
'ic_no_results_white.svg' => ['ic_no_results_background_white', 144],
|
||||
'ic_no_results_black.svg' => ['ic_no_results_background_black', 144],
|
||||
'play_video.svg' => ['play_video', 128],
|
||||
'play_gif.svg' => ['play_gif', 128],
|
||||
'play_video_white.svg' => ['play_video_white', 128],
|
||||
'play_gif_white.svg' => ['play_gif_white', 128],
|
||||
'play_video_black.svg' => ['play_video_black', 128],
|
||||
'play_gif_black.svg' => ['play_gif_black', 128],
|
||||
'conversations_mono.svg' => ['ic_notification', 24],
|
||||
'ic_received_indicator.svg' => ['ic_received_indicator', 12],
|
||||
'ic_send_text_offline.svg' => ['ic_send_text_offline', 36],
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.util.Base64;
|
|||
import android.util.Base64OutputStream;
|
||||
import android.util.Log;
|
||||
import android.util.LruCache;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Closeable;
|
||||
|
@ -44,7 +43,6 @@ import java.security.DigestOutputStream;
|
|||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -675,7 +673,7 @@ public class FileBackend {
|
|||
thumbnail = rotate(thumbnail, getRotation(file));
|
||||
if (mime.equals("image/gif")) {
|
||||
Bitmap withGifOverlay = thumbnail.copy(Bitmap.Config.ARGB_8888, true);
|
||||
drawOverlay(withGifOverlay, R.drawable.play_gif, 1.0f);
|
||||
drawOverlay(withGifOverlay, paintOverlayBlack(withGifOverlay) ? R.drawable.play_gif_black : R.drawable.play_gif_white, 1.0f);
|
||||
thumbnail.recycle();
|
||||
thumbnail = withGifOverlay;
|
||||
}
|
||||
|
@ -708,6 +706,24 @@ public class FileBackend {
|
|||
canvas.drawBitmap(overlay, null, dst, createAntiAliasingPaint());
|
||||
}
|
||||
|
||||
/**
|
||||
* https://stackoverflow.com/a/3943023/210897
|
||||
*/
|
||||
private boolean paintOverlayBlack(final Bitmap bitmap) {
|
||||
int record = 0;
|
||||
for (int y = 0; y < bitmap.getHeight(); ++y) {
|
||||
for (int x = 0; x < bitmap.getWidth(); ++x) {
|
||||
int pixel = bitmap.getPixel(x, y);
|
||||
if ((Color.red(pixel) * 0.299 + Color.green(pixel) * 0.587 + Color.blue(pixel) * 0.114) > 186) {
|
||||
--record;
|
||||
} else {
|
||||
++record;
|
||||
}
|
||||
}
|
||||
}
|
||||
return record < 0;
|
||||
}
|
||||
|
||||
private Bitmap getVideoPreview(File file, int size) {
|
||||
MediaMetadataRetriever metadataRetriever = new MediaMetadataRetriever();
|
||||
Bitmap frame;
|
||||
|
@ -720,7 +736,7 @@ public class FileBackend {
|
|||
frame = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||
frame.eraseColor(0xff000000);
|
||||
}
|
||||
drawOverlay(frame, R.drawable.play_video, 0.75f);
|
||||
drawOverlay(frame, paintOverlayBlack(frame) ? R.drawable.play_video_black : R.drawable.play_video_white, 0.75f);
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 689 B |
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 773 B After Width: | Height: | Size: 773 B |
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 750 B |
Before Width: | Height: | Size: 776 B After Width: | Height: | Size: 776 B |
Before Width: | Height: | Size: 779 B After Width: | Height: | Size: 779 B |
Before Width: | Height: | Size: 687 B After Width: | Height: | Size: 687 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 707 B |
BIN
src/main/res/drawable-hdpi/play_gif_black.png
Normal file
After Width: | Height: | Size: 761 B |
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 791 B |
BIN
src/main/res/drawable-hdpi/play_video_black.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 596 B |
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 617 B |
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 610 B |
Before Width: | Height: | Size: 558 B After Width: | Height: | Size: 558 B |
Before Width: | Height: | Size: 568 B After Width: | Height: | Size: 568 B |
BIN
src/main/res/drawable-mdpi/play_gif_black.png
Normal file
After Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 612 B |
BIN
src/main/res/drawable-mdpi/play_video_black.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 739 B |
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 769 B |
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
Before Width: | Height: | Size: 915 B After Width: | Height: | Size: 915 B |
Before Width: | Height: | Size: 916 B After Width: | Height: | Size: 916 B |
Before Width: | Height: | Size: 935 B After Width: | Height: | Size: 935 B |
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 842 B |
BIN
src/main/res/drawable-xhdpi/play_gif_black.png
Normal file
After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-xhdpi/play_video_black.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/res/drawable-xxhdpi/play_gif_black.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
src/main/res/drawable-xxhdpi/play_video_black.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
src/main/res/drawable-xxxhdpi/play_gif_black.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
src/main/res/drawable-xxxhdpi/play_video_black.png
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |