├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── movie │ │ └── tutorial │ │ └── com │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── movie │ │ │ └── tutorial │ │ │ └── com │ │ │ ├── Config.java │ │ │ ├── MoviesApp.java │ │ │ ├── activity │ │ │ ├── ActivityMovieDetails.java │ │ │ └── MainActivity.java │ │ │ ├── adapter │ │ │ ├── GenresAdapter.java │ │ │ ├── MoviesAdapter.java │ │ │ └── ProductionCompaniesAdapter.java │ │ │ ├── model │ │ │ ├── configuration │ │ │ │ ├── ConfigurationResponse.java │ │ │ │ └── Images.java │ │ │ ├── movie │ │ │ │ ├── GenreItem.java │ │ │ │ ├── MovieResponse.java │ │ │ │ ├── ProductionCompanyItem.java │ │ │ │ ├── ProductionCountryItem.java │ │ │ │ ├── SpokenLanguageItem.java │ │ │ │ └── images │ │ │ │ │ ├── Backdrop.java │ │ │ │ │ ├── ImagesResponse.java │ │ │ │ │ └── Poster.java │ │ │ ├── movies │ │ │ │ ├── MovieItem.java │ │ │ │ └── MoviesResponse.java │ │ │ └── search │ │ │ │ └── SearchMovieResponse.java │ │ │ └── rest │ │ │ ├── API.java │ │ │ ├── Configurations.java │ │ │ └── Movies.java │ └── res │ │ ├── drawable │ │ ├── chip.xml │ │ └── star.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_movie_details.xml │ │ ├── list_item_genre.xml │ │ ├── list_item_movie.xml │ │ ├── list_item_pc.xml │ │ └── toolbar.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── app │ └── movie │ └── tutorial │ └── com │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion '26.0.2' 6 | 7 | defaultConfig { 8 | applicationId "app.movie.tutorial.com" 9 | minSdkVersion 23 10 | targetSdkVersion 24 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | 26 | compile 'com.balysv:material-ripple:1.0.2' 27 | 28 | compile 'com.android.support:appcompat-v7:24.1.1' 29 | compile 'com.android.support:design:24.1.1' 30 | compile 'com.android.support:cardview-v7:24.1.1' 31 | compile 'com.android.support:recyclerview-v7:24.1.1' 32 | compile 'com.android.support:palette-v7:24.1.1' 33 | 34 | compile 'com.github.clans:fab:1.6.4' 35 | 36 | compile 'com.squareup.picasso:picasso:2.5.2' 37 | 38 | compile 'com.squareup.retrofit2:retrofit:2.1.0' 39 | compile 'com.squareup.retrofit2:converter-gson:2.1.0' 40 | 41 | compile 'com.android.support:recyclerview-v7:24.1.1' 42 | 43 | compile 'com.facebook.stetho:stetho-okhttp3:1.5.0' 44 | compile 'com.facebook.stetho:stetho:1.5.0' 45 | 46 | compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' 47 | } 48 | -------------------------------------------------------------------------------- /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 C:\Users\Gino Osahon\AppData\Local\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/app/movie/tutorial/com/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com; 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 | 2 | 4 | 5 | 6 | 7 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/Config.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com; 2 | 3 | public class Config { 4 | public static String PACKAGE_NAME = "app.movie.tutorial.com"; 5 | public final static String IMAGE_URL_BASE_PATH = "http://image.tmdb.org/t/p/w342//"; 6 | public static final String API_BASE_URL = "http://api.themoviedb.org/3/"; 7 | public final static String API_KEY = "YOUR_API_KEY_HERE"; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/MoviesApp.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com; 2 | 3 | import android.app.Application; 4 | import android.os.SystemClock; 5 | import android.util.Log; 6 | 7 | public class MoviesApp extends Application { 8 | private static final String TAG = "MoviesApp"; 9 | 10 | @Override 11 | public void onCreate() { 12 | super.onCreate(); 13 | long startTime = SystemClock.elapsedRealtime(); 14 | 15 | //initialization code here... 16 | 17 | long elapsed = SystemClock.elapsedRealtime() - startTime; 18 | Log.i(TAG, "Initialized in " + elapsed + " ms"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/activity/ActivityMovieDetails.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.activity; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.res.Resources; 6 | import android.graphics.Bitmap; 7 | import android.graphics.Color; 8 | import android.graphics.drawable.BitmapDrawable; 9 | import android.os.Bundle; 10 | import android.support.design.widget.AppBarLayout; 11 | import android.support.design.widget.CollapsingToolbarLayout; 12 | import android.support.design.widget.CoordinatorLayout; 13 | import android.support.v7.app.AppCompatActivity; 14 | import android.support.v7.graphics.Palette; 15 | import android.support.v7.widget.LinearLayoutManager; 16 | import android.support.v7.widget.RecyclerView; 17 | import android.support.v7.widget.Toolbar; 18 | import android.util.Log; 19 | import android.view.Menu; 20 | import android.view.MenuItem; 21 | import android.view.View; 22 | import android.webkit.WebSettings; 23 | import android.webkit.WebView; 24 | import android.widget.ImageView; 25 | import android.widget.ProgressBar; 26 | import android.widget.TextView; 27 | import android.widget.Toast; 28 | 29 | import com.squareup.picasso.Callback; 30 | import com.squareup.picasso.Picasso; 31 | 32 | import app.movie.tutorial.com.Config; 33 | import app.movie.tutorial.com.R; 34 | import app.movie.tutorial.com.adapter.GenresAdapter; 35 | import app.movie.tutorial.com.adapter.ProductionCompaniesAdapter; 36 | import app.movie.tutorial.com.model.movie.MovieResponse; 37 | import app.movie.tutorial.com.rest.API; 38 | import retrofit2.Call; 39 | import retrofit2.Response; 40 | import retrofit2.Retrofit; 41 | 42 | public class ActivityMovieDetails extends AppCompatActivity { 43 | private final static String TAG = ActivityMovieDetails.class.getSimpleName(); 44 | private Context context; 45 | private static Retrofit retrofit = null; 46 | private Toolbar toolbar; 47 | private TextView tv_title, tv_original_title; 48 | private WebView webView; 49 | private ImageView img_movie; 50 | private CollapsingToolbarLayout collapsingToolbarLayout; 51 | private ProgressBar progressBar; 52 | private CoordinatorLayout coordinatorLayout; 53 | private RecyclerView genres_recycler_view; 54 | private RecyclerView production_companies_rv; 55 | private AppBarLayout appBarLayout; 56 | private String title, overview; 57 | 58 | @Override 59 | protected void onCreate(Bundle savedInstanceState) { 60 | super.onCreate(savedInstanceState); 61 | setContentView(R.layout.activity_movie_details); 62 | this.context = getApplicationContext(); 63 | 64 | //Find views 65 | toolbar = (Toolbar) findViewById(R.id.toolbar); 66 | collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); 67 | coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content); 68 | progressBar = (ProgressBar) findViewById(R.id.progressBar); 69 | img_movie = (ImageView) findViewById(R.id.image); 70 | tv_title = (TextView) findViewById(R.id.title); 71 | tv_original_title = (TextView) findViewById(R.id.original_title); 72 | webView = (WebView) findViewById(R.id.desc); 73 | appBarLayout = (AppBarLayout) findViewById(R.id.appbar); 74 | genres_recycler_view = (RecyclerView) findViewById(R.id.genres_recycler_view); 75 | production_companies_rv = (RecyclerView) findViewById(R.id.production_companies_rv); 76 | 77 | setSupportActionBar(toolbar); 78 | 79 | final android.support.v7.app.ActionBar actionBar = getSupportActionBar(); 80 | 81 | genres_recycler_view.setHasFixedSize(true); 82 | genres_recycler_view.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)); 83 | 84 | production_companies_rv.setHasFixedSize(true); 85 | production_companies_rv.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); 86 | 87 | Intent iGet = getIntent(); 88 | int movieId = iGet.getIntExtra("movieId", 0); 89 | 90 | 91 | API.movies().movieDetails(movieId, Config.API_KEY).enqueue(new retrofit2.Callback() { 92 | @Override 93 | public void onResponse(Call call, Response response) { 94 | 95 | final MovieResponse movie = response.body(); 96 | 97 | title = movie.getTitle(); 98 | overview = movie.getOverview(); 99 | if (actionBar != null) { 100 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 101 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 102 | getSupportActionBar().setTitle(title); 103 | } 104 | 105 | appBarLayout.setExpanded(true); 106 | 107 | // hiding & showing the title when toolbar expanded & collapsed 108 | appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { 109 | boolean isShow = false; 110 | int scrollRange = -1; 111 | 112 | @Override 113 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { 114 | if (scrollRange == -1) { 115 | scrollRange = appBarLayout.getTotalScrollRange(); 116 | } 117 | if (scrollRange + verticalOffset == 0) { 118 | collapsingToolbarLayout.setTitle(title); 119 | isShow = true; 120 | } else if (isShow) { 121 | collapsingToolbarLayout.setTitle(title); 122 | isShow = false; 123 | } 124 | } 125 | }); 126 | collapsingToolbarLayout.setTitle(title); 127 | renderMovie(movie); 128 | progressBar.setVisibility(View.GONE); 129 | coordinatorLayout.setVisibility(View.VISIBLE); 130 | } 131 | 132 | @Override 133 | public void onFailure(Call call, Throwable throwable) { 134 | Log.e(TAG, throwable.toString()); 135 | progressBar.setVisibility(View.GONE); 136 | Toast.makeText(getApplicationContext(), "Error loading!", Toast.LENGTH_SHORT).show(); 137 | } 138 | }); 139 | } 140 | 141 | public void renderMovie(MovieResponse movie) { 142 | tv_title.setText(movie.getTitle()); 143 | tv_original_title.setText(context.getString(R.string.tv_original_title, movie.getOriginalTitle(), movie.getReleaseDate().toString())); 144 | webView.setBackgroundColor(Color.parseColor("#ffffff")); 145 | webView.setFocusableInTouchMode(false); 146 | webView.setFocusable(false); 147 | webView.getSettings().setDefaultTextEncodingName("UTF-8"); 148 | WebSettings ws = webView.getSettings(); 149 | Resources res = getResources(); 150 | ws.setDefaultFontSize(15); 151 | String mimeType = "text/html; charset=UTF-8"; 152 | String encoding = "utf-8"; 153 | String text = "" 154 | + "" 155 | + "" 157 | + "

Overview:

" 158 | + movie.getOverview() 159 | + "" 160 | + ""; 161 | 162 | webView.loadData(text, mimeType, encoding); 163 | 164 | Picasso.with(this) 165 | .load(Config.IMAGE_URL_BASE_PATH + movie.getBackdropPath()) 166 | .into(img_movie, new Callback() { 167 | @Override 168 | public void onSuccess() { 169 | Bitmap bitmap = ((BitmapDrawable) img_movie.getDrawable()).getBitmap(); 170 | Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { 171 | @Override 172 | public void onGenerated(Palette palette) { 173 | 174 | } 175 | }); 176 | } 177 | 178 | @Override 179 | public void onError() { 180 | Toast.makeText(getApplicationContext(), "Error loading picture!", Toast.LENGTH_SHORT).show(); 181 | } 182 | }); 183 | 184 | genres_recycler_view.setAdapter( 185 | new GenresAdapter( 186 | movie.getGenres(), 187 | R.layout.list_item_genre, 188 | context 189 | ) 190 | ); 191 | 192 | production_companies_rv.setAdapter( 193 | new ProductionCompaniesAdapter( 194 | movie.getProductionCompanies(), 195 | R.layout.list_item_pc, 196 | context 197 | ) 198 | ); 199 | 200 | } 201 | 202 | @Override 203 | public boolean onCreateOptionsMenu(Menu menu) { 204 | getMenuInflater().inflate(R.menu.menu_movie_details, menu); 205 | return super.onCreateOptionsMenu(menu); 206 | } 207 | 208 | @Override 209 | public boolean onOptionsItemSelected(MenuItem menuItem) { 210 | switch (menuItem.getItemId()) { 211 | case android.R.id.home: 212 | onBackPressed(); 213 | break; 214 | case R.id.menu_share: 215 | String formattedString = android.text.Html.fromHtml(overview).toString(); 216 | Intent share = new Intent(); 217 | share.setAction(Intent.ACTION_SEND); 218 | share.putExtra(Intent.EXTRA_TITLE, title); 219 | share.putExtra(Intent.EXTRA_PACKAGE_NAME, getPackageName()); 220 | share.putExtra(Intent.EXTRA_TEXT, formattedString); 221 | share.setType("text/plain"); 222 | startActivity(share); 223 | break; 224 | default: 225 | return super.onOptionsItemSelected(menuItem); 226 | } 227 | return true; 228 | } 229 | 230 | @Override 231 | public void onStart() { 232 | super.onStart(); 233 | } 234 | 235 | @Override 236 | public void onStop() { 237 | super.onStop(); 238 | } 239 | 240 | @Override 241 | protected void onPause() { 242 | super.onPause(); 243 | } 244 | 245 | @Override 246 | protected void onResume() { 247 | super.onResume(); 248 | } 249 | 250 | @Override 251 | protected void onDestroy() { 252 | super.onDestroy(); 253 | } 254 | 255 | } 256 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.activity; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Handler; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.util.Log; 11 | import android.view.GestureDetector; 12 | import android.view.MotionEvent; 13 | import android.view.View; 14 | 15 | import java.util.List; 16 | 17 | import app.movie.tutorial.com.Config; 18 | import app.movie.tutorial.com.R; 19 | import app.movie.tutorial.com.adapter.MoviesAdapter; 20 | import app.movie.tutorial.com.model.movies.MovieItem; 21 | import app.movie.tutorial.com.model.movies.MoviesResponse; 22 | import app.movie.tutorial.com.rest.API; 23 | import retrofit2.Call; 24 | import retrofit2.Response; 25 | 26 | public class MainActivity extends AppCompatActivity { 27 | private static final String TAG = MainActivity.class.getSimpleName(); 28 | 29 | private Context context; 30 | private RecyclerView recyclerView = null; 31 | private List movies; 32 | 33 | @Override 34 | protected void onCreate(Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | setContentView(R.layout.activity_main); 37 | context = getApplicationContext(); 38 | 39 | //Find vies 40 | recyclerView = (RecyclerView) findViewById(R.id.recycler_view); 41 | 42 | recyclerView.setHasFixedSize(true); 43 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 44 | recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new ClickListener() { 45 | @Override 46 | public void onClick(View view, final int position) { 47 | 48 | new Handler().postDelayed(new Runnable() { 49 | @Override 50 | public void run() { 51 | Intent intent = new Intent(getApplicationContext(), ActivityMovieDetails.class); 52 | intent.putExtra("movieId", movies.get(position).getId()); 53 | startActivity(intent); 54 | } 55 | }, 400); 56 | 57 | } 58 | 59 | @Override 60 | public void onLongClick(View view, int position) { 61 | 62 | } 63 | })); 64 | 65 | API.movies().topRated(Config.API_KEY).enqueue(new retrofit2.Callback() { 66 | @Override 67 | public void onResponse(Call call, Response response) { 68 | Log.e(TAG, call.request().toString()); 69 | movies = response.body().getResults(); 70 | recyclerView.setAdapter(new MoviesAdapter(movies, R.layout.list_item_movie, getApplicationContext())); 71 | } 72 | 73 | @Override 74 | public void onFailure(Call call, Throwable throwable) { 75 | Log.e(TAG, throwable.toString()); 76 | } 77 | }); 78 | 79 | } 80 | 81 | class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { 82 | 83 | private GestureDetector gestureDetector; 84 | private ClickListener clickListener; 85 | 86 | public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) { 87 | 88 | this.clickListener = clickListener; 89 | 90 | gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { 91 | @Override 92 | public boolean onSingleTapUp(MotionEvent e) { 93 | return true; 94 | } 95 | 96 | @Override 97 | public void onLongPress(MotionEvent e) { 98 | View child = recyclerView.findChildViewUnder(e.getX(), e.getY()); 99 | if (child != null && clickListener != null) { 100 | clickListener.onLongClick(child, recyclerView.getChildAdapterPosition(child)); 101 | } 102 | } 103 | }); 104 | } 105 | 106 | @Override 107 | public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { 108 | View child = recyclerView.findChildViewUnder(e.getX(), e.getY()); 109 | if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { 110 | clickListener.onClick(child, rv.getChildAdapterPosition(child)); 111 | } 112 | return false; 113 | } 114 | 115 | @Override 116 | public void onTouchEvent(RecyclerView rv, MotionEvent e) { 117 | 118 | } 119 | 120 | @Override 121 | public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { 122 | 123 | } 124 | } 125 | 126 | public interface ClickListener { 127 | public void onClick(View view, int position); 128 | 129 | public void onLongClick(View view, int position); 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/adapter/GenresAdapter.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.Log; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.LinearLayout; 10 | import android.widget.TextView; 11 | 12 | import java.util.List; 13 | 14 | import app.movie.tutorial.com.R; 15 | import app.movie.tutorial.com.model.movie.GenreItem; 16 | 17 | public class GenresAdapter extends RecyclerView.Adapter { 18 | private static final String TAG = GenresAdapter.class.getSimpleName(); 19 | 20 | private List genres; 21 | private int rowLayout; 22 | private Context context; 23 | 24 | public GenresAdapter(List genres, int rowLayout, Context context) { 25 | this.genres = genres; 26 | this.rowLayout = rowLayout; 27 | this.context = context; 28 | } 29 | 30 | public static class GenreViewHolder extends RecyclerView.ViewHolder { 31 | TextView genreName; 32 | public GenreViewHolder(View v) { 33 | super(v); 34 | genreName = (TextView) v.findViewById(R.id.genreName); 35 | } 36 | } 37 | 38 | @Override 39 | public GenresAdapter.GenreViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 40 | View view = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false); 41 | return new GenreViewHolder(view); 42 | } 43 | 44 | @Override 45 | public void onBindViewHolder(GenreViewHolder holder, final int position) { 46 | holder.genreName.setText(this.genres.get(position).getName()); 47 | } 48 | 49 | @Override 50 | public int getItemCount() { 51 | return genres.size(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/adapter/MoviesAdapter.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.LinearLayout; 10 | import android.widget.TextView; 11 | 12 | import java.util.List; 13 | 14 | import app.movie.tutorial.com.R; 15 | import app.movie.tutorial.com.model.movies.MovieItem; 16 | import com.squareup.picasso.Picasso; 17 | 18 | public class MoviesAdapter extends RecyclerView.Adapter { 19 | 20 | private List movies; 21 | private int rowLayout; 22 | private Context context; 23 | public static final String IMAGE_URL_BASE_PATH="http://image.tmdb.org/t/p/w342//"; 24 | 25 | public MoviesAdapter(List movies, int rowLayout, Context context) { 26 | this.movies = movies; 27 | this.rowLayout = rowLayout; 28 | this.context = context; 29 | } 30 | 31 | //A view holder inner class where we get reference to the views in the layout using their ID 32 | 33 | public static class MovieViewHolder extends RecyclerView.ViewHolder { 34 | LinearLayout moviesLayout; 35 | TextView movieTitle; 36 | TextView movieDescription; 37 | TextView rating; 38 | ImageView movieImage; 39 | 40 | public MovieViewHolder(View v) { 41 | super(v); 42 | moviesLayout = (LinearLayout) v.findViewById(R.id.movies_layout); 43 | movieImage = (ImageView) v.findViewById(R.id.movie_image); 44 | movieTitle = (TextView) v.findViewById(R.id.title); 45 | movieDescription = (TextView) v.findViewById(R.id.description); 46 | rating = (TextView) v.findViewById(R.id.rating); 47 | } 48 | } 49 | 50 | 51 | @Override 52 | public MoviesAdapter.MovieViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 53 | View view = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false); 54 | return new MovieViewHolder(view); 55 | } 56 | 57 | @Override 58 | public void onBindViewHolder(MovieViewHolder holder, final int position) { 59 | String image_url = IMAGE_URL_BASE_PATH + movies.get(position).getPosterPath(); 60 | Picasso.with(context) 61 | .load(image_url) 62 | .placeholder(android.R.drawable.sym_def_app_icon) 63 | .error(android.R.drawable.sym_def_app_icon) 64 | .into(holder.movieImage); 65 | holder.movieTitle.setText(movies.get(position).getTitle()); 66 | holder.movieDescription.setText(movies.get(position).getOverview()); 67 | holder.rating.setText(movies.get(position).getVoteAverage().toString()); 68 | } 69 | 70 | @Override 71 | public int getItemCount() { 72 | return movies.size(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/adapter/ProductionCompaniesAdapter.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.drawable.BitmapDrawable; 6 | import android.support.v7.graphics.Palette; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.util.Log; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ImageView; 13 | import android.widget.TextView; 14 | import android.widget.Toast; 15 | 16 | import com.squareup.picasso.Callback; 17 | import com.squareup.picasso.Picasso; 18 | 19 | import java.util.List; 20 | 21 | import app.movie.tutorial.com.R; 22 | import app.movie.tutorial.com.model.movie.ProductionCompanyItem; 23 | 24 | public class ProductionCompaniesAdapter extends RecyclerView.Adapter { 25 | private static final String TAG = ProductionCompaniesAdapter.class.getSimpleName(); 26 | public final static String IMAGE_URL_BASE_PATH = "http://image.tmdb.org/t/p/w342//"; 27 | private List pc; 28 | private int rowLayout; 29 | private Context context; 30 | 31 | public ProductionCompaniesAdapter(List pc, int rowLayout, Context context) { 32 | this.pc = pc; 33 | this.rowLayout = rowLayout; 34 | this.context = context; 35 | } 36 | 37 | public static class PcViewHolder extends RecyclerView.ViewHolder { 38 | 39 | TextView pc_name; 40 | TextView pc_origin_country; 41 | TextView pc_id; 42 | ImageView logo_path; 43 | 44 | public PcViewHolder(View v) { 45 | super(v); 46 | logo_path = (ImageView) v.findViewById(R.id.logo_path); 47 | pc_name = (TextView) v.findViewById(R.id.pc_name); 48 | pc_id = (TextView) v.findViewById(R.id.pc_id); 49 | pc_origin_country = (TextView) v.findViewById(R.id.pc_origin_country); 50 | } 51 | } 52 | 53 | @Override 54 | public ProductionCompaniesAdapter.PcViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 55 | View view = LayoutInflater.from(parent.getContext()).inflate(rowLayout, parent, false); 56 | return new PcViewHolder(view); 57 | } 58 | 59 | @Override 60 | public void onBindViewHolder(final PcViewHolder holder, final int position) { 61 | holder.pc_origin_country.setText(this.pc.get(position).getOrigin_country()); 62 | holder.pc_name.setText(this.pc.get(position).getName()); 63 | holder.pc_id.setText(this.pc.get(position).getId().toString()); 64 | 65 | final ImageView logo_path = holder.logo_path; 66 | 67 | Picasso.with(context) 68 | .load(IMAGE_URL_BASE_PATH + this.pc.get(position).getLogo_path()) 69 | .placeholder(R.drawable.star) 70 | .into(logo_path, new Callback() { 71 | @Override 72 | public void onSuccess() { 73 | Bitmap bitmap = ((BitmapDrawable) logo_path.getDrawable()).getBitmap(); 74 | Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { 75 | @Override 76 | public void onGenerated(Palette palette) { 77 | 78 | } 79 | }); 80 | } 81 | 82 | @Override 83 | public void onError() { 84 | 85 | } 86 | }); 87 | } 88 | 89 | @Override 90 | public int getItemCount() { 91 | return pc.size(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/configuration/ConfigurationResponse.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.configuration; 2 | 3 | import java.util.List; 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class ConfigurationResponse { 8 | 9 | @SerializedName("images") 10 | @Expose 11 | private Images images; 12 | @SerializedName("change_keys") 13 | @Expose 14 | private List changeKeys = null; 15 | 16 | public Images getImages() { 17 | return images; 18 | } 19 | 20 | public void setImages(Images images) { 21 | this.images = images; 22 | } 23 | 24 | public List getChangeKeys() { 25 | return changeKeys; 26 | } 27 | 28 | public void setChangeKeys(List changeKeys) { 29 | this.changeKeys = changeKeys; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "ConfigurationResponse{" + 35 | "images=" + images + 36 | ", changeKeys=" + changeKeys + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/configuration/Images.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.configuration; 2 | 3 | import java.util.List; 4 | 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Images { 9 | 10 | @SerializedName("base_url") 11 | @Expose 12 | private String baseUrl; 13 | @SerializedName("secure_base_url") 14 | @Expose 15 | private String secureBaseUrl; 16 | @SerializedName("backdrop_sizes") 17 | @Expose 18 | private List backdropSizes = null; 19 | @SerializedName("logo_sizes") 20 | @Expose 21 | private List logoSizes = null; 22 | @SerializedName("poster_sizes") 23 | @Expose 24 | private List posterSizes = null; 25 | @SerializedName("profile_sizes") 26 | @Expose 27 | private List profileSizes = null; 28 | @SerializedName("still_sizes") 29 | @Expose 30 | private List stillSizes = null; 31 | 32 | public String getBaseUrl() { 33 | return baseUrl; 34 | } 35 | 36 | public void setBaseUrl(String baseUrl) { 37 | this.baseUrl = baseUrl; 38 | } 39 | 40 | public String getSecureBaseUrl() { 41 | return secureBaseUrl; 42 | } 43 | 44 | public void setSecureBaseUrl(String secureBaseUrl) { 45 | this.secureBaseUrl = secureBaseUrl; 46 | } 47 | 48 | public List getBackdropSizes() { 49 | return backdropSizes; 50 | } 51 | 52 | public void setBackdropSizes(List backdropSizes) { 53 | this.backdropSizes = backdropSizes; 54 | } 55 | 56 | public List getLogoSizes() { 57 | return logoSizes; 58 | } 59 | 60 | public void setLogoSizes(List logoSizes) { 61 | this.logoSizes = logoSizes; 62 | } 63 | 64 | public List getPosterSizes() { 65 | return posterSizes; 66 | } 67 | 68 | public void setPosterSizes(List posterSizes) { 69 | this.posterSizes = posterSizes; 70 | } 71 | 72 | public List getProfileSizes() { 73 | return profileSizes; 74 | } 75 | 76 | public void setProfileSizes(List profileSizes) { 77 | this.profileSizes = profileSizes; 78 | } 79 | 80 | public List getStillSizes() { 81 | return stillSizes; 82 | } 83 | 84 | public void setStillSizes(List stillSizes) { 85 | this.stillSizes = stillSizes; 86 | } 87 | 88 | @Override 89 | public String toString() { 90 | return "Images{" + 91 | "baseUrl='" + baseUrl + '\'' + 92 | ", secureBaseUrl='" + secureBaseUrl + '\'' + 93 | ", backdropSizes=" + backdropSizes + 94 | ", logoSizes=" + logoSizes + 95 | ", posterSizes=" + posterSizes + 96 | ", profileSizes=" + profileSizes + 97 | ", stillSizes=" + stillSizes + 98 | '}'; 99 | } 100 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/GenreItem.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class GenreItem { 7 | 8 | @SerializedName("id") 9 | @Expose 10 | private Integer id; 11 | @SerializedName("name") 12 | @Expose 13 | private String name; 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | 32 | @Override 33 | public String toString() { 34 | return "GenreItem{" + 35 | "id=" + id + 36 | ", name='" + name + '\'' + 37 | '}'; 38 | } 39 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/MovieResponse.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie; 2 | 3 | import java.util.List; 4 | 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class MovieResponse { 9 | 10 | @SerializedName("adult") 11 | @Expose 12 | private Boolean adult; 13 | @SerializedName("backdrop_path") 14 | @Expose 15 | private String backdropPath; 16 | @SerializedName("belongs_to_collection") 17 | @Expose 18 | private Object belongsToCollection; 19 | @SerializedName("budget") 20 | @Expose 21 | private Integer budget; 22 | @SerializedName("genres") 23 | @Expose 24 | private List genres = null; 25 | @SerializedName("homepage") 26 | @Expose 27 | private String homepage; 28 | @SerializedName("id") 29 | @Expose 30 | private Integer id; 31 | @SerializedName("imdb_id") 32 | @Expose 33 | private String imdbId; 34 | @SerializedName("original_language") 35 | @Expose 36 | private String originalLanguage; 37 | @SerializedName("original_title") 38 | @Expose 39 | private String originalTitle; 40 | @SerializedName("overview") 41 | @Expose 42 | private String overview; 43 | @SerializedName("popularity") 44 | @Expose 45 | private Double popularity; 46 | @SerializedName("poster_path") 47 | @Expose 48 | private String posterPath; 49 | @SerializedName("production_companies") 50 | @Expose 51 | private List productionCompanies = null; 52 | @SerializedName("production_countries") 53 | @Expose 54 | private List productionCountries = null; 55 | @SerializedName("release_date") 56 | @Expose 57 | private String releaseDate; 58 | @SerializedName("revenue") 59 | @Expose 60 | private Integer revenue; 61 | @SerializedName("runtime") 62 | @Expose 63 | private Integer runtime; 64 | @SerializedName("spoken_languages") 65 | @Expose 66 | private List spokenLanguages = null; 67 | @SerializedName("status") 68 | @Expose 69 | private String status; 70 | @SerializedName("tagline") 71 | @Expose 72 | private String tagline; 73 | @SerializedName("title") 74 | @Expose 75 | private String title; 76 | @SerializedName("video") 77 | @Expose 78 | private Boolean video; 79 | @SerializedName("vote_average") 80 | @Expose 81 | private Double voteAverage; 82 | @SerializedName("vote_count") 83 | @Expose 84 | private Integer voteCount; 85 | 86 | public Boolean getAdult() { 87 | return adult; 88 | } 89 | 90 | public void setAdult(Boolean adult) { 91 | this.adult = adult; 92 | } 93 | 94 | public String getBackdropPath() { 95 | return backdropPath; 96 | } 97 | 98 | public void setBackdropPath(String backdropPath) { 99 | this.backdropPath = backdropPath; 100 | } 101 | 102 | public Object getBelongsToCollection() { 103 | return belongsToCollection; 104 | } 105 | 106 | public void setBelongsToCollection(Object belongsToCollection) { 107 | this.belongsToCollection = belongsToCollection; 108 | } 109 | 110 | public Integer getBudget() { 111 | return budget; 112 | } 113 | 114 | public void setBudget(Integer budget) { 115 | this.budget = budget; 116 | } 117 | 118 | public List getGenres() { 119 | return genres; 120 | } 121 | 122 | public void setGenres(List genres) { 123 | this.genres = genres; 124 | } 125 | 126 | public String getHomepage() { 127 | return homepage; 128 | } 129 | 130 | public void setHomepage(String homepage) { 131 | this.homepage = homepage; 132 | } 133 | 134 | public Integer getId() { 135 | return id; 136 | } 137 | 138 | public void setId(Integer id) { 139 | this.id = id; 140 | } 141 | 142 | public String getImdbId() { 143 | return imdbId; 144 | } 145 | 146 | public void setImdbId(String imdbId) { 147 | this.imdbId = imdbId; 148 | } 149 | 150 | public String getOriginalLanguage() { 151 | return originalLanguage; 152 | } 153 | 154 | public void setOriginalLanguage(String originalLanguage) { 155 | this.originalLanguage = originalLanguage; 156 | } 157 | 158 | public String getOriginalTitle() { 159 | return originalTitle; 160 | } 161 | 162 | public void setOriginalTitle(String originalTitle) { 163 | this.originalTitle = originalTitle; 164 | } 165 | 166 | public String getOverview() { 167 | return overview; 168 | } 169 | 170 | public void setOverview(String overview) { 171 | this.overview = overview; 172 | } 173 | 174 | public Double getPopularity() { 175 | return popularity; 176 | } 177 | 178 | public void setPopularity(Double popularity) { 179 | this.popularity = popularity; 180 | } 181 | 182 | public String getPosterPath() { 183 | return posterPath; 184 | } 185 | 186 | public void setPosterPath(String posterPath) { 187 | this.posterPath = posterPath; 188 | } 189 | 190 | public List getProductionCompanies() { 191 | return productionCompanies; 192 | } 193 | 194 | public void setProductionCompanies(List productionCompanies) { 195 | this.productionCompanies = productionCompanies; 196 | } 197 | 198 | public List getProductionCountries() { 199 | return productionCountries; 200 | } 201 | 202 | public void setProductionCountries(List productionCountries) { 203 | this.productionCountries = productionCountries; 204 | } 205 | 206 | public String getReleaseDate() { 207 | return releaseDate; 208 | } 209 | 210 | public void setReleaseDate(String releaseDate) { 211 | this.releaseDate = releaseDate; 212 | } 213 | 214 | public Integer getRevenue() { 215 | return revenue; 216 | } 217 | 218 | public void setRevenue(Integer revenue) { 219 | this.revenue = revenue; 220 | } 221 | 222 | public Integer getRuntime() { 223 | return runtime; 224 | } 225 | 226 | public void setRuntime(Integer runtime) { 227 | this.runtime = runtime; 228 | } 229 | 230 | public List getSpokenLanguages() { 231 | return spokenLanguages; 232 | } 233 | 234 | public void setSpokenLanguages(List spokenLanguages) { 235 | this.spokenLanguages = spokenLanguages; 236 | } 237 | 238 | public String getStatus() { 239 | return status; 240 | } 241 | 242 | public void setStatus(String status) { 243 | this.status = status; 244 | } 245 | 246 | public String getTagline() { 247 | return tagline; 248 | } 249 | 250 | public void setTagline(String tagline) { 251 | this.tagline = tagline; 252 | } 253 | 254 | public String getTitle() { 255 | return title; 256 | } 257 | 258 | public void setTitle(String title) { 259 | this.title = title; 260 | } 261 | 262 | public Boolean getVideo() { 263 | return video; 264 | } 265 | 266 | public void setVideo(Boolean video) { 267 | this.video = video; 268 | } 269 | 270 | public Double getVoteAverage() { 271 | return voteAverage; 272 | } 273 | 274 | public void setVoteAverage(Double voteAverage) { 275 | this.voteAverage = voteAverage; 276 | } 277 | 278 | public Integer getVoteCount() { 279 | return voteCount; 280 | } 281 | 282 | public void setVoteCount(Integer voteCount) { 283 | this.voteCount = voteCount; 284 | } 285 | 286 | @Override 287 | public String toString() { 288 | return "MovieResponse{" + 289 | "adult=" + adult + 290 | ", backdropPath='" + backdropPath + '\'' + 291 | ", belongsToCollection=" + belongsToCollection + 292 | ", budget=" + budget + 293 | ", genres=" + genres + 294 | ", homepage='" + homepage + '\'' + 295 | ", id=" + id + 296 | ", imdbId='" + imdbId + '\'' + 297 | ", originalLanguage='" + originalLanguage + '\'' + 298 | ", originalTitle='" + originalTitle + '\'' + 299 | ", overview='" + overview + '\'' + 300 | ", popularity=" + popularity + 301 | ", posterPath='" + posterPath + '\'' + 302 | ", productionCompanies=" + productionCompanies + 303 | ", productionCountries=" + productionCountries + 304 | ", releaseDate='" + releaseDate + '\'' + 305 | ", revenue=" + revenue + 306 | ", runtime=" + runtime + 307 | ", spokenLanguages=" + spokenLanguages + 308 | ", status='" + status + '\'' + 309 | ", tagline='" + tagline + '\'' + 310 | ", title='" + title + '\'' + 311 | ", video=" + video + 312 | ", voteAverage=" + voteAverage + 313 | ", voteCount=" + voteCount + 314 | '}'; 315 | } 316 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/ProductionCompanyItem.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class ProductionCompanyItem { 7 | 8 | @SerializedName("name") 9 | @Expose 10 | private String name; 11 | 12 | @SerializedName("origin_country") 13 | @Expose 14 | private String origin_country; 15 | 16 | @SerializedName("logo_path") 17 | @Expose 18 | private String logo_path; 19 | 20 | @SerializedName("id") 21 | @Expose 22 | private Integer id; 23 | 24 | public String getOrigin_country() { 25 | return origin_country; 26 | } 27 | 28 | public void setOrigin_country(String origin_country) { 29 | this.origin_country = origin_country; 30 | } 31 | 32 | public String getLogo_path() { 33 | return logo_path; 34 | } 35 | 36 | public void setLogo_path(String logo_path) { 37 | this.logo_path = logo_path; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | public Integer getId() { 49 | return id; 50 | } 51 | 52 | public void setId(Integer id) { 53 | this.id = id; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "ProductionCompanyItem{" + 59 | "name='" + name + '\'' + 60 | ", origin_country='" + origin_country + '\'' + 61 | ", logo_path='" + logo_path + '\'' + 62 | ", id=" + id + 63 | '}'; 64 | } 65 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/ProductionCountryItem.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class ProductionCountryItem { 7 | 8 | @SerializedName("iso_3166_1") 9 | @Expose 10 | private String iso31661; 11 | @SerializedName("name") 12 | @Expose 13 | private String name; 14 | 15 | public String getIso31661() { 16 | return iso31661; 17 | } 18 | 19 | public void setIso31661(String iso31661) { 20 | this.iso31661 = iso31661; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | 32 | @Override 33 | public String toString() { 34 | return "ProductionCountryItem{" + 35 | "iso31661='" + iso31661 + '\'' + 36 | ", name='" + name + '\'' + 37 | '}'; 38 | } 39 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/SpokenLanguageItem.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class SpokenLanguageItem { 7 | 8 | @SerializedName("iso_639_1") 9 | @Expose 10 | private String iso6391; 11 | 12 | @SerializedName("name") 13 | @Expose 14 | private String name; 15 | 16 | public String getIso6391() { 17 | return iso6391; 18 | } 19 | 20 | public void setIso6391(String iso6391) { 21 | this.iso6391 = iso6391; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "SpokenLanguageItem{" + 35 | "iso6391='" + iso6391 + '\'' + 36 | ", name='" + name + '\'' + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/images/Backdrop.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie.images; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class Backdrop { 7 | 8 | @SerializedName("aspect_ratio") 9 | @Expose 10 | private Double aspectRatio; 11 | @SerializedName("file_path") 12 | @Expose 13 | private String filePath; 14 | @SerializedName("height") 15 | @Expose 16 | private Integer height; 17 | @SerializedName("iso_639_1") 18 | @Expose 19 | private Object iso6391; 20 | @SerializedName("vote_average") 21 | @Expose 22 | private Integer voteAverage; 23 | @SerializedName("vote_count") 24 | @Expose 25 | private Integer voteCount; 26 | @SerializedName("width") 27 | @Expose 28 | private Integer width; 29 | 30 | public Double getAspectRatio() { 31 | return aspectRatio; 32 | } 33 | 34 | public void setAspectRatio(Double aspectRatio) { 35 | this.aspectRatio = aspectRatio; 36 | } 37 | 38 | public String getFilePath() { 39 | return filePath; 40 | } 41 | 42 | public void setFilePath(String filePath) { 43 | this.filePath = filePath; 44 | } 45 | 46 | public Integer getHeight() { 47 | return height; 48 | } 49 | 50 | public void setHeight(Integer height) { 51 | this.height = height; 52 | } 53 | 54 | public Object getIso6391() { 55 | return iso6391; 56 | } 57 | 58 | public void setIso6391(Object iso6391) { 59 | this.iso6391 = iso6391; 60 | } 61 | 62 | public Integer getVoteAverage() { 63 | return voteAverage; 64 | } 65 | 66 | public void setVoteAverage(Integer voteAverage) { 67 | this.voteAverage = voteAverage; 68 | } 69 | 70 | public Integer getVoteCount() { 71 | return voteCount; 72 | } 73 | 74 | public void setVoteCount(Integer voteCount) { 75 | this.voteCount = voteCount; 76 | } 77 | 78 | public Integer getWidth() { 79 | return width; 80 | } 81 | 82 | public void setWidth(Integer width) { 83 | this.width = width; 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | return "Backdrop{" + 89 | "aspectRatio=" + aspectRatio + 90 | ", filePath='" + filePath + '\'' + 91 | ", height=" + height + 92 | ", iso6391=" + iso6391 + 93 | ", voteAverage=" + voteAverage + 94 | ", voteCount=" + voteCount + 95 | ", width=" + width + 96 | '}'; 97 | } 98 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/images/ImagesResponse.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie.images; 2 | 3 | import java.util.List; 4 | 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class ImagesResponse { 9 | 10 | @SerializedName("id") 11 | @Expose 12 | private Integer id; 13 | @SerializedName("backdrops") 14 | @Expose 15 | private List backdrops = null; 16 | @SerializedName("posters") 17 | @Expose 18 | private List posters = null; 19 | 20 | public Integer getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Integer id) { 25 | this.id = id; 26 | } 27 | 28 | public List getBackdrops() { 29 | return backdrops; 30 | } 31 | 32 | public void setBackdrops(List backdrops) { 33 | this.backdrops = backdrops; 34 | } 35 | 36 | public List getPosters() { 37 | return posters; 38 | } 39 | 40 | public void setPosters(List posters) { 41 | this.posters = posters; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "ImagesResponse{" + 47 | "id=" + id + 48 | ", backdrops=" + backdrops + 49 | ", posters=" + posters + 50 | '}'; 51 | } 52 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movie/images/Poster.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movie.images; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class Poster { 7 | 8 | @SerializedName("aspect_ratio") 9 | @Expose 10 | private Double aspectRatio; 11 | @SerializedName("file_path") 12 | @Expose 13 | private String filePath; 14 | @SerializedName("height") 15 | @Expose 16 | private Integer height; 17 | @SerializedName("iso_639_1") 18 | @Expose 19 | private String iso6391; 20 | @SerializedName("vote_average") 21 | @Expose 22 | private Integer voteAverage; 23 | @SerializedName("vote_count") 24 | @Expose 25 | private Integer voteCount; 26 | @SerializedName("width") 27 | @Expose 28 | private Integer width; 29 | 30 | public Double getAspectRatio() { 31 | return aspectRatio; 32 | } 33 | 34 | public void setAspectRatio(Double aspectRatio) { 35 | this.aspectRatio = aspectRatio; 36 | } 37 | 38 | public String getFilePath() { 39 | return filePath; 40 | } 41 | 42 | public void setFilePath(String filePath) { 43 | this.filePath = filePath; 44 | } 45 | 46 | public Integer getHeight() { 47 | return height; 48 | } 49 | 50 | public void setHeight(Integer height) { 51 | this.height = height; 52 | } 53 | 54 | public String getIso6391() { 55 | return iso6391; 56 | } 57 | 58 | public void setIso6391(String iso6391) { 59 | this.iso6391 = iso6391; 60 | } 61 | 62 | public Integer getVoteAverage() { 63 | return voteAverage; 64 | } 65 | 66 | public void setVoteAverage(Integer voteAverage) { 67 | this.voteAverage = voteAverage; 68 | } 69 | 70 | public Integer getVoteCount() { 71 | return voteCount; 72 | } 73 | 74 | public void setVoteCount(Integer voteCount) { 75 | this.voteCount = voteCount; 76 | } 77 | 78 | public Integer getWidth() { 79 | return width; 80 | } 81 | 82 | public void setWidth(Integer width) { 83 | this.width = width; 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | return "Poster{" + 89 | "aspectRatio=" + aspectRatio + 90 | ", filePath='" + filePath + '\'' + 91 | ", height=" + height + 92 | ", iso6391='" + iso6391 + '\'' + 93 | ", voteAverage=" + voteAverage + 94 | ", voteCount=" + voteCount + 95 | ", width=" + width + 96 | '}'; 97 | } 98 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movies/MovieItem.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movies; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class MovieItem { 10 | 11 | @SerializedName("poster_path") 12 | @Expose 13 | private String posterPath; 14 | 15 | @SerializedName("adult") 16 | @Expose 17 | private boolean adult; 18 | 19 | @SerializedName("overview") 20 | @Expose 21 | private String overview; 22 | 23 | @SerializedName("release_date") 24 | @Expose 25 | private String releaseDate; 26 | 27 | @SerializedName("genre_ids") 28 | @Expose 29 | private List genreIds = new ArrayList(); 30 | 31 | @SerializedName("id") 32 | @Expose 33 | private Integer id; 34 | 35 | @SerializedName("original_title") 36 | @Expose 37 | private String originalTitle; 38 | 39 | @SerializedName("original_language") 40 | @Expose 41 | private String originalLanguage; 42 | 43 | @SerializedName("title") 44 | @Expose 45 | private String title; 46 | 47 | @SerializedName("backdrop_path") 48 | @Expose 49 | private String backdropPath; 50 | 51 | @SerializedName("popularity") 52 | @Expose 53 | private Double popularity; 54 | 55 | @SerializedName("vote_count") 56 | @Expose 57 | private Integer voteCount; 58 | 59 | @SerializedName("video") 60 | @Expose 61 | private Boolean video; 62 | 63 | @SerializedName("vote_average") 64 | @Expose 65 | private Double voteAverage; 66 | 67 | public MovieItem(String posterPath, boolean adult, String overview, String releaseDate, List genreIds, Integer id, 68 | String originalTitle, String originalLanguage, String title, String backdropPath, Double popularity, 69 | Integer voteCount, Boolean video, Double voteAverage) { 70 | this.posterPath = posterPath; 71 | this.adult = adult; 72 | this.overview = overview; 73 | this.releaseDate = releaseDate; 74 | this.genreIds = genreIds; 75 | this.id = id; 76 | this.originalTitle = originalTitle; 77 | this.originalLanguage = originalLanguage; 78 | this.title = title; 79 | this.backdropPath = backdropPath; 80 | this.popularity = popularity; 81 | this.voteCount = voteCount; 82 | this.video = video; 83 | this.voteAverage = voteAverage; 84 | } 85 | 86 | public String getPosterPath() { 87 | return posterPath; 88 | } 89 | 90 | public void setPosterPath(String posterPath) { 91 | this.posterPath = posterPath; 92 | } 93 | 94 | public boolean isAdult() { 95 | return adult; 96 | } 97 | 98 | public void setAdult(boolean adult) { 99 | this.adult = adult; 100 | } 101 | 102 | public String getOverview() { 103 | return overview; 104 | } 105 | 106 | public void setOverview(String overview) { 107 | this.overview = overview; 108 | } 109 | 110 | public String getReleaseDate() { 111 | return releaseDate; 112 | } 113 | 114 | public void setReleaseDate(String releaseDate) { 115 | this.releaseDate = releaseDate; 116 | } 117 | 118 | public List getGenreIds() { 119 | return genreIds; 120 | } 121 | 122 | public void setGenreIds(List genreIds) { 123 | this.genreIds = genreIds; 124 | } 125 | 126 | public Integer getId() { 127 | return id; 128 | } 129 | 130 | public void setId(Integer id) { 131 | this.id = id; 132 | } 133 | 134 | public String getOriginalTitle() { 135 | return originalTitle; 136 | } 137 | 138 | public void setOriginalTitle(String originalTitle) { 139 | this.originalTitle = originalTitle; 140 | } 141 | 142 | public String getOriginalLanguage() { 143 | return originalLanguage; 144 | } 145 | 146 | public void setOriginalLanguage(String originalLanguage) { 147 | this.originalLanguage = originalLanguage; 148 | } 149 | 150 | public String getTitle() { 151 | return title; 152 | } 153 | 154 | public void setTitle(String title) { 155 | this.title = title; 156 | } 157 | 158 | public String getBackdropPath() { 159 | return backdropPath; 160 | } 161 | 162 | public void setBackdropPath(String backdropPath) { 163 | this.backdropPath = backdropPath; 164 | } 165 | 166 | public Double getPopularity() { 167 | return popularity; 168 | } 169 | 170 | public void setPopularity(Double popularity) { 171 | this.popularity = popularity; 172 | } 173 | 174 | public Integer getVoteCount() { 175 | return voteCount; 176 | } 177 | 178 | public void setVoteCount(Integer voteCount) { 179 | this.voteCount = voteCount; 180 | } 181 | 182 | public Boolean getVideo() { 183 | return video; 184 | } 185 | 186 | public void setVideo(Boolean video) { 187 | this.video = video; 188 | } 189 | 190 | public Double getVoteAverage() { 191 | return voteAverage; 192 | } 193 | 194 | public void setVoteAverage(Double voteAverage) { 195 | this.voteAverage = voteAverage; 196 | } 197 | 198 | @Override 199 | public String toString() { 200 | return "MovieItem{" + 201 | "posterPath='" + posterPath + '\'' + 202 | ", adult=" + adult + 203 | ", overview='" + overview + '\'' + 204 | ", releaseDate='" + releaseDate + '\'' + 205 | ", genreIds=" + genreIds + 206 | ", id=" + id + 207 | ", originalTitle='" + originalTitle + '\'' + 208 | ", originalLanguage='" + originalLanguage + '\'' + 209 | ", title='" + title + '\'' + 210 | ", backdropPath='" + backdropPath + '\'' + 211 | ", popularity=" + popularity + 212 | ", voteCount=" + voteCount + 213 | ", video=" + video + 214 | ", voteAverage=" + voteAverage + 215 | '}'; 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/movies/MoviesResponse.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.movies; 2 | 3 | import java.util.List; 4 | 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class MoviesResponse { 9 | 10 | @SerializedName("page") 11 | @Expose 12 | private int page; 13 | 14 | @SerializedName("results") 15 | @Expose 16 | private List results; 17 | 18 | @SerializedName("total_results") 19 | @Expose 20 | private int totalResults; 21 | 22 | @SerializedName("total_pages") 23 | @Expose 24 | private int totalPages; 25 | 26 | public int getPage() { 27 | return page; 28 | } 29 | 30 | public void setPage(int page) { 31 | this.page = page; 32 | } 33 | 34 | public List getResults() { 35 | return results; 36 | } 37 | 38 | public void setResults(List results) { 39 | this.results = results; 40 | } 41 | 42 | public int getTotalResults() { 43 | return totalResults; 44 | } 45 | 46 | public void setTotalResults(int totalResults) { 47 | this.totalResults = totalResults; 48 | } 49 | 50 | public int getTotalPages() { 51 | return totalPages; 52 | } 53 | 54 | public void setTotalPages(int totalPages) { 55 | this.totalPages = totalPages; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "MoviesResponse{" + 61 | "page=" + page + 62 | ", results=" + results + 63 | ", totalResults=" + totalResults + 64 | ", totalPages=" + totalPages + 65 | '}'; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/model/search/SearchMovieResponse.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.model.search; 2 | 3 | import java.util.List; 4 | 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import app.movie.tutorial.com.model.movies.MovieItem; 9 | 10 | public class SearchMovieResponse { 11 | 12 | @SerializedName("page") 13 | @Expose 14 | private Integer page; 15 | @SerializedName("total_results") 16 | @Expose 17 | private Integer totalResults; 18 | @SerializedName("total_pages") 19 | @Expose 20 | private Integer totalPages; 21 | @SerializedName("results") 22 | @Expose 23 | private List results = null; 24 | 25 | public Integer getPage() { 26 | return page; 27 | } 28 | 29 | public void setPage(Integer page) { 30 | this.page = page; 31 | } 32 | 33 | public Integer getTotalResults() { 34 | return totalResults; 35 | } 36 | 37 | public void setTotalResults(Integer totalResults) { 38 | this.totalResults = totalResults; 39 | } 40 | 41 | public Integer getTotalPages() { 42 | return totalPages; 43 | } 44 | 45 | public void setTotalPages(Integer totalPages) { 46 | this.totalPages = totalPages; 47 | } 48 | 49 | public List getResults() { 50 | return results; 51 | } 52 | 53 | public void setResults(List results) { 54 | this.results = results; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/rest/API.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.rest; 2 | 3 | import app.movie.tutorial.com.Config; 4 | import retrofit2.Retrofit; 5 | import retrofit2.converter.gson.GsonConverterFactory; 6 | 7 | public class API { 8 | private static T builder(Class endpoint) { 9 | return new Retrofit.Builder() 10 | .baseUrl(Config.API_BASE_URL) 11 | .addConverterFactory(GsonConverterFactory.create()) 12 | .build() 13 | .create(endpoint); 14 | } 15 | 16 | public static Movies movies() { 17 | return builder(Movies.class); 18 | } 19 | 20 | public static Configurations configurations() { 21 | return builder(Configurations.class); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/rest/Configurations.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.rest; 2 | 3 | import app.movie.tutorial.com.model.configuration.ConfigurationResponse; 4 | import retrofit2.Call; 5 | import retrofit2.http.GET; 6 | import retrofit2.http.Query; 7 | 8 | public interface Configurations { 9 | //CONFIGURATIONS 10 | @GET("/configuration") 11 | Call configurations(@Query("api_key") String apiKey); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/app/movie/tutorial/com/rest/Movies.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com.rest; 2 | 3 | import app.movie.tutorial.com.model.movie.MovieResponse; 4 | import app.movie.tutorial.com.model.movie.images.ImagesResponse; 5 | import app.movie.tutorial.com.model.movies.MoviesResponse; 6 | import app.movie.tutorial.com.model.search.SearchMovieResponse; 7 | import retrofit2.Call; 8 | import retrofit2.http.GET; 9 | import retrofit2.http.Path; 10 | import retrofit2.http.Query; 11 | 12 | public interface Movies { 13 | //MOVIE SEARCH AUTOCOMPLETE 14 | @GET("/search/movie") 15 | Call search(@Query("api_key") String apiKey, @Query("query") String query); 16 | 17 | //TOP RATED MOVIES 18 | @GET("movie/top_rated") 19 | Call topRated(@Query("api_key") String apiKey); 20 | 21 | //MOVIE DETAIL 22 | @GET("/3/movie/{id}") 23 | Call movieDetails(@Path("id") int movieID, @Query("api_key") String apiKey); 24 | 25 | //MOVIE IMAGES 26 | @GET("/movie/{id}/images") 27 | Call movieImages(@Query("api_key") String apiKey, @Path("id") int movieID); 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/chip.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/star.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_movie_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 22 | 23 | 32 | 33 | 40 | 41 | 47 | 48 | 49 | 50 | 57 | 58 | 65 | 66 | 71 | 72 | 73 | 83 | 84 | 94 | 95 | 99 | 100 | 101 | 109 | 110 | 111 | 123 | 124 | 134 | 135 | 147 | 148 | 149 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_genre.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 20 | 21 | 24 | 25 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | 25 | 26 | 27 | 32 | 33 | 39 | 40 | 48 | 49 | 56 | 57 | 58 | 59 | 63 | 64 | 72 | 73 | 74 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_pc.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 21 | 22 | 28 | 29 | 30 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | 50 | 51 | 63 | 64 | 65 | 76 | 77 | 78 | 79 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ginowine/android-retrofit/a70136dc7de686a1644e3bb1178defe8703c2daa/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ginowine/android-retrofit/a70136dc7de686a1644e3bb1178defe8703c2daa/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ginowine/android-retrofit/a70136dc7de686a1644e3bb1178defe8703c2daa/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ginowine/android-retrofit/a70136dc7de686a1644e3bb1178defe8703c2daa/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ginowine/android-retrofit/a70136dc7de686a1644e3bb1178defe8703c2daa/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #252525 4 | #202020 5 | #555555 6 | #FFFFFF 7 | #FFFFFF 8 | #000000 9 | #252525 10 | #202020 11 | #555555 12 | #c8f36a21 13 | #f36a21 14 | #0ecf48 15 | #21bff3 16 | #e21c0e 17 | #555555 18 | #f2f2f2 19 | #f2f2f2 20 | #525252 21 | #000000 22 | #202020 23 | #ffffff 24 | #767676 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | android-retrofit 3 | 4 | 5 | 6 | (Original title: %1$s - %2$s) 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/app/movie/tutorial/com/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package app.movie.tutorial.com; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.0.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ginowine/android-retrofit/a70136dc7de686a1644e3bb1178defe8703c2daa/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 13 01:04:05 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 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------