Giter Site home page Giter Site logo

androidgoogleimages's Introduction

#AndroidGoogleImages#

This is a Test project using the deprecated Google Images Ajax API to display images in a 3 column grid.

###Libraries###

###Notes###

  • Google API allows a maximum of 8 images per request. Since I have 3 columns, I am downloading the images 6 by 6. If I wanted to download 8, I would have to make some changes to the ImageAdapter, to add a possible empty view in the last column, on top of the 3 items I added (a new row) for the loading views. See ImageAdapter for code and comments.

  • Google API only allows 8 pages, so total number of images I request is 8*6 = 48 (Not reaching the suggested 50 limit).

  • I could hace implemented caches myself. In that case, I would probably have used a LRUCache caching bitmaps for memory. writing to that cache could be done in bg, always synchronizing the calls. Reading should happen in the Adapter and UI thread. For disk cache, I could store the images in the External Drive, and read them in a bg thread.

  • Note on Fragments: A better implementation would be to have the GridView in a Fragment, so that orientation changes wouldn't destroy it, and it could be used in other views/devices. I didn't implement Fragments just for simplicity.

  • In ImageAdapter, I didn't use XML layouts to create my views for simplicity. They are simply ImageView's, and even though it is good practice to have design separeted from the logic, it is also known that inflating XML layouts is expensive and in an adapter, you want to be as fast as possible.

  • I specified minLevel 11, because I use addAll method in ArrayAdapter. It could easily change down to 8, and implement that simple method my own. I did not put too much attention to API level details.

androidgoogleimages's People

Contributors

mcohnen avatar

Watchers

 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.