├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── gabilheri
│ │ └── moviestmdb
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── gabilheri
│ │ └── moviestmdb
│ │ ├── App.java
│ │ ├── dagger
│ │ ├── AppScope.java
│ │ ├── components
│ │ │ └── ApplicationComponent.java
│ │ └── modules
│ │ │ ├── ApplicationModule.java
│ │ │ └── HttpClientModule.java
│ │ ├── data
│ │ ├── Api
│ │ │ └── TheMovieDbAPI.java
│ │ └── models
│ │ │ ├── CastMember.java
│ │ │ ├── CreditsResponse.java
│ │ │ ├── CrewMember.java
│ │ │ ├── Genre.java
│ │ │ ├── Movie.java
│ │ │ ├── MovieDetails.java
│ │ │ ├── MovieResponse.java
│ │ │ ├── PaletteColors.java
│ │ │ ├── Person.java
│ │ │ ├── Video.java
│ │ │ └── VideoResponse.java
│ │ └── ui
│ │ ├── base
│ │ ├── BindableCardView.java
│ │ └── GlideBackgroundManager.java
│ │ ├── main
│ │ ├── MainActivity.java
│ │ ├── MainFragment.java
│ │ └── MovieRow.java
│ │ └── movies
│ │ ├── MovieCardView.java
│ │ └── MoviePresenter.java
│ └── res
│ ├── drawable-nodpi
│ ├── material_bg.jpg
│ ├── popcorn.png
│ └── powered_by.png
│ ├── drawable
│ ├── banner.png
│ └── ic_star.xml
│ ├── layout
│ ├── activity_base.xml
│ ├── card_movie.xml
│ └── main_activity.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ └── values
│ ├── colors.xml
│ ├── dimen.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
├── cast_kf.png
├── cast_page.png
├── details.png
├── details_cast.png
├── details_recommendations.png
├── details_similar.png
├── home.png
├── home_collapsed.png
└── search.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Built application files
3 | *.apk
4 | *.ap_
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
36 | # IntelliJ
37 | *.iml
38 | .idea/workspace.xml
39 | .idea/tasks.xml
40 | .idea/gradle.xml
41 | .idea/assetWizardSettings.xml
42 | .idea/dictionaries
43 | .idea/libraries
44 | .idea/caches
45 |
46 | # Keystore files
47 | # Uncomment the following line if you do not want to check your keystore files in.
48 | #*.jks
49 |
50 | # External native build folder generated in Android Studio 2.2 and later
51 | .externalNativeBuild
52 |
53 | # Google Services (e.g. APIs or Firebase)
54 | google-services.json
55 |
56 | # Freeline
57 | freeline.py
58 | freeline/
59 | freeline_project_description.json
60 |
61 | # fastlane
62 | fastlane/report.xml
63 | fastlane/Preview.html
64 | fastlane/screenshots
65 | fastlane/test_output
66 | fastlane/readme.md
67 |
68 | *Config.java*
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MoviesTMDB
2 |
3 | Android TV tutorial of how to build a TMDB client to browse movies
4 |
5 | This project will be divided into several parts.
6 | * Skeleton
7 | * Part 1
8 | * Part 2
9 | * ...
10 | * Final
11 |
12 | ### Screenshots
13 |
14 | 
15 | 
16 | 
17 | 
18 | 
19 | 
20 | 
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 | dependencies {
6 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
7 | classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.3'
8 | }
9 | }
10 |
11 | repositories {
12 | maven { url "https://jitpack.io" }
13 | flatDir {
14 | dirs 'libs'
15 | }
16 | }
17 |
18 | apply plugin: 'com.android.application'
19 | apply plugin: 'com.getkeepsafe.dexcount'
20 | apply plugin: 'com.android.application'
21 |
22 | android {
23 | compileSdkVersion 27
24 | buildToolsVersion "28.0.1"
25 | defaultConfig {
26 | applicationId "com.gabilheri.moviestmdb"
27 | minSdkVersion 21
28 | targetSdkVersion 27
29 | versionCode 1
30 | versionName "1.0"
31 | }
32 | buildTypes {
33 | release {
34 | minifyEnabled false
35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
36 | }
37 | }
38 |
39 | packagingOptions {
40 | exclude '.readme'
41 | exclude 'LICENSE.txt'
42 | exclude 'META-INF/DEPENDENCIES'
43 | exclude 'META-INF/DEPENDENCIES.txt'
44 | exclude 'META-INF/LGPL2.1'
45 | exclude 'META-INF/LICENSE'
46 | exclude 'META-INF/LICENSE.txt'
47 | exclude 'META-INF/NOTICE'
48 | exclude 'META-INF/NOTICE.txt'
49 | exclude 'META-INF/README.txt'
50 | exclude 'META-INF/dependencies.txt'
51 | exclude 'META-INF/license.txt'
52 | exclude 'META-INF/notice.txt'
53 | exclude 'META-INF/maven/com.squareup.okhttp/okhttp/pom.xml'
54 | exclude 'META-INF/maven/com.squareup.okhttp/okhttp/pom.properties'
55 | exclude 'META-INF/maven/com.squareup/otto/pom.xml'
56 | exclude 'META-INF/maven/com.squareup/otto/pom.properties'
57 | exclude 'META-INF/services/javax.annotation.processing.Processor'
58 | }
59 |
60 | compileOptions {
61 | sourceCompatibility JavaVersion.VERSION_1_8
62 | targetCompatibility JavaVersion.VERSION_1_8
63 | }
64 |
65 | }
66 |
67 | tasks.whenTaskAdded { task ->
68 | if (task.name.equals("lint")) {
69 | task.enabled = false
70 | }
71 | }
72 |
73 | dependencies {
74 | implementation fileTree(dir: 'libs', include: ['*.jar'])
75 |
76 | String supportLibVersion = "27.1.1"
77 | String retrofitVersion = "2.1.0"
78 | String okHttpVersion = "3.4.1"
79 |
80 | // Google Support Libraries
81 | implementation "com.android.support:appcompat-v7:${supportLibVersion}"
82 | implementation "com.android.support:cardview-v7:${supportLibVersion}"
83 | implementation "com.android.support:support-annotations:${supportLibVersion}"
84 | implementation "com.android.support:support-v13:${supportLibVersion}"
85 | implementation "com.android.support:support-v4:${supportLibVersion}"
86 | implementation "com.android.support:palette-v7:${supportLibVersion}"
87 | implementation "com.android.support:design:${supportLibVersion}"
88 | implementation "com.android.support:recyclerview-v7:${supportLibVersion}"
89 | implementation "com.android.support:customtabs:${supportLibVersion}"
90 | implementation "com.android.support:leanback-v17:${supportLibVersion}"
91 |
92 | // Base stuff
93 | implementation 'io.reactivex:rxandroid:1.2.1'
94 | implementation 'io.reactivex:rxjava:1.2.7'
95 | implementation 'com.squareup.sqlbrite:sqlbrite:0.7.0'
96 |
97 | // Network
98 | implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
99 | implementation "com.squareup.retrofit2:converter-moshi:${retrofitVersion}"
100 | implementation "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
101 | implementation "com.squareup.okhttp3:okhttp:${okHttpVersion}"
102 | implementation "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}"
103 | implementation 'com.github.bumptech.glide:glide:3.7.0'
104 |
105 | // Logging
106 | implementation 'com.jakewharton.timber:timber:4.5.1'
107 |
108 | // Dependency Injection
109 | annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
110 | implementation 'com.google.dagger:dagger:2.11'
111 | compileOnly 'javax.annotation:jsr250-api:1.0'
112 |
113 | implementation 'com.jakewharton:butterknife:8.5.1'
114 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
115 | implementation('com.mikepenz:aboutlibraries:5.5.9@aar') {
116 | transitive = true
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/marcus/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/gabilheri/moviestmdb/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
14 |
15 |
22 |
23 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/App.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb;
2 |
3 | import android.app.Application;
4 |
5 | import com.gabilheri.moviestmdb.dagger.components.ApplicationComponent;
6 | import com.gabilheri.moviestmdb.dagger.components.DaggerApplicationComponent;
7 | import com.gabilheri.moviestmdb.dagger.modules.ApplicationModule;
8 | import com.gabilheri.moviestmdb.dagger.modules.HttpClientModule;
9 |
10 | import timber.log.Timber;
11 |
12 | /**
13 | * Created by Marcus Gabilheri
14 | *
15 | * @author Marcus Gabilheri
16 | * @version 1.0
17 | * @since 10/11/16.
18 | */
19 |
20 | public class App extends Application {
21 |
22 | private static App instance;
23 | private ApplicationComponent mApplicationComponent;
24 |
25 | @Override
26 | public void onCreate() {
27 | super.onCreate();
28 | instance = this;
29 |
30 | if (BuildConfig.DEBUG) {
31 | Timber.plant(new Timber.DebugTree());
32 | }
33 |
34 | // Creates Dagger Graph
35 | mApplicationComponent = DaggerApplicationComponent.builder()
36 | .applicationModule(new ApplicationModule(this))
37 | .httpClientModule(new HttpClientModule())
38 | .build();
39 |
40 | mApplicationComponent.inject(this);
41 | }
42 |
43 | public static App instance() {
44 | return instance;
45 | }
46 |
47 | public ApplicationComponent appComponent() {
48 | return mApplicationComponent;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/dagger/AppScope.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.dagger;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | import javax.inject.Scope;
7 |
8 | @Scope
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface AppScope {
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/dagger/components/ApplicationComponent.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.dagger.components;
2 |
3 |
4 | import com.gabilheri.moviestmdb.App;
5 | import com.gabilheri.moviestmdb.dagger.AppScope;
6 | import com.gabilheri.moviestmdb.dagger.modules.ApplicationModule;
7 | import com.gabilheri.moviestmdb.dagger.modules.HttpClientModule;
8 | import com.gabilheri.moviestmdb.ui.main.MainFragment;
9 |
10 | import javax.inject.Singleton;
11 |
12 | import dagger.Component;
13 |
14 | /**
15 | * Created by Marcus Gabilheri
16 | *
17 | * @author Marcus Gabilheri
18 | * @version 1.0
19 | * @since 9/4/16.
20 | */
21 | @AppScope
22 | @Singleton
23 | @Component(modules = {
24 | ApplicationModule.class,
25 | HttpClientModule.class,
26 | })
27 | public interface ApplicationComponent {
28 |
29 | void inject(App app);
30 | void inject(MainFragment mainFragment);
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/dagger/modules/ApplicationModule.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.dagger.modules;
2 |
3 | import android.app.Application;
4 |
5 | import javax.inject.Singleton;
6 |
7 | import dagger.Module;
8 | import dagger.Provides;
9 |
10 | /**
11 | * Created by Marcus Gabilheri
12 | *
13 | * @author Marcus Gabilheri
14 | * @version 1.0
15 | * @since 9/4/16.
16 | */
17 | @Module
18 | public class ApplicationModule {
19 |
20 | Application mApplication;
21 |
22 | public ApplicationModule(Application application) {
23 | mApplication = application;
24 | }
25 |
26 | @Singleton
27 | @Provides
28 | Application providesApplication() {
29 | return mApplication;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/dagger/modules/HttpClientModule.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.dagger.modules;
2 |
3 | import android.app.Application;
4 |
5 | import com.gabilheri.moviestmdb.dagger.AppScope;
6 | import com.gabilheri.moviestmdb.data.Api.TheMovieDbAPI;
7 |
8 | import java.io.File;
9 | import java.util.concurrent.TimeUnit;
10 |
11 | import javax.inject.Named;
12 |
13 | import dagger.Module;
14 | import dagger.Provides;
15 | import okhttp3.OkHttpClient;
16 | import okhttp3.logging.HttpLoggingInterceptor;
17 | import retrofit2.Retrofit;
18 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
19 | import retrofit2.converter.moshi.MoshiConverterFactory;
20 |
21 | /**
22 | * Created by Marcus Gabilheri
23 | *
24 | * @author Marcus Gabilheri
25 | * @version 1.0
26 | * @since 9/4/16.
27 | */
28 | @Module
29 | public class HttpClientModule {
30 |
31 | private static final long DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
32 |
33 | public static final String BACKDROP_URL = "http://image.tmdb.org/t/p/w1280";
34 | public static final String POSTER_URL = "http://image.tmdb.org/t/p/w500";
35 | public static final String API_URL = "https://api.themoviedb.org/3/";
36 | public static final String NOW_PLAYING = "movie/now_playing";
37 | public static final String LATEST = "movie/latest";
38 | public static final String POPULAR = "movie/popular";
39 | public static final String TOP_RATED = "movie/top_rated";
40 | public static final String UPCOMING = "movie/upcoming";
41 | public static final String MOVIE = "movie/";
42 | public static final String PERSON = "person/";
43 | public static final String DISCOVER = "discover/movie/";
44 | public static final String SEARCH_MOVIE = "search/movie/";
45 | public static final String TV = "tv/";
46 |
47 | @Provides
48 | @AppScope
49 | public OkHttpClient provideOkHttpClient(Application app) {
50 | File cacheDir = new File(app.getCacheDir(), "http");
51 | return new OkHttpClient.Builder()
52 | .readTimeout(1, TimeUnit.MINUTES)
53 | .connectTimeout(1, TimeUnit.MINUTES)
54 | .writeTimeout(1, TimeUnit.MINUTES)
55 | .cache(new okhttp3.Cache(cacheDir, DISK_CACHE_SIZE))
56 | .build();
57 | }
58 |
59 | @Provides
60 | @Named("TVDB") // Name is used in case a second Retrofit api is provided.
61 | @AppScope
62 | public Retrofit provideTVDBRestAdapter(MoshiConverterFactory moshiConverterFactory, OkHttpClient okHttpClient) {
63 | HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
64 | interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
65 | okHttpClient = okHttpClient.newBuilder()
66 | .addInterceptor(interceptor)
67 | .build();
68 | return new Retrofit.Builder()
69 | .baseUrl(API_URL)
70 | .client(okHttpClient)
71 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
72 | .addConverterFactory(moshiConverterFactory)
73 | .build();
74 | }
75 |
76 | @Provides
77 | public TheMovieDbAPI provideFithubApi(@Named("movieDB") Retrofit restAdapter) {
78 | return restAdapter.create(TheMovieDbAPI.class);
79 | }
80 |
81 | @Provides
82 | @AppScope
83 | public MoshiConverterFactory provideMoshiConverterFactory() {
84 | return MoshiConverterFactory.create();
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/Api/TheMovieDbAPI.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.Api;
2 |
3 | import com.gabilheri.moviestmdb.dagger.modules.HttpClientModule;
4 | import com.gabilheri.moviestmdb.data.models.CreditsResponse;
5 | import com.gabilheri.moviestmdb.data.models.MovieDetails;
6 | import com.gabilheri.moviestmdb.data.models.MovieResponse;
7 | import com.gabilheri.moviestmdb.data.models.Person;
8 | import com.gabilheri.moviestmdb.data.models.VideoResponse;
9 |
10 | import retrofit2.http.GET;
11 | import retrofit2.http.Path;
12 | import retrofit2.http.Query;
13 | import rx.Observable;
14 |
15 | /**
16 | * Created by Marcus Gabilheri
17 | *
18 | * @author Marcus Gabilheri
19 | * @version 1.0
20 | * @since 10/8/16.
21 | */
22 |
23 | public interface TheMovieDbAPI {
24 |
25 | @GET(HttpClientModule.NOW_PLAYING)
26 | Observable getNowPlayingMovies(
27 | @Query("api_key") String apiKey,
28 | @Query("page") int page
29 | );
30 |
31 | @GET(HttpClientModule.TOP_RATED)
32 | Observable getTopRatedMovies(
33 | @Query("api_key") String apiKey,
34 | @Query("page") int page
35 | );
36 |
37 | @GET(HttpClientModule.UPCOMING)
38 | Observable getUpcomingMovies(
39 | @Query("api_key") String apiKey,
40 | @Query("page") int page
41 | );
42 |
43 | @GET(HttpClientModule.POPULAR)
44 | Observable getPopularMovies(
45 | @Query("api_key") String apiKey,
46 | @Query("page") int page
47 | );
48 |
49 | @GET(HttpClientModule.MOVIE + "{id}/similar")
50 | Observable getSimilarMovies(
51 | @Path("id") String movieId,
52 | @Query("api_key") String apiKey
53 | );
54 |
55 | @GET(HttpClientModule.MOVIE + "{id}/recommendations")
56 | Observable getRecommendations(
57 | @Path("id") String movieId,
58 | @Query("api_key") String apiKey
59 | );
60 |
61 | @GET(HttpClientModule.MOVIE + "{id}/credits")
62 | Observable getCredits(
63 | @Path("id") String movieId,
64 | @Query("api_key") String apiKey
65 | );
66 |
67 | @GET(HttpClientModule.MOVIE + "{id}")
68 | Observable getMovieDetails(
69 | @Path("id") String movieId,
70 | @Query("api_key") String apiKey
71 | );
72 |
73 | @GET(HttpClientModule.MOVIE + "{id}/videos")
74 | Observable getMovieVideos(
75 | @Path("id") String movieId,
76 | @Query("api_key") String apiKey
77 | );
78 |
79 | @GET(HttpClientModule.PERSON + "{id}")
80 | Observable getPerson(
81 | @Path("id") int personId,
82 | @Query("api_key") String apiKey
83 | );
84 |
85 | @GET(HttpClientModule.DISCOVER)
86 | Observable getMoviesForCastID(
87 | @Query("with_cast") int castId,
88 | @Query("api_key") String apiKey
89 | );
90 |
91 | @GET(HttpClientModule.SEARCH_MOVIE)
92 | Observable searchMovies(
93 | @Query("query") String query,
94 | @Query("api_key") String apiKey
95 | );
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/CastMember.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.squareup.moshi.Json;
7 |
8 | /**
9 | * Created by Marcus Gabilheri
10 | *
11 | * @author Marcus Gabilheri
12 | * @version 1.0
13 | * @since 10/9/16.
14 | */
15 |
16 | public class CastMember implements Parcelable {
17 |
18 | private int id;
19 | private String character;
20 | private String name;
21 | private int order;
22 |
23 | @Json(name = "cast_id")
24 | private int castId;
25 |
26 | @Json(name = "credit_id")
27 | private String creditId;
28 |
29 | @Json(name = "profile_path")
30 | private String profilePath;
31 |
32 | public CastMember() {
33 | }
34 |
35 | public int getId() {
36 | return id;
37 | }
38 |
39 | public CastMember setId(int id) {
40 | this.id = id;
41 | return this;
42 | }
43 |
44 | public int getCastId() {
45 | return castId;
46 | }
47 |
48 | public CastMember setCastId(int castId) {
49 | this.castId = castId;
50 | return this;
51 | }
52 |
53 | public String getCharacter() {
54 | return character;
55 | }
56 |
57 | public CastMember setCharacter(String character) {
58 | this.character = character;
59 | return this;
60 | }
61 |
62 | public String getCreditId() {
63 | return creditId;
64 | }
65 |
66 | public CastMember setCreditId(String creditId) {
67 | this.creditId = creditId;
68 | return this;
69 | }
70 |
71 | public String getName() {
72 | return name;
73 | }
74 |
75 | public CastMember setName(String name) {
76 | this.name = name;
77 | return this;
78 | }
79 |
80 | public int getOrder() {
81 | return order;
82 | }
83 |
84 | public CastMember setOrder(int order) {
85 | this.order = order;
86 | return this;
87 | }
88 |
89 | public String getProfilePath() {
90 | return profilePath;
91 | }
92 |
93 | public CastMember setProfilePath(String profilePath) {
94 | this.profilePath = profilePath;
95 | return this;
96 | }
97 |
98 | @Override
99 | public int describeContents() {
100 | return 0;
101 | }
102 |
103 | @Override
104 | public void writeToParcel(Parcel dest, int flags) {
105 | dest.writeInt(this.id);
106 | dest.writeString(this.character);
107 | dest.writeString(this.name);
108 | dest.writeInt(this.order);
109 | dest.writeInt(this.castId);
110 | dest.writeString(this.creditId);
111 | dest.writeString(this.profilePath);
112 | }
113 |
114 | protected CastMember(Parcel in) {
115 | this.id = in.readInt();
116 | this.character = in.readString();
117 | this.name = in.readString();
118 | this.order = in.readInt();
119 | this.castId = in.readInt();
120 | this.creditId = in.readString();
121 | this.profilePath = in.readString();
122 | }
123 |
124 | public static final Creator CREATOR = new Creator() {
125 | @Override
126 | public CastMember createFromParcel(Parcel source) {
127 | return new CastMember(source);
128 | }
129 |
130 | @Override
131 | public CastMember[] newArray(int size) {
132 | return new CastMember[size];
133 | }
134 | };
135 | }
136 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/CreditsResponse.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Marcus Gabilheri
7 | *
8 | * @author Marcus Gabilheri
9 | * @version 1.0
10 | * @since 10/9/16.
11 | */
12 |
13 | public class CreditsResponse {
14 |
15 | private int id;
16 | private List cast;
17 | private List crew;
18 |
19 | public CreditsResponse() {
20 | }
21 |
22 | public int getId() {
23 | return id;
24 | }
25 |
26 | public CreditsResponse setId(int id) {
27 | this.id = id;
28 | return this;
29 | }
30 |
31 | public List getCast() {
32 | return cast;
33 | }
34 |
35 | public CreditsResponse setCast(List cast) {
36 | this.cast = cast;
37 | return this;
38 | }
39 |
40 | public List getCrew() {
41 | return crew;
42 | }
43 |
44 | public CreditsResponse setCrew(List crew) {
45 | this.crew = crew;
46 | return this;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/CrewMember.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.squareup.moshi.Json;
7 |
8 | /**
9 | * Created by Marcus Gabilheri
10 | *
11 | * @author Marcus Gabilheri
12 | * @version 1.0
13 | * @since 10/10/16.
14 | */
15 |
16 | public class CrewMember implements Parcelable {
17 |
18 | private int id;
19 | private String job;
20 | private String name;
21 | private String department;
22 |
23 | @Json(name = "profile_path")
24 | private String profilePath;
25 |
26 | public CrewMember() {
27 | }
28 |
29 | public int getId() {
30 | return id;
31 | }
32 |
33 | public CrewMember setId(int id) {
34 | this.id = id;
35 | return this;
36 | }
37 |
38 | public String getJob() {
39 | return job;
40 | }
41 |
42 | public CrewMember setJob(String job) {
43 | this.job = job;
44 | return this;
45 | }
46 |
47 | public String getName() {
48 | return name;
49 | }
50 |
51 | public CrewMember setName(String name) {
52 | this.name = name;
53 | return this;
54 | }
55 |
56 | public String getDepartment() {
57 | return department;
58 | }
59 |
60 | public CrewMember setDepartment(String department) {
61 | this.department = department;
62 | return this;
63 | }
64 |
65 | public String getProfilePath() {
66 | return profilePath;
67 | }
68 |
69 | public CrewMember setProfilePath(String profilePath) {
70 | this.profilePath = profilePath;
71 | return this;
72 | }
73 |
74 | @Override
75 | public int describeContents() {
76 | return 0;
77 | }
78 |
79 | @Override
80 | public void writeToParcel(Parcel dest, int flags) {
81 | dest.writeInt(this.id);
82 | dest.writeString(this.job);
83 | dest.writeString(this.name);
84 | dest.writeString(this.department);
85 | dest.writeString(this.profilePath);
86 | }
87 |
88 | protected CrewMember(Parcel in) {
89 | this.id = in.readInt();
90 | this.job = in.readString();
91 | this.name = in.readString();
92 | this.department = in.readString();
93 | this.profilePath = in.readString();
94 | }
95 |
96 | public static final Creator CREATOR = new Creator() {
97 | @Override
98 | public CrewMember createFromParcel(Parcel source) {
99 | return new CrewMember(source);
100 | }
101 |
102 | @Override
103 | public CrewMember[] newArray(int size) {
104 | return new CrewMember[size];
105 | }
106 | };
107 | }
108 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/Genre.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * Created by Marcus Gabilheri
8 | *
9 | * @author Marcus Gabilheri
10 | * @version 1.0
11 | * @since 10/9/16.
12 | */
13 |
14 | public class Genre implements Parcelable {
15 |
16 | private int id;
17 | private String name;
18 |
19 | public Genre() {
20 | }
21 |
22 | public int getId() {
23 | return id;
24 | }
25 |
26 | public Genre setId(int id) {
27 | this.id = id;
28 | return this;
29 | }
30 |
31 | public String getName() {
32 | return name;
33 | }
34 |
35 | public Genre setName(String name) {
36 | this.name = name;
37 | return this;
38 | }
39 |
40 | @Override
41 | public int describeContents() {
42 | return 0;
43 | }
44 |
45 | @Override
46 | public void writeToParcel(Parcel dest, int flags) {
47 | dest.writeInt(this.id);
48 | dest.writeString(this.name);
49 | }
50 |
51 | protected Genre(Parcel in) {
52 | this.id = in.readInt();
53 | this.name = in.readString();
54 | }
55 |
56 | public static final Creator CREATOR = new Creator() {
57 | @Override
58 | public Genre createFromParcel(Parcel source) {
59 | return new Genre(source);
60 | }
61 |
62 | @Override
63 | public Genre[] newArray(int size) {
64 | return new Genre[size];
65 | }
66 | };
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/Movie.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.squareup.moshi.Json;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by Marcus Gabilheri
12 | *
13 | * @author Marcus Gabilheri
14 | * @version 1.0
15 | * @since 10/8/16.
16 | */
17 |
18 | public class Movie implements Parcelable {
19 |
20 | private String id;
21 |
22 | @Json(name = "poster_path")
23 | private String posterPath;
24 |
25 | private boolean adult;
26 | private String overview;
27 |
28 | @Json(name = "release_date")
29 | private String releaseDate;
30 |
31 | @Json(name = "genre_ids")
32 | private List genreIds;
33 |
34 | @Json(name = "original_title")
35 | private String originalTitle;
36 |
37 | @Json(name = "original_language")
38 | private String originalLanguage;
39 |
40 | private String title;
41 |
42 | @Json(name = "backdrop_path")
43 | private String backdropPath;
44 |
45 | private float popularity;
46 |
47 | @Json(name = "vote_count")
48 | private int voteCount;
49 |
50 | private boolean video;
51 |
52 | @Json(name = "vote_average")
53 | private float voteAverage;
54 |
55 | public Movie() {
56 | }
57 |
58 | public String getId() {
59 | return id;
60 | }
61 |
62 | public Movie setId(String id) {
63 | this.id = id;
64 | return this;
65 | }
66 |
67 | public String getPosterPath() {
68 | return posterPath;
69 | }
70 |
71 | public Movie setPosterPath(String posterPath) {
72 | this.posterPath = posterPath;
73 | return this;
74 | }
75 |
76 | public boolean isAdult() {
77 | return adult;
78 | }
79 |
80 | public Movie setAdult(boolean adult) {
81 | this.adult = adult;
82 | return this;
83 | }
84 |
85 | public String getOverview() {
86 | return overview;
87 | }
88 |
89 | public Movie setOverview(String overview) {
90 | this.overview = overview;
91 | return this;
92 | }
93 |
94 | public String getReleaseDate() {
95 | return releaseDate;
96 | }
97 |
98 | public Movie setReleaseDate(String releaseDate) {
99 | this.releaseDate = releaseDate;
100 | return this;
101 | }
102 |
103 | public List getGenreIds() {
104 | return genreIds;
105 | }
106 |
107 | public Movie setGenreIds(List genreIds) {
108 | this.genreIds = genreIds;
109 | return this;
110 | }
111 |
112 | public String getOriginalTitle() {
113 | return originalTitle;
114 | }
115 |
116 | public Movie setOriginalTitle(String originalTitle) {
117 | this.originalTitle = originalTitle;
118 | return this;
119 | }
120 |
121 | public String getOriginalLanguage() {
122 | return originalLanguage;
123 | }
124 |
125 | public Movie setOriginalLanguage(String originalLanguage) {
126 | this.originalLanguage = originalLanguage;
127 | return this;
128 | }
129 |
130 | public String getTitle() {
131 | return title;
132 | }
133 |
134 | public Movie setTitle(String title) {
135 | this.title = title;
136 | return this;
137 | }
138 |
139 | public String getBackdropPath() {
140 | return backdropPath;
141 | }
142 |
143 | public Movie setBackdropPath(String backdropPath) {
144 | this.backdropPath = backdropPath;
145 | return this;
146 | }
147 |
148 | public float getPopularity() {
149 | return popularity;
150 | }
151 |
152 | public Movie setPopularity(float popularity) {
153 | this.popularity = popularity;
154 | return this;
155 | }
156 |
157 | public int getVoteCount() {
158 | return voteCount;
159 | }
160 |
161 | public Movie setVoteCount(int voteCount) {
162 | this.voteCount = voteCount;
163 | return this;
164 | }
165 |
166 | public boolean isVideo() {
167 | return video;
168 | }
169 |
170 | public Movie setVideo(boolean video) {
171 | this.video = video;
172 | return this;
173 | }
174 |
175 | public float getVoteAverage() {
176 | return voteAverage;
177 | }
178 |
179 | public Movie setVoteAverage(float voteAverage) {
180 | this.voteAverage = voteAverage;
181 | return this;
182 | }
183 |
184 | @Override
185 | public int describeContents() {
186 | return 0;
187 | }
188 |
189 | @Override
190 | public void writeToParcel(Parcel dest, int flags) {
191 | dest.writeString(this.id);
192 | dest.writeString(this.posterPath);
193 | dest.writeByte(this.adult ? (byte) 1 : (byte) 0);
194 | dest.writeString(this.overview);
195 | dest.writeString(this.releaseDate);
196 | dest.writeStringList(this.genreIds);
197 | dest.writeString(this.originalTitle);
198 | dest.writeString(this.originalLanguage);
199 | dest.writeString(this.title);
200 | dest.writeString(this.backdropPath);
201 | dest.writeFloat(this.popularity);
202 | dest.writeInt(this.voteCount);
203 | dest.writeByte(this.video ? (byte) 1 : (byte) 0);
204 | dest.writeFloat(this.voteAverage);
205 | }
206 |
207 | protected Movie(Parcel in) {
208 | this.id = in.readString();
209 | this.posterPath = in.readString();
210 | this.adult = in.readByte() != 0;
211 | this.overview = in.readString();
212 | this.releaseDate = in.readString();
213 | this.genreIds = in.createStringArrayList();
214 | this.originalTitle = in.readString();
215 | this.originalLanguage = in.readString();
216 | this.title = in.readString();
217 | this.backdropPath = in.readString();
218 | this.popularity = in.readFloat();
219 | this.voteCount = in.readInt();
220 | this.video = in.readByte() != 0;
221 | this.voteAverage = in.readFloat();
222 | }
223 |
224 | public static final Creator CREATOR = new Creator() {
225 | @Override
226 | public Movie createFromParcel(Parcel source) {
227 | return new Movie(source);
228 | }
229 |
230 | @Override
231 | public Movie[] newArray(int size) {
232 | return new Movie[size];
233 | }
234 | };
235 | }
236 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/MovieDetails.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.squareup.moshi.Json;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by Marcus Gabilheri
12 | *
13 | * @author Marcus Gabilheri
14 | * @version 1.0
15 | * @since 10/9/16.
16 | */
17 |
18 | public class MovieDetails implements Parcelable {
19 |
20 | private boolean adult;
21 | private String overview;
22 | private boolean video;
23 | private List genres;
24 | private String title;
25 | private float popularity;
26 | private int budget;
27 | private int runtime;
28 | private int revenue;
29 | private String tagline;
30 | private String status;
31 |
32 | @Json(name = "release_date")
33 | private String releaseDate;
34 |
35 | @Json(name = "poster_path")
36 | private String posterPath;
37 |
38 | @Json(name = "original_title")
39 | private String originalTitle;
40 |
41 | @Json(name = "original_language")
42 | private String originalLanguage;
43 |
44 | @Json(name = "backdrop_path")
45 | private String backdropPath;
46 |
47 | @Json(name = "vote_count")
48 | private int voteCount;
49 |
50 | @Json(name = "vote_average")
51 | private float voteAverage;
52 |
53 | @Json(name = "imdb_id")
54 | private String imdbId;
55 |
56 | private PaletteColors paletteColors;
57 | private String director;
58 |
59 | public MovieDetails() {
60 | }
61 |
62 | public boolean isAdult() {
63 | return adult;
64 | }
65 |
66 | public MovieDetails setAdult(boolean adult) {
67 | this.adult = adult;
68 | return this;
69 | }
70 |
71 | public String getOverview() {
72 | return overview;
73 | }
74 |
75 | public MovieDetails setOverview(String overview) {
76 | this.overview = overview;
77 | return this;
78 | }
79 |
80 | public boolean isVideo() {
81 | return video;
82 | }
83 |
84 | public MovieDetails setVideo(boolean video) {
85 | this.video = video;
86 | return this;
87 | }
88 |
89 | public List getGenres() {
90 | return genres;
91 | }
92 |
93 | public MovieDetails setGenres(List genres) {
94 | this.genres = genres;
95 | return this;
96 | }
97 |
98 | public String getTitle() {
99 | return title;
100 | }
101 |
102 | public MovieDetails setTitle(String title) {
103 | this.title = title;
104 | return this;
105 | }
106 |
107 | public float getPopularity() {
108 | return popularity;
109 | }
110 |
111 | public MovieDetails setPopularity(float popularity) {
112 | this.popularity = popularity;
113 | return this;
114 | }
115 |
116 | public int getBudget() {
117 | return budget;
118 | }
119 |
120 | public MovieDetails setBudget(int budget) {
121 | this.budget = budget;
122 | return this;
123 | }
124 |
125 | public int getRuntime() {
126 | return runtime;
127 | }
128 |
129 | public MovieDetails setRuntime(int runtime) {
130 | this.runtime = runtime;
131 | return this;
132 | }
133 |
134 | public int getRevenue() {
135 | return revenue;
136 | }
137 |
138 | public MovieDetails setRevenue(int revenue) {
139 | this.revenue = revenue;
140 | return this;
141 | }
142 |
143 | public String getTagline() {
144 | return tagline;
145 | }
146 |
147 | public MovieDetails setTagline(String tagline) {
148 | this.tagline = tagline;
149 | return this;
150 | }
151 |
152 | public String getStatus() {
153 | return status;
154 | }
155 |
156 | public MovieDetails setStatus(String status) {
157 | this.status = status;
158 | return this;
159 | }
160 |
161 | public String getReleaseDate() {
162 | return releaseDate;
163 | }
164 |
165 | public MovieDetails setReleaseDate(String releaseDate) {
166 | this.releaseDate = releaseDate;
167 | return this;
168 | }
169 |
170 | public String getPosterPath() {
171 | return posterPath;
172 | }
173 |
174 | public MovieDetails setPosterPath(String posterPath) {
175 | this.posterPath = posterPath;
176 | return this;
177 | }
178 |
179 | public String getOriginalTitle() {
180 | return originalTitle;
181 | }
182 |
183 | public MovieDetails setOriginalTitle(String originalTitle) {
184 | this.originalTitle = originalTitle;
185 | return this;
186 | }
187 |
188 | public String getOriginalLanguage() {
189 | return originalLanguage;
190 | }
191 |
192 | public MovieDetails setOriginalLanguage(String originalLanguage) {
193 | this.originalLanguage = originalLanguage;
194 | return this;
195 | }
196 |
197 | public String getBackdropPath() {
198 | return backdropPath;
199 | }
200 |
201 | public MovieDetails setBackdropPath(String backdropPath) {
202 | this.backdropPath = backdropPath;
203 | return this;
204 | }
205 |
206 | public int getVoteCount() {
207 | return voteCount;
208 | }
209 |
210 | public MovieDetails setVoteCount(int voteCount) {
211 | this.voteCount = voteCount;
212 | return this;
213 | }
214 |
215 | public float getVoteAverage() {
216 | return voteAverage;
217 | }
218 |
219 | public MovieDetails setVoteAverage(float voteAverage) {
220 | this.voteAverage = voteAverage;
221 | return this;
222 | }
223 |
224 | public String getImdbId() {
225 | return imdbId;
226 | }
227 |
228 | public MovieDetails setImdbId(String imdbId) {
229 | this.imdbId = imdbId;
230 | return this;
231 | }
232 |
233 | public PaletteColors getPaletteColors() {
234 | return paletteColors;
235 | }
236 |
237 | public MovieDetails setPaletteColors(PaletteColors paletteColors) {
238 | this.paletteColors = paletteColors;
239 | return this;
240 | }
241 |
242 | public String getDirector() {
243 | return director;
244 | }
245 |
246 | public MovieDetails setDirector(String director) {
247 | this.director = director;
248 | return this;
249 | }
250 |
251 | @Override
252 | public int describeContents() {
253 | return 0;
254 | }
255 |
256 | @Override
257 | public void writeToParcel(Parcel dest, int flags) {
258 | dest.writeByte(this.adult ? (byte) 1 : (byte) 0);
259 | dest.writeString(this.overview);
260 | dest.writeByte(this.video ? (byte) 1 : (byte) 0);
261 | dest.writeTypedList(this.genres);
262 | dest.writeString(this.title);
263 | dest.writeFloat(this.popularity);
264 | dest.writeInt(this.budget);
265 | dest.writeInt(this.runtime);
266 | dest.writeInt(this.revenue);
267 | dest.writeString(this.tagline);
268 | dest.writeString(this.status);
269 | dest.writeString(this.releaseDate);
270 | dest.writeString(this.posterPath);
271 | dest.writeString(this.originalTitle);
272 | dest.writeString(this.originalLanguage);
273 | dest.writeString(this.backdropPath);
274 | dest.writeInt(this.voteCount);
275 | dest.writeFloat(this.voteAverage);
276 | dest.writeString(this.imdbId);
277 | dest.writeParcelable(this.paletteColors, flags);
278 | dest.writeString(this.director);
279 | }
280 |
281 | protected MovieDetails(Parcel in) {
282 | this.adult = in.readByte() != 0;
283 | this.overview = in.readString();
284 | this.video = in.readByte() != 0;
285 | this.genres = in.createTypedArrayList(Genre.CREATOR);
286 | this.title = in.readString();
287 | this.popularity = in.readFloat();
288 | this.budget = in.readInt();
289 | this.runtime = in.readInt();
290 | this.revenue = in.readInt();
291 | this.tagline = in.readString();
292 | this.status = in.readString();
293 | this.releaseDate = in.readString();
294 | this.posterPath = in.readString();
295 | this.originalTitle = in.readString();
296 | this.originalLanguage = in.readString();
297 | this.backdropPath = in.readString();
298 | this.voteCount = in.readInt();
299 | this.voteAverage = in.readFloat();
300 | this.imdbId = in.readString();
301 | this.paletteColors = in.readParcelable(PaletteColors.class.getClassLoader());
302 | this.director = in.readString();
303 | }
304 |
305 | public static final Creator CREATOR = new Creator() {
306 | @Override
307 | public MovieDetails createFromParcel(Parcel source) {
308 | return new MovieDetails(source);
309 | }
310 |
311 | @Override
312 | public MovieDetails[] newArray(int size) {
313 | return new MovieDetails[size];
314 | }
315 | };
316 | }
317 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/MovieResponse.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.squareup.moshi.Json;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by Marcus Gabilheri
12 | *
13 | * @author Marcus Gabilheri
14 | * @version 1.0
15 | * @since 10/8/16.
16 | */
17 |
18 | public class MovieResponse implements Parcelable {
19 |
20 | private int page;
21 | private List results;
22 |
23 | @Json(name = "total_pages")
24 | private int totalPages;
25 |
26 | @Json(name = "total_results")
27 | private int totalResults;
28 |
29 | public int getPage() {
30 | return page;
31 | }
32 |
33 | public MovieResponse setPage(int page) {
34 | this.page = page;
35 | return this;
36 | }
37 |
38 | public List getResults() {
39 | return results;
40 | }
41 |
42 | public MovieResponse setResults(List results) {
43 | this.results = results;
44 | return this;
45 | }
46 |
47 | public int getTotalPages() {
48 | return totalPages;
49 | }
50 |
51 | public MovieResponse setTotalPages(int totalPages) {
52 | this.totalPages = totalPages;
53 | return this;
54 | }
55 |
56 | public int getTotalResults() {
57 | return totalResults;
58 | }
59 |
60 | public MovieResponse setTotalResults(int totalResults) {
61 | this.totalResults = totalResults;
62 | return this;
63 | }
64 |
65 | @Override
66 | public int describeContents() {
67 | return 0;
68 | }
69 |
70 | @Override
71 | public void writeToParcel(Parcel dest, int flags) {
72 | dest.writeInt(this.page);
73 | dest.writeTypedList(this.results);
74 | dest.writeInt(this.totalPages);
75 | dest.writeInt(this.totalResults);
76 | }
77 |
78 | public MovieResponse() {
79 | }
80 |
81 | protected MovieResponse(Parcel in) {
82 | this.page = in.readInt();
83 | this.results = in.createTypedArrayList(Movie.CREATOR);
84 | this.totalPages = in.readInt();
85 | this.totalResults = in.readInt();
86 | }
87 |
88 | public static final Creator CREATOR = new Creator() {
89 | @Override
90 | public MovieResponse createFromParcel(Parcel source) {
91 | return new MovieResponse(source);
92 | }
93 |
94 | @Override
95 | public MovieResponse[] newArray(int size) {
96 | return new MovieResponse[size];
97 | }
98 | };
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/PaletteColors.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * Created by Marcus Gabilheri
8 | *
9 | * @author Marcus Gabilheri
10 | * @version 1.0
11 | * @since 10/8/16.
12 | */
13 |
14 | public class PaletteColors implements Parcelable {
15 | private int toolbarBackgroundColor;
16 | private int statusBarColor;
17 | private int textColor;
18 | private int titleColor;
19 |
20 | public PaletteColors() {
21 | }
22 |
23 | public int getToolbarBackgroundColor() {
24 | return toolbarBackgroundColor;
25 | }
26 |
27 | public PaletteColors setToolbarBackgroundColor(int toolbarBackgroundColor) {
28 | this.toolbarBackgroundColor = toolbarBackgroundColor;
29 | return this;
30 | }
31 |
32 | public int getStatusBarColor() {
33 | return statusBarColor;
34 | }
35 |
36 | public PaletteColors setStatusBarColor(int statusBarColor) {
37 | this.statusBarColor = statusBarColor;
38 | return this;
39 | }
40 |
41 | public int getTextColor() {
42 | return textColor;
43 | }
44 |
45 | public PaletteColors setTextColor(int textColor) {
46 | this.textColor = textColor;
47 | return this;
48 | }
49 |
50 | public int getTitleColor() {
51 | return titleColor;
52 | }
53 |
54 | public PaletteColors setTitleColor(int titleColor) {
55 | this.titleColor = titleColor;
56 | return this;
57 | }
58 |
59 | @Override
60 | public int describeContents() {
61 | return 0;
62 | }
63 |
64 | @Override
65 | public void writeToParcel(Parcel dest, int flags) {
66 | dest.writeInt(this.toolbarBackgroundColor);
67 | dest.writeInt(this.statusBarColor);
68 | dest.writeInt(this.textColor);
69 | dest.writeInt(this.titleColor);
70 | }
71 |
72 | protected PaletteColors(Parcel in) {
73 | this.toolbarBackgroundColor = in.readInt();
74 | this.statusBarColor = in.readInt();
75 | this.textColor = in.readInt();
76 | this.titleColor = in.readInt();
77 | }
78 |
79 | public static final Creator CREATOR = new Creator() {
80 | @Override
81 | public PaletteColors createFromParcel(Parcel source) {
82 | return new PaletteColors(source);
83 | }
84 |
85 | @Override
86 | public PaletteColors[] newArray(int size) {
87 | return new PaletteColors[size];
88 | }
89 | };
90 | }
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/Person.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import com.squareup.moshi.Json;
7 |
8 | /**
9 | * Created by Marcus Gabilheri
10 | *
11 | * @author Marcus Gabilheri
12 | * @version 1.0
13 | * @since 10/10/16.
14 | */
15 |
16 | public class Person implements Parcelable {
17 |
18 | private int id;
19 | private String biography;
20 | private String birthday;
21 | private String deathday;
22 | private int gender;
23 | private String homepage;
24 | private String name;
25 | private float popularity;
26 | private boolean adult;
27 |
28 | @Json(name = "profile_path")
29 | private String profilePath;
30 |
31 | @Json(name = "place_of_birth")
32 | private String placeOfBirth;
33 |
34 | public Person() {
35 | }
36 |
37 | public int getId() {
38 | return id;
39 | }
40 |
41 | public Person setId(int id) {
42 | this.id = id;
43 | return this;
44 | }
45 |
46 | public String getBiography() {
47 | return biography;
48 | }
49 |
50 | public Person setBiography(String biography) {
51 | this.biography = biography;
52 | return this;
53 | }
54 |
55 | public String getBirthday() {
56 | return birthday;
57 | }
58 |
59 | public Person setBirthday(String birthday) {
60 | this.birthday = birthday;
61 | return this;
62 | }
63 |
64 | public String getDeathday() {
65 | return deathday;
66 | }
67 |
68 | public Person setDeathday(String deathday) {
69 | this.deathday = deathday;
70 | return this;
71 | }
72 |
73 | public int getGender() {
74 | return gender;
75 | }
76 |
77 | public Person setGender(int gender) {
78 | this.gender = gender;
79 | return this;
80 | }
81 |
82 | public String getHomepage() {
83 | return homepage;
84 | }
85 |
86 | public Person setHomepage(String homepage) {
87 | this.homepage = homepage;
88 | return this;
89 | }
90 |
91 | public String getName() {
92 | return name;
93 | }
94 |
95 | public Person setName(String name) {
96 | this.name = name;
97 | return this;
98 | }
99 |
100 | public float getPopularity() {
101 | return popularity;
102 | }
103 |
104 | public Person setPopularity(float popularity) {
105 | this.popularity = popularity;
106 | return this;
107 | }
108 |
109 | public boolean isAdult() {
110 | return adult;
111 | }
112 |
113 | public Person setAdult(boolean adult) {
114 | this.adult = adult;
115 | return this;
116 | }
117 |
118 | public String getProfilePath() {
119 | return profilePath;
120 | }
121 |
122 | public Person setProfilePath(String profilePath) {
123 | this.profilePath = profilePath;
124 | return this;
125 | }
126 |
127 | public String getPlaceOfBirth() {
128 | return placeOfBirth;
129 | }
130 |
131 | public Person setPlaceOfBirth(String placeOfBirth) {
132 | this.placeOfBirth = placeOfBirth;
133 | return this;
134 | }
135 |
136 | @Override
137 | public int describeContents() {
138 | return 0;
139 | }
140 |
141 | @Override
142 | public void writeToParcel(Parcel dest, int flags) {
143 | dest.writeInt(this.id);
144 | dest.writeString(this.biography);
145 | dest.writeString(this.birthday);
146 | dest.writeString(this.deathday);
147 | dest.writeInt(this.gender);
148 | dest.writeString(this.homepage);
149 | dest.writeString(this.name);
150 | dest.writeFloat(this.popularity);
151 | dest.writeByte(this.adult ? (byte) 1 : (byte) 0);
152 | dest.writeString(this.profilePath);
153 | dest.writeString(this.placeOfBirth);
154 | }
155 |
156 | protected Person(Parcel in) {
157 | this.id = in.readInt();
158 | this.biography = in.readString();
159 | this.birthday = in.readString();
160 | this.deathday = in.readString();
161 | this.gender = in.readInt();
162 | this.homepage = in.readString();
163 | this.name = in.readString();
164 | this.popularity = in.readFloat();
165 | this.adult = in.readByte() != 0;
166 | this.profilePath = in.readString();
167 | this.placeOfBirth = in.readString();
168 | }
169 |
170 | public static final Creator CREATOR = new Creator() {
171 | @Override
172 | public Person createFromParcel(Parcel source) {
173 | return new Person(source);
174 | }
175 |
176 | @Override
177 | public Person[] newArray(int size) {
178 | return new Person[size];
179 | }
180 | };
181 | }
182 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/Video.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | /**
4 | * Created by Marcus Gabilheri
5 | *
6 | * @author Marcus Gabilheri
7 | * @version 1.0
8 | * @since 10/9/16.
9 | */
10 |
11 | public class Video {
12 |
13 | private String id;
14 | private String key;
15 | private String site;
16 | private String type;
17 | private String name;
18 |
19 | public Video() {
20 | }
21 |
22 | public String getId() {
23 | return id;
24 | }
25 |
26 | public Video setId(String id) {
27 | this.id = id;
28 | return this;
29 | }
30 |
31 | public String getKey() {
32 | return key;
33 | }
34 |
35 | public Video setKey(String key) {
36 | this.key = key;
37 | return this;
38 | }
39 |
40 | public String getSite() {
41 | return site;
42 | }
43 |
44 | public Video setSite(String site) {
45 | this.site = site;
46 | return this;
47 | }
48 |
49 | public String getType() {
50 | return type;
51 | }
52 |
53 | public Video setType(String type) {
54 | this.type = type;
55 | return this;
56 | }
57 |
58 | public String getName() {
59 | return name;
60 | }
61 |
62 | public Video setName(String name) {
63 | this.name = name;
64 | return this;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gabilheri/moviestmdb/data/models/VideoResponse.java:
--------------------------------------------------------------------------------
1 | package com.gabilheri.moviestmdb.data.models;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Marcus Gabilheri
7 | *
8 | * @author Marcus Gabilheri
9 | * @version 1.0
10 | * @since 10/9/16.
11 | */
12 |
13 | public class VideoResponse {
14 |
15 | private int id;
16 | private List