Android Open Source - MyFlickrSearch Image Viewer Activity






From Project

Back to project page MyFlickrSearch.

License

The source code is released under:

MIT License

If you think the Android project MyFlickrSearch 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.devng.flickrsearch;
//from   w w w .  j a v a  2  s . co  m
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Pair;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.devng.flickrsearch.common.Config;
import com.devng.flickrsearch.common.Enums;
import com.devng.flickrsearch.model.FlickrImgRef;
import com.devng.flickrsearch.task.DownloadFlickrImagesHandler;
import com.devng.flickrsearch.task.DownloadFlickrImagesTask;

import roboguice.inject.InjectView;

public class ImageViewerActivity extends AbstractBackButtonActivity
    implements DownloadFlickrImagesHandler {

  @InjectView(R.id.progressBar2)
  private ProgressBar progressBar;

  @InjectView(R.id.imageView2)
  private ImageView imageView;


  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_viewer);

    // get the search term and start the search on the server side via a task
    Intent sender = getIntent();
    FlickrImgRef imgRef = (FlickrImgRef) sender.getExtras().get(Config.EXTRA_KEY_FLICKR_REF);
    assert imgRef != null; // sanity check
    DownloadFlickrImagesTask task = new DownloadFlickrImagesTask(this, Enums.ImageSize.MEDIUM);
    task.execute(imgRef);

  }


  @Override
  public void onDownloadedFlickrImage(Pair<Bitmap, FlickrImgRef> pair) {
    imageView.setImageBitmap(pair.first);
    progressBar.setVisibility(View.GONE);
    imageView.setVisibility(View.VISIBLE);
  }


  @Override
  public void onDownloadFinish() {
  }
}




Java Source Code List

com.devng.flickrsearch.AbstractBackButtonActivity.java
com.devng.flickrsearch.ImageViewerActivity.java
com.devng.flickrsearch.MainActivity.java
com.devng.flickrsearch.MainModule.java
com.devng.flickrsearch.SearchResultsActivity.java
com.devng.flickrsearch.SearchResultsListAdapter.java
com.devng.flickrsearch.common.Config.java
com.devng.flickrsearch.common.Enums.java
com.devng.flickrsearch.common.Helpers.java
com.devng.flickrsearch.model.FlickrImgContainer.java
com.devng.flickrsearch.model.FlickrImgRef.java
com.devng.flickrsearch.model.FlickrImgRoot.java
com.devng.flickrsearch.task.DownloadFlickrImagesHandler.java
com.devng.flickrsearch.task.DownloadFlickrImagesTask.java
com.devng.flickrsearch.task.SearchFlickrResultHadler.java
com.devng.flickrsearch.task.SearchFlickrTask.java