Skip to content

Commit a7721f1

Browse files
committed
Initial commit
0 parents  commit a7721f1

Some content is hidden

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

48 files changed

+1477
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches/build_file_checksums.ser
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
.DS_Store
9+
/build
10+
/captures
11+
.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

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

.idea/misc.xml

+38
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.dell.moviestage1"
7+
javaCompileOptions {
8+
annotationProcessorOptions {
9+
includeCompileClasspath true
10+
}
11+
}
12+
minSdkVersion 15
13+
targetSdkVersion 28
14+
versionCode 1
15+
versionName "1.0"
16+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17+
}
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
}
25+
repositories {
26+
27+
mavenCentral()
28+
}
29+
dependencies {
30+
implementation fileTree(dir: 'libs', include: ['*.jar'])
31+
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
32+
implementation 'com.android.support:design:28.0.0'
33+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
34+
testImplementation 'junit:junit:4.12'
35+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
36+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
37+
implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
38+
implementation 'com.android.support:cardview-v7:28.0.0-rc02'
39+
implementation 'com.jakewharton:butterknife-compiler:8.8.1'
40+
implementation 'com.jakewharton:butterknife:8.8.1'
41+
implementation 'com.squareup.picasso:picasso:2.5.2'
42+
implementation 'org.parceler:parceler-api:1.1.11'
43+
44+
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.dell.moviestage1;
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.*;
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.dell.moviestage1", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.dell.moviestage1">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:largeHeap="true"
12+
android:roundIcon="@mipmap/ic_launcher_round"
13+
android:supportsRtl="true"
14+
android:theme="@style/BarTheme">
15+
<activity android:name=".MainActivity">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
<activity android:name=".MovieDetailActivity" />
23+
<activity android:name=".SettingsActivity"></activity>
24+
</application>
25+
26+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package com.example.dell.moviestage1;
2+
3+
import android.content.Context;
4+
import android.net.Uri;
5+
import android.support.annotation.NonNull;
6+
import android.support.annotation.Nullable;
7+
import android.support.v4.app.LoaderManager;
8+
import android.support.v4.content.Loader;
9+
import android.support.v7.app.AppCompatActivity;
10+
import android.os.Bundle;
11+
import android.support.v7.widget.GridLayoutManager;
12+
import android.support.v7.widget.LinearLayoutManager;
13+
import android.support.v7.widget.RecyclerView;
14+
import android.view.Menu;
15+
import android.view.MenuItem;
16+
import android.view.View;
17+
import android.widget.AdapterView;
18+
import android.widget.ArrayAdapter;
19+
import android.widget.ImageView;
20+
import android.widget.Spinner;
21+
import android.widget.TextView;
22+
import android.support.v7.widget.Toolbar;
23+
24+
import com.squareup.picasso.Picasso;
25+
26+
import java.util.ArrayList;
27+
28+
import butterknife.BindView;
29+
30+
public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<ArrayList<Movie>> {
31+
32+
String api_key = "";
33+
34+
String REQUEST_URL = "https://api.themoviedb.org/3/discover/movie?api_key="+api_key+"&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1";
35+
36+
37+
RecyclerView recyclerView;
38+
MovieAdapter adapter;
39+
Context context;
40+
Toolbar toolbar;
41+
Spinner spinner;
42+
43+
private static final int SECTION_LOADER_ID = 1;
44+
private TextView mEmptyStateTextView;
45+
View loadingIndicator;
46+
@BindView(R.id.imageView) ImageView poster;
47+
48+
@Override
49+
protected void onCreate(Bundle savedInstanceState) {
50+
super.onCreate(savedInstanceState);
51+
setContentView(R.layout.activity_main);
52+
context = getApplicationContext();
53+
54+
recyclerView = findViewById(R.id.recyclerView);
55+
toolbar = findViewById(R.id.toolbarView);
56+
57+
setSupportActionBar(toolbar);
58+
59+
60+
61+
LoaderManager loaderManager = LoaderManager.getInstance(this);
62+
loaderManager.initLoader(SECTION_LOADER_ID, null, this);
63+
64+
65+
66+
67+
}
68+
69+
@NonNull
70+
@Override
71+
public Loader<ArrayList<Movie>> onCreateLoader(int i, @Nullable Bundle bundle) {
72+
73+
return new SectionLoader(context, REQUEST_URL);
74+
}
75+
76+
@Override
77+
public void onLoadFinished(@NonNull Loader<ArrayList<Movie>> loader, ArrayList<Movie> movieArrayList) {
78+
79+
adapter = new MovieAdapter(context, movieArrayList);
80+
recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
81+
recyclerView.setAdapter(adapter);
82+
83+
}
84+
85+
@Override
86+
public void onLoaderReset(@NonNull Loader<ArrayList<Movie>> loader) {
87+
88+
}
89+
90+
@Override
91+
public boolean onCreateOptionsMenu(Menu menu) {
92+
getMenuInflater().inflate(R.menu.main, menu);
93+
return true;
94+
}
95+
96+
@Override
97+
public boolean onOptionsItemSelected(MenuItem item) {
98+
switch (item.getItemId()){
99+
case R.id.popular:
100+
showPopular();
101+
return true;
102+
case R.id.rated:
103+
showRated();
104+
return true;
105+
default:
106+
}
107+
108+
109+
return super.onOptionsItemSelected(item);
110+
}
111+
112+
private void showRated() {
113+
}
114+
115+
private void showPopular() {
116+
117+
118+
}
119+
}

0 commit comments

Comments
 (0)