// Path: Reddit Headlines for DashClock/src/main/java/net/trolldad/dashclock/redditheadlines/imgur/ImgurAlbum.java
// public class ImgurAlbum implements Serializable {
//     public String id;
//     public String title;
//     public String description;
//     public DateTime datetime;
//     public String cover;
//     public String account_url;
//     public String privacy;
//     public String layout;
//     public long views;
//     public String link;
//     public String deletehash;
//     public int images_count;
//     public ImgurImage[] images;
// }
// 
// Path: Reddit Headlines for DashClock/src/main/java/net/trolldad/dashclock/redditheadlines/imgur/ImgurImage.java
// public class ImgurImage implements Serializable {
//     public static final String THUMB_SIZE_HUGE = "h";
//     public static final String ORIGINAL_SIZE = "";
//     public static final int MAX_WIDTH_OR_HEIGHT = 2048;
//     public String id;
//     public String title;
//     public String description;
//     public DateTime datetime;
//     public String type;
//     public boolean animated;
//     public int width;
//     public int height;
//     public long size;
//     public long views;
//     public long bandwidth;
//     public String deletehash;
//     public String section;
//     public String link;
// 
//     /**
//      * Gets a thumb, more info here: http://api.imgur.com/models/image
//      *
//      * @param suffix
//      * @return
//      */
//     public String getResizedImage(String suffix) {
//         // if they don't want a thumb, make sure the image is small enough to display
//         if (suffix.length() == 0 && (width > MAX_WIDTH_OR_HEIGHT || height > MAX_WIDTH_OR_HEIGHT)) {
//             suffix = THUMB_SIZE_HUGE;
//         }
//         int dotPosition = link.lastIndexOf(".");
//         StringBuilder thumbBuilder = new StringBuilder(link.substring(0, dotPosition));
//         thumbBuilder.append(suffix);
//         thumbBuilder.append(link.substring(dotPosition));
//         return thumbBuilder.toString();
//     }
// 
//     public boolean isHighQualityAvailable(int thumbDimension) {
//         return (width > thumbDimension || height > thumbDimension);
//     }
// }


import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import com.viewpagerindicator.UnderlinePageIndicator;
import net.trolldad.dashclock.redditheadlines.R;
import net.trolldad.dashclock.redditheadlines.imgur.ImgurAlbum;
import net.trolldad.dashclock.redditheadlines.imgur.ImgurImage;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.androidannotations.annotations.InstanceState;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;
package net.trolldad.dashclock.redditheadlines.fragment;





/**
 * Created by jacob-tabak on 1/19/14.
 */
@EFragment(R.layout.fragment_album_viewpager)
public class ImgurAlbumFragment extends Fragment {
    @FragmentArg
    ImgurAlbum mAlbum;

    @ViewById(R.id.album_placeholder)
    ImageView mPlaceholder;

    @ViewById(R.id.album_viewpager)
    ViewPager mPager;

    @ViewById(R.id.album_line_page_indicator)
    UnderlinePageIndicator mIndicator;

    @InstanceState
    int mCurrentPage;

    private AlbumAdapter mAdapter;

    @AfterViews
    void init() {
        mAdapter = new AlbumAdapter(getChildFragmentManager());
        mPager.setAdapter(mAdapter);
        mIndicator.setViewPager(mPager, mCurrentPage);
        mIndicator.setFades(false);
        updateImages(mAlbum.images);
    }

    @UiThread
// Path: Reddit Headlines for DashClock/src/main/java/net/trolldad/dashclock/redditheadlines/imgur/ImgurAlbum.java
// public class ImgurAlbum implements Serializable {
//     public String id;
//     public String title;
//     public String description;
//     public DateTime datetime;
//     public String cover;
//     public String account_url;
//     public String privacy;
//     public String layout;
//     public long views;
//     public String link;
//     public String deletehash;
//     public int images_count;
//     public ImgurImage[] images;
// }
// 
// Path: Reddit Headlines for DashClock/src/main/java/net/trolldad/dashclock/redditheadlines/imgur/ImgurImage.java
// public class ImgurImage implements Serializable {
//     public static final String THUMB_SIZE_HUGE = "h";
//     public static final String ORIGINAL_SIZE = "";
//     public static final int MAX_WIDTH_OR_HEIGHT = 2048;
//     public String id;
//     public String title;
//     public String description;
//     public DateTime datetime;
//     public String type;
//     public boolean animated;
//     public int width;
//     public int height;
//     public long size;
//     public long views;
//     public long bandwidth;
//     public String deletehash;
//     public String section;
//     public String link;
// 
//     /**
//      * Gets a thumb, more info here: http://api.imgur.com/models/image
//      *
//      * @param suffix
//      * @return
//      */
//     public String getResizedImage(String suffix) {
//         // if they don't want a thumb, make sure the image is small enough to display
//         if (suffix.length() == 0 && (width > MAX_WIDTH_OR_HEIGHT || height > MAX_WIDTH_OR_HEIGHT)) {
//             suffix = THUMB_SIZE_HUGE;
//         }
//         int dotPosition = link.lastIndexOf(".");
//         StringBuilder thumbBuilder = new StringBuilder(link.substring(0, dotPosition));
//         thumbBuilder.append(suffix);
//         thumbBuilder.append(link.substring(dotPosition));
//         return thumbBuilder.toString();
//     }
// 
//     public boolean isHighQualityAvailable(int thumbDimension) {
//         return (width > thumbDimension || height > thumbDimension);
//     }
// }


// Path: Reddit Headlines for DashClock/src/main/java/net/trolldad/dashclock/redditheadlines/fragment/ImgurAlbumFragment.java
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import com.viewpagerindicator.UnderlinePageIndicator;
import net.trolldad.dashclock.redditheadlines.R;
import net.trolldad.dashclock.redditheadlines.imgur.ImgurAlbum;
import net.trolldad.dashclock.redditheadlines.imgur.ImgurImage;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.androidannotations.annotations.InstanceState;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;

package net.trolldad.dashclock.redditheadlines.fragment;





/**
 * Created by jacob-tabak on 1/19/14.
 */
@EFragment(R.layout.fragment_album_viewpager)
public class ImgurAlbumFragment extends Fragment {
    @FragmentArg
    ImgurAlbum mAlbum;

    @ViewById(R.id.album_placeholder)
    ImageView mPlaceholder;

    @ViewById(R.id.album_viewpager)
    ViewPager mPager;

    @ViewById(R.id.album_line_page_indicator)
    UnderlinePageIndicator mIndicator;

    @InstanceState
    int mCurrentPage;

    private AlbumAdapter mAdapter;

    @AfterViews
    void init() {
        mAdapter = new AlbumAdapter(getChildFragmentManager());
        mPager.setAdapter(mAdapter);
        mIndicator.setViewPager(mPager, mCurrentPage);
        mIndicator.setFades(false);
        updateImages(mAlbum.images);
    }

    @UiThread
    void updateImages(ImgurImage[] images) {