-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
133 changed files
with
4,010 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,86 @@ | ||
Popular Movies | ||
==================================================== | ||
# Popular Movies | ||
|
||
Concept app to fetch and list popular movies from | ||
The Movie DB api (www.themoviedb.org). | ||
Concept app to fetch and list popular movies from The Movie DB api (www.themoviedb.org). | ||
|
||
Basic Instructions | ||
=================================================== | ||
This application was created to exercise a few concepts regarding Android Development. | ||
|
||
To start developing you should get and api key at | ||
www.themoviedb.org. | ||
If you just want to give it a try download the test apk [here](https://drive.google.com/file/d/0BxuNaEVyDit0d0wzcFZ0M2VqR0E/view?usp=sharing). | ||
|
||
With the key in hands create app/secrets.properties | ||
file. It is a key/value pairs based file and you | ||
must add keys for Debug and Release versions using | ||
the following entries: | ||
## Table of Contents | ||
* [Showcase](#showcase) | ||
* [Feature List](#features) | ||
* [Tools and Libs](#tools) | ||
* [TODOs](#todos) | ||
* [Basic Instructions](#instructions) | ||
|
||
<a name="showcase"></a> | ||
## Showcase | ||
|
||
<p align="center"> | ||
<img src="screenshots/my_movies_recording.gif" align="center" width=200> | ||
<img src="screenshots/mymovies_01.png" align="center" width=200> | ||
<img src="screenshots/mymovies_02.png" align="center" width=200> | ||
<img src="screenshots/mymovies_03.png" align="center" width=200> | ||
<img src="screenshots/mymovies_04.png" align="center" width=200> | ||
<img src="screenshots/mymovies_05.png" align="center" width=200> | ||
<img src="screenshots/mymovies_06.png" align="center" width=400> | ||
</p> | ||
|
||
<a name="features"></a> | ||
## Feature List | ||
|
||
* List Top Rated and Most Popular Movies from The Movie DB Api. | ||
* Display the Movie Details for a selected Movie. | ||
* Allow the user to add movies to favorites. | ||
* Allow user to watch trailers. | ||
* Allow user to share trailers. | ||
* Allow user to read reviews. | ||
* List user's favorites. | ||
* List favorite movie details. | ||
* Offline support for favorite movies. | ||
* Landscape layout for movie details. | ||
|
||
<a name="tools"></a> | ||
## Tools and Libs | ||
|
||
* RxJava2 | ||
* ReactiveNetwork | ||
* Retrofit2 | ||
* Picasso | ||
* Gson | ||
* AutoValues | ||
* Butterknife | ||
* Dagger2 | ||
* Android Support Libs: | ||
* RecyclerView | ||
* CardView | ||
* Design Support Library | ||
* ConstraintLayout | ||
* Vector Drawables | ||
|
||
<a name="todos"/></a> | ||
## ToDos | ||
|
||
* Improve error messages displayed to the user. | ||
* Unit and Instrumented Tests. | ||
* Animations | ||
|
||
<a name="instructions"></a> | ||
## Basic Instructions | ||
|
||
To start developing you should get and api key at www.themoviedb.org. | ||
|
||
With the key in hands create app/secrets.properties file. It is a key/value pairs based file and you | ||
must add keys for Debug and Release versions using the following entries: | ||
|
||
``` | ||
DEBUG_THE_MOVIE_DB_API_KEY=YOUR_KEY_HERE | ||
RELEASE_THE_MOVIE_DB_API_KEY=YOUR_KEY_HERE | ||
``` | ||
|
||
You can use the same key for both entries. | ||
|
||
The entries will be available in the BuildConfig | ||
generated class. | ||
The entries will be available in the BuildConfig generated class. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/main/java/br/com/ecarrara/popularmovies/core/MyPopularMoviesApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package br.com.ecarrara.popularmovies.core; | ||
|
||
import android.app.Application; | ||
|
||
import br.com.ecarrara.popularmovies.core.di.Injector; | ||
|
||
public class MyPopularMoviesApplication extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
Injector.initialize(this); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
.../ecarrara/popularmovies/core/data/datasource/contentprovider/ContentProviderContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package br.com.ecarrara.popularmovies.core.data.datasource.contentprovider; | ||
|
||
import android.net.Uri; | ||
|
||
public final class ContentProviderContract { | ||
|
||
private ContentProviderContract() { /* Must not be instantiated */ } | ||
|
||
public static final String CONTENT_AUTHORITY = "br.com.ecarrara.popularmovies"; | ||
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); | ||
|
||
public static final String DATE_FORMAT = "yyyy-MM-dd"; | ||
|
||
public static final long ENTRY_NOT_PERSISTED_ID = -1L; | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
.../java/br/com/ecarrara/popularmovies/core/data/datasource/sqlite/SqliteDatabaseHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package br.com.ecarrara.popularmovies.core.data.datasource.sqlite; | ||
|
||
import android.content.Context; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteOpenHelper; | ||
|
||
import br.com.ecarrara.popularmovies.favorites.data.datasource.contentprovider.FavoritesContract; | ||
|
||
public class SqliteDatabaseHelper extends SQLiteOpenHelper { | ||
|
||
private static final String DATABASE_NAME = "mypopularmovies.db"; | ||
private static final int DATABASE_VERSION = 1; | ||
|
||
public SqliteDatabaseHelper(Context context) { | ||
super(context, DATABASE_NAME, null, DATABASE_VERSION); | ||
} | ||
|
||
@Override | ||
public void onCreate(SQLiteDatabase db) { | ||
db.execSQL(FavoritesContract.FavoriteMovieEntry.SQL_CREATE_FAVORITE_MOVIE_TABLE); | ||
db.execSQL(FavoritesContract.FavoriteEntry.SQL_CREATE_FAVORITE_TABLE); | ||
} | ||
|
||
@Override | ||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | ||
/* Do Nothing for this version */ | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/br/com/ecarrara/popularmovies/core/di/ApplicationComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package br.com.ecarrara.popularmovies.core.di; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import br.com.ecarrara.popularmovies.core.networking.di.NetworkingModule; | ||
import br.com.ecarrara.popularmovies.favorites.di.FavoritesModule; | ||
import br.com.ecarrara.popularmovies.movies.di.MoviesModule; | ||
import br.com.ecarrara.popularmovies.movies.presentation.view.MovieDetailActivity; | ||
import br.com.ecarrara.popularmovies.movies.presentation.view.MovieListActivity; | ||
import br.com.ecarrara.popularmovies.reviews.di.ReviewsModule; | ||
import br.com.ecarrara.popularmovies.reviews.presentation.view.MovieReviewsFragment; | ||
import br.com.ecarrara.popularmovies.trailers.di.TrailersModule; | ||
import br.com.ecarrara.popularmovies.trailers.presentation.view.TrailerListFragment; | ||
import dagger.Component; | ||
|
||
@Singleton | ||
@Component(modules = { | ||
ApplicationModule.class, | ||
NetworkingModule.class, | ||
MoviesModule.class, | ||
ReviewsModule.class, | ||
TrailersModule.class, | ||
FavoritesModule.class | ||
}) | ||
public interface ApplicationComponent { | ||
void inject(MovieDetailActivity movieDetailActivity); | ||
void inject(MovieReviewsFragment movieReviewsFragment); | ||
void inject(TrailerListFragment trailerListFragment); | ||
void inject(MovieListActivity movieListActivity); | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/br/com/ecarrara/popularmovies/core/di/ApplicationModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package br.com.ecarrara.popularmovies.core.di; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import br.com.ecarrara.popularmovies.core.MyPopularMoviesApplication; | ||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
@Singleton | ||
@Module | ||
public class ApplicationModule { | ||
|
||
private MyPopularMoviesApplication applicationContext; | ||
|
||
public ApplicationModule(@NonNull MyPopularMoviesApplication applicationContext) { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
public Context providesApplicationContext() { | ||
return this.applicationContext; | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/br/com/ecarrara/popularmovies/core/di/Injector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package br.com.ecarrara.popularmovies.core.di; | ||
|
||
import android.app.Application; | ||
|
||
import br.com.ecarrara.popularmovies.core.MyPopularMoviesApplication; | ||
|
||
public final class Injector { | ||
|
||
private Injector() { /* must not be constructed */ } | ||
|
||
private static ApplicationComponent applicationComponent; | ||
|
||
public static void initialize(MyPopularMoviesApplication application) { | ||
applicationComponent = DaggerApplicationComponent.builder() | ||
.applicationModule(new ApplicationModule(application)) | ||
.build(); | ||
} | ||
|
||
public static ApplicationComponent applicationComponent() { | ||
return applicationComponent; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...java/br/com/ecarrara/popularmovies/core/networking/connectivity/ConnectivityObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package br.com.ecarrara.popularmovies.core.networking.connectivity; | ||
|
||
import io.reactivex.Observable; | ||
|
||
public interface ConnectivityObserver { | ||
|
||
Observable<Boolean> observeConnectivity(); | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
.../br/com/ecarrara/popularmovies/core/networking/connectivity/ConnectivityObserverImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package br.com.ecarrara.popularmovies.core.networking.connectivity; | ||
|
||
import android.content.Context; | ||
import android.net.NetworkInfo; | ||
|
||
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork; | ||
|
||
import io.reactivex.Observable; | ||
import io.reactivex.schedulers.Schedulers; | ||
|
||
public class ConnectivityObserverImpl implements ConnectivityObserver { | ||
|
||
private Context applicationContext; | ||
|
||
public ConnectivityObserverImpl(Context applicationContext) { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
@Override | ||
public Observable<Boolean> observeConnectivity() { | ||
return ReactiveNetwork.observeNetworkConnectivity(applicationContext) | ||
.observeOn(Schedulers.io()) | ||
.flatMap(connectivity -> | ||
Observable.just(connectivity.getState().equals(NetworkInfo.State.CONNECTED)) | ||
); | ||
} | ||
|
||
} |
Oops, something went wrong.