Android Open Source - AndroidFlickrPlay Flickr Query Engine






From Project

Back to project page AndroidFlickrPlay.

License

The source code is released under:

Apache License

If you think the Android project AndroidFlickrPlay listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ufo.androidphotoviewer.flickr;
//from  ww  w .j a v  a  2s . c  o m
import android.content.Context;



/**
 * Use interfaces to generate Flickr Image ResultSet based on QueryCriteria
 * 
 * In future QueryCriteria can be extended to provide different search criteria 
 * which the engine will use to generate different ResultSet of images.
 * 
 * @author vlad
 *
 */
public class FlickrQueryEngine 
{
  // Broadcast messages to subscribe to for result of asynchronis query
  public static String GETTING_RESPONSE = "getting_response";
  public static String RESPONSE_FAIL = "response_fail";
  public static String GOT_RESPONSE = "response_done";
  public static String INTENT_RESULT_NAME = "result";  // Intent extra name of FlickrResultSet
  
  private FlickrServiceATask asyncTask = null; 
  private Context context;
  
  
  
  // Constructor
  public FlickrQueryEngine(Context c)
  {
    this.context = c;
  }
  
  public void AsynchronisQuery(FlickrQueryCriteria criteria)
  {
    try {
      if (asyncTask!=null) asyncTask.cancel(true);
      asyncTask = new FlickrServiceATask(criteria, context);  
      asyncTask.execute();
    } catch (Exception e) {
      System.out.println("FlickrQueryEngine.AsynchronisQuery() Exception");
      e.printStackTrace();
    }
  }
  
  
  
  public FlickrResultSet SynchronisQuery(FlickrQueryCriteria criteria)
  {
    FlickrResultSet result = null;
    try {
      if (asyncTask!=null) asyncTask.cancel(true);
      asyncTask = new FlickrServiceATask(criteria, context);  
      result = asyncTask.execute().get();
    } catch (Exception e) {
      System.out.println("FlickrQueryEngine.SynchronisQuery() Exception");
      e.printStackTrace();
    }
    return result;
  }
}




Java Source Code List

com.ufo.androidphotoviewer.MainActivity.java
com.ufo.androidphotoviewer.flickr.FlickrImage.java
com.ufo.androidphotoviewer.flickr.FlickrQueryCriteria.java
com.ufo.androidphotoviewer.flickr.FlickrQueryEngine.java
com.ufo.androidphotoviewer.flickr.FlickrResultSet.java
com.ufo.androidphotoviewer.flickr.FlickrServiceATask.java