Android Open Source - iwannawatch-android Movie






From Project

Back to project page iwannawatch-android.

License

The source code is released under:

MIT License

If you think the Android project iwannawatch-android 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.meoyawn.iwannawatch.models;
//from  w w w.  j  ava  2 s .com
import com.fasterxml.jackson.annotation.JsonProperty;

import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by adel on 3/1/14
 */
public class Movie {
    public static final  int[]            POSTER_SIZES     = {92, 154, 185, 342, 500};
    static final @NonNls SimpleDateFormat YEAR_DATE_FORMAT = new SimpleDateFormat("yyyy");

    public @JsonProperty("id") Long    _id;
    public                     String  title;
    public @Nullable           String  poster_path;
    public @Nullable           Date    release_date;
    public @Nullable           Date    createdAt;
    public                     boolean watched;

    int getPosterSize(int width) {
        for (int posterSize : POSTER_SIZES) {
            if (width <= posterSize) {
                return posterSize;
            }
        }
        return POSTER_SIZES[POSTER_SIZES.length - 1];
    }

    public String getPosterUrl(int width) {
        int posterSize = getPosterSize(width);
        String pathPrefix = posterSize < Integer.MAX_VALUE ?
                "w" + posterSize :
                "original";
        return "http://image.tmdb.org/t/p/" + pathPrefix + poster_path;
    }

    public String getReleaseYear() {
        return release_date != null ?
                YEAR_DATE_FORMAT.format(release_date) :
                "";
    }

    @Override public String toString() { return title; }
}




Java Source Code List

com.meoyawn.iwannawatch.AppModule.java
com.meoyawn.iwannawatch.App.java
com.meoyawn.iwannawatch.CrashReportingTree.java
com.meoyawn.iwannawatch.DynamicHeightImageView.java
com.meoyawn.iwannawatch.MainActivity.java
com.meoyawn.iwannawatch.MainFragment.java
com.meoyawn.iwannawatch.MovieView.java
com.meoyawn.iwannawatch.adapters.BaseMoviesAdapter.java
com.meoyawn.iwannawatch.adapters.CursorMoviesAdapter.java
com.meoyawn.iwannawatch.adapters.DynamicMoviesAdapter.java
com.meoyawn.iwannawatch.doers.DatabaseHelper.java
com.meoyawn.iwannawatch.doers.TheMovieDbApi.java
com.meoyawn.iwannawatch.models.Movie.java
com.meoyawn.iwannawatch.models.Search.java
com.meoyawn.iwannawatch.qualifiers.Delete.java
com.meoyawn.iwannawatch.qualifiers.Done.java