Giter Site home page Giter Site logo

bernaferrari / carouselgifviewer Goto Github PK

View Code? Open in Web Editor NEW
35.0 3.0 3.0 1.77 MB

Efficiently display a list of GIFs in a carousel (RecyclerView).

License: Apache License 2.0

Kotlin 84.11% Java 15.89%
gif android kotlin rxjava2 sample-app recyclerview groupie exomedia exoplayer kotlin-android glide android-app android-application carousel

carouselgifviewer's Introduction

Carousel Gif Viewer

Carousel Gif Viewer

Codacy Badge

This app efficiently displays a list of GIFs in a carousel.

Motivation:

Displaying a list of GIFs is not something easy, it is:

  • Heavy;
  • Has a high chance of OOM error on low-end devices;
  • Quality is really low;
  • There is a high data usage, a video file can easily get 10x bigger.

On the other hand, displaying them as looping video (mp4) is not something trivial. ExoPlayer usually only allows to play 2 to 4 videos simultaneously. Besides this, RecyclerView really wasn't made to work well with players, with some recent tries successfully making around some of the limitations.

Carousel Gif Viewer

How it works:

After a lot of frustration, I came to the idea of this app (which is just an activity inside my other app). There is a DiscreteScrollView (which is a RecyclerView with a custom layoutManager) displaying the GIF preview (a jpg thumbnail), and a fixed ExoMedia player at the center of the screen playing a looping mp4 file. The trick is: the player doesn't go anywhere. When user scrolls, the player is hidden. As soon as the RecyclerView stops scrolling, the player is shown. Since it has the same size and corners as the images, everything works seamlessly. It also helps that Gfycat, which is used in this sample, generates the image thumbnail based on the first frame, so the video always starts playing from the same place as the picture is.

Current use case for this app is as a Brazilian Sign Language Dictionary on "Bíblia em Libras" (Bible in Brazilian Sign Language) app, under "Dicionário". Download it here.

Screenshots

Main Screen Drawer
First Sec

Side note

I tested the most popular GIF hosting sites, and Gfycat has been the best by far!

  • Tenor won't allow editing, removing, renaming or changing tags after a GIF is uploaded (unless you contact support).
  • Giphy is a mess, uploaded gifs won't show on search unless you are verified (and it is not easy to become verified); main channel page is a mess.
  • Gfycat allows to create albums and sort GIFs; support is great and fast; API just works; view count is great; GIFs with random names instead of random ids is also great.

Reporting Issues

Issues and Pull Requests are welcome. You can report here.

License

Copyright 2018 Bernardo Ferrari.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

carouselgifviewer's People

Contributors

bernaferrari avatar imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.