├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── ic_launcher-web.png
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-land
│ │ │ │ └── dimens.xml
│ │ │ ├── values-w900dp
│ │ │ │ └── dimens.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable
│ │ │ │ ├── label_bg.xml
│ │ │ │ ├── ic_play.xml
│ │ │ │ ├── ic_heart.xml
│ │ │ │ ├── ic_broken_heart.xml
│ │ │ │ ├── ic_sort.xml
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── menu
│ │ │ │ ├── movie_details_menu.xml
│ │ │ │ └── activity_movie_list_menu.xml
│ │ │ ├── layout
│ │ │ │ ├── movie_list.xml
│ │ │ │ ├── movie_list_item.xml
│ │ │ │ ├── activity_movie_list.xml
│ │ │ │ ├── review_list_item.xml
│ │ │ │ ├── no_data_layout.xml
│ │ │ │ ├── activity_movie_detail.xml
│ │ │ │ ├── video_list_item.xml
│ │ │ │ └── fragment_movie_detail.xml
│ │ │ └── layout-w900dp
│ │ │ │ └── movie_list.xml
│ │ ├── java
│ │ │ └── eu
│ │ │ │ └── dkaratzas
│ │ │ │ └── popularmoviesapp
│ │ │ │ ├── api
│ │ │ │ ├── MoviesApiCallback.java
│ │ │ │ ├── MovieApiService.java
│ │ │ │ └── MoviesApiManager.java
│ │ │ │ ├── Constants.java
│ │ │ │ ├── utils
│ │ │ │ ├── Misc.java
│ │ │ │ ├── ImageUtils.java
│ │ │ │ ├── SpacingItemDecoration.java
│ │ │ │ └── EndlessRecyclerViewScrollListener.java
│ │ │ │ ├── GlobalApplication.java
│ │ │ │ ├── holders
│ │ │ │ ├── ReviewViewHolder.java
│ │ │ │ ├── VideoViewHolder.java
│ │ │ │ └── MovieViewHolder.java
│ │ │ │ ├── data
│ │ │ │ ├── MoviesContract.java
│ │ │ │ ├── MoviesDbHelper.java
│ │ │ │ └── MoviesProvider.java
│ │ │ │ ├── adapters
│ │ │ │ ├── ReviewAdapter.java
│ │ │ │ ├── VideosAdapter.java
│ │ │ │ ├── MoviesAdapter.java
│ │ │ │ └── FavouriteMoviesAdapter.java
│ │ │ │ ├── models
│ │ │ │ ├── Movie
│ │ │ │ │ ├── VideoResults.java
│ │ │ │ │ ├── Genre.java
│ │ │ │ │ ├── Review.java
│ │ │ │ │ ├── Reviews.java
│ │ │ │ │ ├── Video.java
│ │ │ │ │ └── Movie.java
│ │ │ │ ├── MovieResult.java
│ │ │ │ └── Movies.java
│ │ │ │ └── controllers
│ │ │ │ ├── MovieDetailActivity.java
│ │ │ │ └── MovieDetailFragment.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── eu
│ │ │ └── dkaratzas
│ │ │ └── popularmoviesapp
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── eu
│ │ └── dkaratzas
│ │ └── popularmoviesapp
│ │ └── ExampleInstrumentedTest.java
├── build.gradle
└── proguard-rules.pro
├── settings.gradle
├── art
└── logo.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── README.md
├── gradlew.bat
├── .gitignore
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/art/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/art/logo.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dioKaratzas/udacity-popular-movies/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Feb 16 11:32:23 EET 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | MOVIE_DB_API_KEY="Your Api Key"
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | #47A3E5
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | - 0.25
19 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/api/MoviesApiCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.api;
18 |
19 | public interface MoviesApiCallback {
20 | void onResponse(T result);
21 |
22 | void onCancel();
23 | }
--------------------------------------------------------------------------------
/app/src/main/res/values-w900dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | 16dp
19 | - 0.4
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp;
18 |
19 | public class Constants {
20 | public static final String TMDB_API_KEY = BuildConfig.MOVIE_DB_API_KEY;
21 | public static final String TMDB_API_URL = "http://api.themoviedb.org/3/";
22 | public static final String TMDB_IMAGE_URL = "http://image.tmdb.org/t/p/";
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | 200dp
19 | 250dp
20 | 8dp
21 |
22 | 6dp
23 | - 0.4
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | #5fb6e1
19 | #47A3E5
20 | #F57676
21 |
22 | #CFD8DC
23 | #8D9BA9
24 | #5E697C
25 | #78000000
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/label_bg.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
25 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/movie_details_menu.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/utils/Misc.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.utils;
18 |
19 | import android.content.Context;
20 | import android.net.ConnectivityManager;
21 |
22 | public class Misc {
23 |
24 | public static boolean isNetworkAvailable(Context context) {
25 |
26 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
27 |
28 | return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected();
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/test/java/eu/dkaratzas/popularmoviesapp/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp;
18 |
19 | import org.junit.Test;
20 |
21 | import static org.junit.Assert.assertEquals;
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * @see Testing documentation
27 | */
28 | public class ExampleUnitTest {
29 | @Test
30 | public void addition_isCorrect() throws Exception {
31 | assertEquals(4, 2 + 2);
32 | }
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/GlobalApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp;
18 |
19 | import android.app.Application;
20 |
21 | import com.orhanobut.logger.AndroidLogAdapter;
22 |
23 | public class GlobalApplication extends Application {
24 |
25 | public GlobalApplication() {
26 | com.orhanobut.logger.Logger.addLogAdapter(new AndroidLogAdapter() {
27 | @Override
28 | public boolean isLoggable(int priority, String tag) {
29 | return BuildConfig.DEBUG;
30 | }
31 | });
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/holders/ReviewViewHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.holders;
18 |
19 |
20 | import android.support.v7.widget.RecyclerView;
21 | import android.view.View;
22 | import android.widget.TextView;
23 |
24 | import eu.dkaratzas.popularmoviesapp.R;
25 |
26 | public class ReviewViewHolder extends RecyclerView.ViewHolder {
27 | public TextView mTvReviewAuthor;
28 | public TextView mTvReviewContent;
29 |
30 | public ReviewViewHolder(View itemView) {
31 | super(itemView);
32 |
33 | mTvReviewAuthor = itemView.findViewById(R.id.tvReviewAuthor);
34 | mTvReviewContent = itemView.findViewById(R.id.tvReviewContent);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/holders/VideoViewHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.holders;
18 |
19 |
20 | import android.support.v7.widget.RecyclerView;
21 | import android.view.View;
22 | import android.widget.ImageView;
23 | import android.widget.TextView;
24 |
25 | import eu.dkaratzas.popularmoviesapp.R;
26 |
27 | public class VideoViewHolder extends RecyclerView.ViewHolder {
28 | public ImageView mIvVideoThumb;
29 | public TextView mTvVideoTitle;
30 |
31 | public VideoViewHolder(View itemView) {
32 | super(itemView);
33 |
34 | mIvVideoThumb = itemView.findViewById(R.id.cvVideo);
35 | mTvVideoTitle = itemView.findViewById(R.id.tvVideoTitle);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/api/MovieApiService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.api;
18 |
19 |
20 | import eu.dkaratzas.popularmoviesapp.models.Movie.Movie;
21 | import eu.dkaratzas.popularmoviesapp.models.Movies;
22 | import retrofit2.Call;
23 | import retrofit2.http.GET;
24 | import retrofit2.http.Path;
25 | import retrofit2.http.Query;
26 |
27 | interface MovieApiService {
28 |
29 | @GET("movie/top_rated")
30 | Call getTopRatedMovies(@Query("api_key") String apiKey, @Query("page") int page);
31 |
32 | @GET("movie/popular")
33 | Call getPopularMovies(@Query("api_key") String apiKey, @Query("page") int page);
34 |
35 | @GET("movie/{movieId}?append_to_response=videos,reviews")
36 | Call getMovie(@Path("movieId") int movieId, @Query("api_key") String apiKey);
37 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_play.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/holders/MovieViewHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.holders;
18 |
19 |
20 | import android.support.v7.widget.RecyclerView;
21 | import android.view.View;
22 | import android.widget.ImageView;
23 | import android.widget.LinearLayout;
24 |
25 | import eu.dkaratzas.popularmoviesapp.R;
26 |
27 | public class MovieViewHolder extends RecyclerView.ViewHolder {
28 | public ImageView mIvMovie;
29 | private LinearLayout mProgressBarContainer;
30 |
31 | public MovieViewHolder(View itemView) {
32 | super(itemView);
33 |
34 | mProgressBarContainer = itemView.findViewById(R.id.progressBarContainer);
35 | mIvMovie = itemView.findViewById(R.id.cvVideo);
36 | }
37 |
38 | public void showProgress(Boolean show) {
39 | mProgressBarContainer.setVisibility(show ? View.VISIBLE : View.GONE);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/eu/dkaratzas/popularmoviesapp/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp;
18 |
19 | import android.content.Context;
20 | import android.support.test.InstrumentationRegistry;
21 | import android.support.test.runner.AndroidJUnit4;
22 |
23 | import org.junit.Test;
24 | import org.junit.runner.RunWith;
25 |
26 | import static org.junit.Assert.assertEquals;
27 |
28 | /**
29 | * Instrumented test, which will execute on an Android device.
30 | *
31 | * @see Testing documentation
32 | */
33 | @RunWith(AndroidJUnit4.class)
34 | public class ExampleInstrumentedTest {
35 | @Test
36 | public void useAppContext() throws Exception {
37 | // Context of the app under test.
38 | Context appContext = InstrumentationRegistry.getTargetContext();
39 |
40 | assertEquals("eu.dkaratzas.popularmoviesapp", appContext.getPackageName());
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_heart.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_movie_list_menu.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/movie_list.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
23 |
26 |
27 |
32 |
33 |
34 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/data/MoviesContract.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.data;
18 |
19 | import android.net.Uri;
20 | import android.provider.BaseColumns;
21 |
22 | public class MoviesContract {
23 | public static final String CONTENT_AUTHORITY = "eu.dkaratzas.popularmoviesapp";
24 | public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
25 | public static final String PATH_MOVIES = "movies";
26 |
27 | public static final class MoviesEntry implements BaseColumns {
28 |
29 | public static final Uri CONTENT_URI =
30 | BASE_CONTENT_URI.buildUpon()
31 | .appendPath(PATH_MOVIES)
32 | .build();
33 |
34 | public static final String TABLE_NAME = "movies";
35 | public static final String COLUMN_ID = "movie_id";
36 | public static final String COLUMN_TITLE = "title";
37 | public static final String COLUMN_OVERVIEW = "overview";
38 | public static final String COLUMN_POSTER_PATH = "poster_path";
39 | public static final String COLUMN_BACKDROP_PATH = "backdrop_path";
40 | public static final String COLUMN_RELEASE_DATE = "release_date";
41 | public static final String COLUMN_RUNTIME = "runtime";
42 | public static final String COLUMN_VOTE_AVERAGE = "vote_average";
43 |
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/movie_list_item.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
23 |
32 |
33 |
41 |
42 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/adapters/ReviewAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.adapters;
18 |
19 | import android.support.v7.widget.RecyclerView;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 |
24 | import eu.dkaratzas.popularmoviesapp.R;
25 | import eu.dkaratzas.popularmoviesapp.holders.ReviewViewHolder;
26 | import eu.dkaratzas.popularmoviesapp.models.Movie.Review;
27 | import eu.dkaratzas.popularmoviesapp.models.Movie.Reviews;
28 |
29 | public class ReviewAdapter extends RecyclerView.Adapter {
30 | private Reviews mReviews;
31 |
32 | public ReviewAdapter(Reviews reviews) {
33 | this.mReviews = reviews;
34 | }
35 |
36 | @Override
37 | public ReviewViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
38 | View view = LayoutInflater.from(parent.getContext())
39 | .inflate(R.layout.review_list_item, parent, false);
40 |
41 | return new ReviewViewHolder(view);
42 | }
43 |
44 | @Override
45 | public void onBindViewHolder(ReviewViewHolder holder, int position) {
46 | final Review review = mReviews.getResults().get(position);
47 |
48 | holder.mTvReviewAuthor.setText(review.getAuthor());
49 | holder.mTvReviewContent.setText(review.getContent());
50 | }
51 |
52 | @Override
53 | public int getItemCount() {
54 | return mReviews.getResults().size();
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_movie_list.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
24 |
25 |
30 |
31 |
36 |
37 |
38 |
39 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Popular Movies
19 | eu.dkaratzas.popularmoviesapp
20 |
21 |
22 | Movie picture
23 | Sort
24 | Internet connection appears to be offline
25 | Most Popular
26 | Top Rated
27 | Favourite
28 | Movies
29 | Movie data is not available
30 | You have no favorite movies
31 | sort_by
32 |
33 |
34 | Movie Details
35 | Plot Synopsis
36 | Reviews
37 | Share
38 | Share trailer
39 | added to favourite movies
40 | removed from favourite movies
41 | Play
42 | Video
43 | Movie Backdrop Image
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/eu/dkaratzas/popularmoviesapp/models/Movie/VideoResults.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Dionysios Karatzas
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package eu.dkaratzas.popularmoviesapp.models.Movie;
18 |
19 | import android.os.Parcel;
20 | import android.os.Parcelable;
21 |
22 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
23 | import com.fasterxml.jackson.annotation.JsonProperty;
24 |
25 | import java.util.ArrayList;
26 | import java.util.List;
27 |
28 | @JsonIgnoreProperties(ignoreUnknown = true)
29 | public class VideoResults implements Parcelable {
30 | @JsonProperty("results")
31 | private List