Skip to content

Commit 13b1171

Browse files
committed
MADE-Submission3
1 parent f96088c commit 13b1171

File tree

71 files changed

+2260
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2260
-0
lines changed

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild

.idea/codeStyles/Project.xml

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "com.example.katalogfilm"
7+
minSdkVersion 26
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
buildConfigField("String" , "TMDB_API_KEY" , '"b650046bf640e7bf7054093854b8d02a"')
13+
buildConfigField("String" , "TMDB_BASE_URL" , '"https://api.themoviedb.org/"')
14+
}
15+
buildTypes {
16+
release {
17+
minifyEnabled false
18+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
19+
}
20+
}
21+
}
22+
23+
dependencies {
24+
implementation fileTree(dir: 'libs', include: ['*.jar'])
25+
implementation 'com.android.support:appcompat-v7:28.0.0'
26+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
27+
testImplementation 'junit:junit:4.12'
28+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
29+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
30+
//retrofit
31+
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
32+
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
33+
//butterknife
34+
implementation 'com.jakewharton:butterknife:8.8.1'
35+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
36+
37+
38+
implementation 'com.google.code.gson:gson:2.8.5'
39+
implementation 'com.android.support:recyclerview-v7:28.0.0'
40+
implementation 'com.android.support:cardview-v7:28.0.0'
41+
implementation 'com.android.support:design:28.0.0'
42+
implementation 'com.github.bumptech.glide:glide:4.8.0'
43+
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
44+
implementation 'de.hdodenhof:circleimageview:2.2.0'
45+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.katalogfilm;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.assertEquals;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.example.katalogfilm", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.katalogfilm">
4+
<uses-permission android:name="android.permission.INTERNET" />
5+
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme">
13+
<activity android:name=".feature.detailmovieactivity.DetailActivity"
14+
android:configChanges="orientation|keyboardHidden"></activity>
15+
<activity android:name=".feature.mainactivity.MainActivity"
16+
android:configChanges="orientation|keyboardHidden">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
</activity>
23+
</application>
24+
25+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.example.katalogfilm.adapter;
2+
3+
import android.content.Context;
4+
import android.content.Intent;
5+
import android.support.annotation.NonNull;
6+
import android.support.v7.widget.RecyclerView;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
import android.widget.ImageView;
11+
import android.widget.TextView;
12+
13+
import com.bumptech.glide.Glide;
14+
import com.example.katalogfilm.R;
15+
import com.example.katalogfilm.data.entity.Movie;
16+
import com.example.katalogfilm.feature.detailmovieactivity.DetailActivity;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
21+
public class MovieAdapter extends RecyclerView.Adapter<MovieAdapter.ViewHolder> {
22+
23+
Context context;
24+
List<Movie> movieList;
25+
26+
public MovieAdapter(List<Movie> movieList, Context context) {
27+
this.context = context;
28+
this.movieList = movieList;
29+
}
30+
public void refill(List<Movie> items) {
31+
this.movieList = new ArrayList<>();
32+
this.movieList.addAll(items);
33+
34+
notifyDataSetChanged();
35+
}
36+
@NonNull
37+
@Override
38+
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
39+
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.movie_item, viewGroup ,false));
40+
}
41+
42+
@Override
43+
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
44+
viewHolder.BindItem(movieList.get(i), context);
45+
}
46+
47+
@Override
48+
public int getItemCount() {
49+
return movieList.size();
50+
}
51+
52+
public class ViewHolder extends RecyclerView.ViewHolder {
53+
TextView tvTitle;
54+
TextView tvOverview;
55+
ImageView imgPoster;
56+
View itemViewe;
57+
58+
public ViewHolder(@NonNull View itemView) {
59+
super(itemView);
60+
tvTitle= itemView.findViewById(R.id.tv_movie_title);
61+
imgPoster=itemView.findViewById(R.id.img_poster);
62+
tvOverview= itemView.findViewById(R.id.tv_movie_overview);
63+
itemViewe=itemView;
64+
}
65+
void BindItem(final Movie movie, final Context context) {
66+
tvTitle.setText(movie.getTitle());
67+
tvOverview.setText(movie.getOverview());
68+
Glide.with(context)
69+
.load("https://image.tmdb.org/t/p/w92" + movie.getPosterPath())
70+
.into(imgPoster);
71+
72+
itemView.setOnClickListener(new View.OnClickListener() {
73+
@Override
74+
public void onClick(View view) {
75+
Intent moveDetailMovieActivity = new Intent(context, DetailActivity.class);
76+
moveDetailMovieActivity.putExtra(DetailActivity.EXTRA_MOVIE, movie);
77+
moveDetailMovieActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
78+
context.startActivity(moveDetailMovieActivity);
79+
}
80+
});
81+
}
82+
83+
}
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.example.katalogfilm.data.api;
2+
3+
import com.example.katalogfilm.BuildConfig;
4+
5+
import retrofit2.Retrofit;
6+
import retrofit2.converter.gson.GsonConverterFactory;
7+
8+
public class ApiRetrofit {
9+
//private static final String BASE_URL = "https://api.themoviedb.org/";
10+
11+
public static RetrofitInterface getService(){
12+
return getRetrofit().create(RetrofitInterface.class);
13+
}
14+
15+
public static Retrofit.Builder builder() {
16+
return new Retrofit.Builder().baseUrl(BuildConfig.TMDB_BASE_URL)
17+
.addConverterFactory(GsonConverterFactory.create());
18+
}
19+
20+
public static Retrofit getRetrofit() {
21+
return builder().build();
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.example.katalogfilm.data.api;
2+
3+
import com.example.katalogfilm.BuildConfig;
4+
import com.example.katalogfilm.data.entity.MovieItem;
5+
import com.example.katalogfilm.data.entity.MovieResult;
6+
7+
import retrofit2.Call;
8+
import retrofit2.http.GET;
9+
import retrofit2.http.Path;
10+
import retrofit2.http.Query;
11+
12+
public interface RetrofitInterface {
13+
//String API = "fb30ef4173f7e7c8051360b4d8a58e29";
14+
@GET("3/movie/now_playing?api_key="+ BuildConfig.TMDB_API_KEY +"&page=1")
15+
Call<MovieResult> getNowPlaying();
16+
17+
@GET("3/search/movie?api_key="+BuildConfig.TMDB_API_KEY+"&language=en-US")
18+
Call<MovieResult> getSearchMovie(@Query("query") String string);
19+
20+
@GET("3/movie/{id}?api_key="+BuildConfig.TMDB_API_KEY+"&language=en-US")
21+
Call<MovieItem> getDetailMovie(@Path("id") int id);
22+
23+
@GET("3/movie/upcoming?api_key="+ BuildConfig.TMDB_API_KEY +"&page=1")
24+
Call<MovieResult> getUpcoming();
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.example.katalogfilm.data.entity;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
public class Genre {
6+
@SerializedName("id")
7+
protected int id;
8+
9+
@SerializedName("name")
10+
private String name;
11+
12+
public int getId() {
13+
return id;
14+
}
15+
16+
public void setId(int id) {
17+
this.id = id;
18+
}
19+
20+
public String getName() {
21+
return name;
22+
}
23+
24+
public void setName(String name) {
25+
this.name = name;
26+
}
27+
}

0 commit comments

Comments
 (0)