├── %3Ca%20href='test.html'%3E ├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ivb │ │ └── udacity │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── ivb │ │ │ └── udacity │ │ │ ├── adapter │ │ │ ├── movieGeneralAdapter.java │ │ │ └── movieGeneralHolder.java │ │ │ ├── constants │ │ │ └── constant.java │ │ │ ├── database │ │ │ └── favouritesSqliteHelper.java │ │ │ ├── modal │ │ │ ├── Results.java │ │ │ ├── movieGeneral.java │ │ │ ├── movieGeneralModal.java │ │ │ ├── review │ │ │ │ ├── Results.java │ │ │ │ └── movieReview.java │ │ │ └── trailer │ │ │ │ ├── Results.java │ │ │ │ └── movieYoutubeModal.java │ │ │ ├── movieDetailActivity.java │ │ │ ├── movieDetailFragment.java │ │ │ ├── movieListActivity.java │ │ │ └── network │ │ │ ├── MovieAPI.java │ │ │ └── NetworkAPI.java │ └── res │ │ ├── drawable │ │ ├── calendar.png │ │ ├── groups.png │ │ ├── ic_action.png │ │ ├── ic_launcher.png │ │ ├── menu_main.png │ │ ├── mqdefault.jpg │ │ └── review.png │ │ ├── layout-w900dp │ │ └── movie_list.xml │ │ ├── layout │ │ ├── activity_movie_detail.xml │ │ ├── activity_movie_list.xml │ │ ├── movie_cards.xml │ │ ├── movie_detail.xml │ │ └── movie_list.xml │ │ ├── menu │ │ ├── detail.xml │ │ └── main.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-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── ivb │ └── udacity │ └── .html ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /%3Ca%20href='test.html'%3E: -------------------------------------------------------------------------------- 1 | test 2 | jkdfbajkbsdv 3 | advjksbadv 4 | asdkvbkjsdbv 5 | sdbvjbsjdvb 6 | sdvjbsjdbvjkdsv 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | My PortFolio App -------------------------------------------------------------------------------- /.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 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # android Udacity 2 | My leanings with Android Udacity 3 | ##Project 2 : The Movie App 4 | Add the ACCESS TOKEN of the MovieDBAPI to FILE : com.ivb.udacity.constants.constant.java LINE NUMBER : 7 - ACCESS_TOKEN variable 5 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '23.0.2' 6 | 7 | defaultConfig { 8 | applicationId "com.ivb.udacity" 9 | minSdkVersion 16 10 | targetSdkVersion 22 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 | compile 'com.android.support:appcompat-v7:23.0.1' 25 | compile 'com.squareup.picasso:picasso:2.5.2' 26 | compile 'com.android.support:design:23.0.1' 27 | compile 'com.android.support:recyclerview-v7:23.0.1' 28 | compile 'com.android.support:cardview-v7:23.0.1' 29 | compile 'com.squareup.retrofit:retrofit:1.9.0' 30 | compile 'com.squareup.okhttp:okhttp:2.2.0' 31 | compile 'com.android.support:support-v4:23.0.1' 32 | } 33 | -------------------------------------------------------------------------------- /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 F:\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/com/ivb/udacity/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity; 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 | 13 | 14 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/adapter/movieGeneralAdapter.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.ivb.udacity.R; 12 | import com.ivb.udacity.modal.movieGeneralModal; 13 | import com.ivb.udacity.movieDetailActivity; 14 | import com.ivb.udacity.movieDetailFragment; 15 | import com.squareup.picasso.Picasso; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 21 | */ 22 | public class movieGeneralAdapter extends RecyclerView.Adapter { 23 | private List mMovieGeneralModal; 24 | private Context context; 25 | private boolean mTwoPane; 26 | private FragmentManager fm; 27 | 28 | public movieGeneralAdapter(Context context, List itemList, boolean mTwoPane, FragmentManager fm) { 29 | this.mMovieGeneralModal = itemList; 30 | this.context = context; 31 | this.mTwoPane = mTwoPane; 32 | this.fm = fm; 33 | } 34 | 35 | @Override 36 | public movieGeneralHolder onCreateViewHolder(ViewGroup parent, int viewType) { 37 | View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.movie_cards, null); 38 | movieGeneralHolder rcv = new movieGeneralHolder(layoutView); 39 | return rcv; 40 | } 41 | 42 | @Override 43 | public void onBindViewHolder(movieGeneralHolder holder, final int position) { 44 | holder.movieName.setText(mMovieGeneralModal.get(position).getTitle()); 45 | holder.movieAvg.setText(mMovieGeneralModal.get(position).getmVote()); 46 | //picasso loading here 47 | Picasso.with(context) 48 | .load(mMovieGeneralModal.get(position).getThumbnail()) 49 | .into(holder.moviePhoto); 50 | if (position == 0 && mTwoPane) { 51 | movieDetailFragment fragment = new movieDetailFragment(); 52 | fragment.setMovieData(mMovieGeneralModal.get(0)); 53 | fragment.setArgument(fm); 54 | fm 55 | .beginTransaction() 56 | .replace(R.id.movie_detail_container, fragment) 57 | .commit(); 58 | } 59 | holder.mView.setOnClickListener(new View.OnClickListener() { 60 | @Override 61 | public void onClick(View v) { 62 | if (mTwoPane) { 63 | movieDetailFragment fragment = new movieDetailFragment(); 64 | fragment.setMovieData(mMovieGeneralModal.get(position)); 65 | fragment.setArgument(fm); 66 | fm 67 | .beginTransaction() 68 | .replace(R.id.movie_detail_container, fragment) 69 | .commit(); 70 | } else { 71 | Context context = v.getContext(); 72 | Intent intent = new Intent(context, movieDetailActivity.class); 73 | intent.putExtra("DATA_MOVIE", mMovieGeneralModal.get(position)); 74 | context.startActivity(intent); 75 | } 76 | } 77 | }); 78 | } 79 | 80 | @Override 81 | public int getItemCount() { 82 | return this.mMovieGeneralModal.size(); 83 | } 84 | } 85 | 86 | 87 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/adapter/movieGeneralHolder.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.adapter; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | import android.widget.ImageView; 6 | import android.widget.TextView; 7 | import android.widget.Toast; 8 | 9 | import com.ivb.udacity.R; 10 | 11 | /** 12 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 13 | */ 14 | public class movieGeneralHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 15 | 16 | public TextView movieName, movieAvg; 17 | public ImageView moviePhoto; 18 | public View mView; 19 | 20 | public movieGeneralHolder(View itemView) { 21 | super(itemView); 22 | itemView.setOnClickListener(this); 23 | mView = itemView; 24 | movieName = (TextView) itemView.findViewById(R.id.movieName); 25 | movieAvg = (TextView) itemView.findViewById(R.id.vote); 26 | moviePhoto = (ImageView) itemView.findViewById(R.id.moviePhoto); 27 | } 28 | 29 | @Override 30 | public void onClick(View view) { 31 | Toast.makeText(view.getContext(), "Clicked Country Position = " + getPosition(), Toast.LENGTH_SHORT).show(); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/constants/constant.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.constants; 2 | 3 | /** 4 | * Created by S.Shivasurya on 1/10/2016 - androidStudio. 5 | */ 6 | public class constant { 7 | public final static String ACCESS_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/database/favouritesSqliteHelper.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.database; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Context; 5 | import android.database.Cursor; 6 | import android.database.sqlite.SQLiteDatabase; 7 | import android.database.sqlite.SQLiteOpenHelper; 8 | 9 | import com.ivb.udacity.modal.movieGeneralModal; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * Created by S.Shivasurya on 1/11/2016 - androidStudio. 16 | */ 17 | public class favouritesSqliteHelper extends SQLiteOpenHelper { 18 | public static final String KEY_ROWID = "id"; 19 | public static final String KEY_THUMBNAIL = "mThumbnail"; 20 | public static final String KEY_MVOTE = "mVote"; 21 | public static final String KEY_TITLE = "mTitle"; 22 | public static final String KEY_PEOPLE = "mPeople"; 23 | public static final String KEY_RELEASEDATE = "mReleaseDate"; 24 | public static final String KEY_OVERVIEW = "mOverview"; 25 | public static final String KEY_REVIEW = "mReview"; 26 | public static final String SQLITE_TABLE = "movies"; 27 | private static final String LOG_TAG = "moviesDB"; 28 | private static final String DATABASE_CREATE = 29 | "CREATE TABLE if not exists " + SQLITE_TABLE + " (" + 30 | KEY_ROWID + " integer PRIMARY KEY," + 31 | KEY_THUMBNAIL + "," + 32 | KEY_TITLE + "," + 33 | KEY_PEOPLE + "," + 34 | KEY_MVOTE + "," + 35 | KEY_OVERVIEW + "," + 36 | KEY_REVIEW + "," + 37 | KEY_RELEASEDATE + "" + 38 | " );"; 39 | 40 | public favouritesSqliteHelper(Context context) { 41 | super(context, LOG_TAG, null, 1); 42 | } 43 | 44 | 45 | @Override 46 | public void onCreate(SQLiteDatabase db) { 47 | db.execSQL(DATABASE_CREATE); 48 | } 49 | 50 | @Override 51 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 52 | db.execSQL("DROP TABLE IF EXISTS " + SQLITE_TABLE); 53 | onCreate(db); 54 | } 55 | 56 | public boolean insertMovie(movieGeneralModal movieGeneralModals) { 57 | SQLiteDatabase db = this.getWritableDatabase(); 58 | ContentValues values = new ContentValues(); 59 | values.put(KEY_ROWID, Integer.parseInt(movieGeneralModals.getmId())); 60 | values.put(KEY_THUMBNAIL, movieGeneralModals.getThumbnail()); 61 | values.put(KEY_TITLE, movieGeneralModals.getTitle()); 62 | values.put(KEY_PEOPLE, movieGeneralModals.getmPeople()); 63 | values.put(KEY_MVOTE, movieGeneralModals.getmVote()); 64 | values.put(KEY_OVERVIEW, movieGeneralModals.getmOverview()); 65 | values.put(KEY_RELEASEDATE, movieGeneralModals.getmReleaseDate()); 66 | values.put(KEY_REVIEW, movieGeneralModals.getmReview()); 67 | 68 | boolean createSuccessful = db.insert(SQLITE_TABLE, null, values) > 0; 69 | db.close(); 70 | return createSuccessful; 71 | } 72 | 73 | public List getAllMovies() { 74 | List movieList = new ArrayList<>(); 75 | String selectQuery = "SELECT * FROM " + SQLITE_TABLE; 76 | 77 | SQLiteDatabase db = this.getReadableDatabase(); 78 | Cursor cursor = db.rawQuery(selectQuery, null); 79 | 80 | if (cursor.moveToFirst()) { 81 | do { 82 | movieGeneralModal movie = new movieGeneralModal(cursor.getString(2), cursor.getString(1), cursor.getString(4), cursor.getString(0), cursor.getString(3), cursor.getString(7), cursor.getString(5)); 83 | movieList.add(movie); 84 | } while (cursor.moveToNext()); 85 | } 86 | cursor.close(); 87 | 88 | return movieList; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/Results.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 7 | */ 8 | public class Results implements Serializable { 9 | private String vote_average; 10 | 11 | private String backdrop_path; 12 | 13 | private String adult; 14 | 15 | private String id; 16 | 17 | private String title; 18 | 19 | private String overview; 20 | 21 | private String original_language; 22 | 23 | private String[] genre_ids; 24 | 25 | private String release_date; 26 | 27 | private String original_title; 28 | 29 | private String vote_count; 30 | 31 | private String poster_path; 32 | 33 | private String video; 34 | 35 | private String popularity; 36 | 37 | public String getVote_average() { 38 | return vote_average; 39 | } 40 | 41 | public void setVote_average(String vote_average) { 42 | this.vote_average = vote_average; 43 | } 44 | 45 | public String getBackdrop_path() { 46 | return backdrop_path; 47 | } 48 | 49 | public void setBackdrop_path(String backdrop_path) { 50 | this.backdrop_path = backdrop_path; 51 | } 52 | 53 | public String getAdult() { 54 | return adult; 55 | } 56 | 57 | public void setAdult(String adult) { 58 | this.adult = adult; 59 | } 60 | 61 | public String getId() { 62 | return id; 63 | } 64 | 65 | public void setId(String id) { 66 | this.id = id; 67 | } 68 | 69 | public String getTitle() { 70 | return title; 71 | } 72 | 73 | public void setTitle(String title) { 74 | this.title = title; 75 | } 76 | 77 | public String getOverview() { 78 | return overview; 79 | } 80 | 81 | public void setOverview(String overview) { 82 | this.overview = overview; 83 | } 84 | 85 | public String getOriginal_language() { 86 | return original_language; 87 | } 88 | 89 | public void setOriginal_language(String original_language) { 90 | this.original_language = original_language; 91 | } 92 | 93 | public String[] getGenre_ids() { 94 | return genre_ids; 95 | } 96 | 97 | public void setGenre_ids(String[] genre_ids) { 98 | this.genre_ids = genre_ids; 99 | } 100 | 101 | public String getRelease_date() { 102 | return release_date; 103 | } 104 | 105 | public void setRelease_date(String release_date) { 106 | this.release_date = release_date; 107 | } 108 | 109 | public String getOriginal_title() { 110 | return original_title; 111 | } 112 | 113 | public void setOriginal_title(String original_title) { 114 | this.original_title = original_title; 115 | } 116 | 117 | public String getVote_count() { 118 | return vote_count; 119 | } 120 | 121 | public void setVote_count(String vote_count) { 122 | this.vote_count = vote_count; 123 | } 124 | 125 | public String getPoster_path() { 126 | return poster_path; 127 | } 128 | 129 | public void setPoster_path(String poster_path) { 130 | this.poster_path = poster_path; 131 | } 132 | 133 | public String getVideo() { 134 | return video; 135 | } 136 | 137 | public void setVideo(String video) { 138 | this.video = video; 139 | } 140 | 141 | public String getPopularity() { 142 | return popularity; 143 | } 144 | 145 | public void setPopularity(String popularity) { 146 | this.popularity = popularity; 147 | } 148 | 149 | @Override 150 | public String toString() { 151 | return "ClassPojo [vote_average = " + vote_average + ", backdrop_path = " + backdrop_path + ", adult = " + adult + ", id = " + id + ", title = " + title + ", overview = " + overview + ", original_language = " + original_language + ", genre_ids = " + genre_ids + ", release_date = " + release_date + ", original_title = " + original_title + ", vote_count = " + vote_count + ", poster_path = " + poster_path + ", video = " + video + ", popularity = " + popularity + "]"; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/movieGeneral.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 7 | */ 8 | public class movieGeneral implements Serializable { 9 | private Results[] results; 10 | 11 | private String page; 12 | 13 | private String total_pages; 14 | 15 | private String total_results; 16 | 17 | public Results[] getResults() { 18 | return results; 19 | } 20 | 21 | public void setResults(Results[] results) { 22 | this.results = results; 23 | } 24 | 25 | public String getPage() { 26 | return page; 27 | } 28 | 29 | public void setPage(String page) { 30 | this.page = page; 31 | } 32 | 33 | public String getTotal_pages() { 34 | return total_pages; 35 | } 36 | 37 | public void setTotal_pages(String total_pages) { 38 | this.total_pages = total_pages; 39 | } 40 | 41 | public String getTotal_results() { 42 | return total_results; 43 | } 44 | 45 | public void setTotal_results(String total_results) { 46 | this.total_results = total_results; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "ClassPojo [results = " + results + ", page = " + page + ", total_pages = " + total_pages + ", total_results = " + total_results + "]"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/movieGeneralModal.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 7 | */ 8 | public class movieGeneralModal implements Serializable { 9 | String mTitle; 10 | String mThumbnail; 11 | String mVote; 12 | String mId; 13 | String mPeople; 14 | String mReleaseDate; 15 | String mOverview; 16 | String mReview; 17 | 18 | public movieGeneralModal(String mTitle, String mThumbnail, String mVote, String mId, String mPeople, String mReleaseDate, String mOverview) { 19 | this.mThumbnail = mThumbnail; 20 | this.mTitle = mTitle; 21 | this.mVote = mVote; 22 | this.mId = mId; 23 | this.mPeople = mPeople; 24 | this.mReleaseDate = mReleaseDate; 25 | this.mOverview = mOverview; 26 | } 27 | 28 | public String getmReview() { 29 | return this.mReview; 30 | } 31 | 32 | public void setmReview(String mReview) { 33 | this.mReview = mReview; 34 | } 35 | 36 | public String getmOverview() { 37 | return this.mOverview; 38 | } 39 | 40 | public String getmReleaseDate() { 41 | return this.mReleaseDate; 42 | } 43 | 44 | public String getTitle() { 45 | return this.mTitle; 46 | } 47 | 48 | public String getThumbnail() { 49 | String url = "http://image.tmdb.org/t/p/w185/" + this.mThumbnail; 50 | return url; 51 | } 52 | 53 | public String getmId() { 54 | return this.mId; 55 | } 56 | 57 | public String getmPeople() { 58 | return this.mPeople; 59 | } 60 | public String getmVote() { 61 | return this.mVote; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/review/Results.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal.review; 2 | 3 | /** 4 | * Created by S.Shivasurya on 1/8/2016 - androidStudio. 5 | */ 6 | public class Results { 7 | private String content; 8 | 9 | private String id; 10 | 11 | private String author; 12 | 13 | private String url; 14 | 15 | public String getContent() { 16 | return content; 17 | } 18 | 19 | public void setContent(String content) { 20 | this.content = content; 21 | } 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public String getAuthor() { 32 | return author; 33 | } 34 | 35 | public void setAuthor(String author) { 36 | this.author = author; 37 | } 38 | 39 | public String getUrl() { 40 | return url; 41 | } 42 | 43 | public void setUrl(String url) { 44 | this.url = url; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "ClassPojo [content = " + content + ", id = " + id + ", author = " + author + ", url = " + url + "]"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/review/movieReview.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal.review; 2 | 3 | /** 4 | * Created by S.Shivasurya on 1/8/2016 - androidStudio. 5 | */ 6 | public class movieReview { 7 | private String id; 8 | 9 | private Results[] results; 10 | 11 | private String page; 12 | 13 | private String total_pages; 14 | 15 | private String total_results; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public Results[] getResults() { 26 | return results; 27 | } 28 | 29 | public void setResults(Results[] results) { 30 | this.results = results; 31 | } 32 | 33 | public String getPage() { 34 | return page; 35 | } 36 | 37 | public void setPage(String page) { 38 | this.page = page; 39 | } 40 | 41 | public String getTotal_pages() { 42 | return total_pages; 43 | } 44 | 45 | public void setTotal_pages(String total_pages) { 46 | this.total_pages = total_pages; 47 | } 48 | 49 | public String getTotal_results() { 50 | return total_results; 51 | } 52 | 53 | public void setTotal_results(String total_results) { 54 | this.total_results = total_results; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return "ClassPojo [id = " + id + ", results = " + results + ", page = " + page + ", total_pages = " + total_pages + ", total_results = " + total_results + "]"; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/trailer/Results.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal.trailer; 2 | 3 | /** 4 | * Created by S.Shivasurya on 1/10/2016 - androidStudio. 5 | */ 6 | public class Results { 7 | private String site; 8 | 9 | private String id; 10 | 11 | private String iso_639_1; 12 | 13 | private String name; 14 | 15 | private String type; 16 | 17 | private String key; 18 | 19 | private String size; 20 | 21 | public String getSite() { 22 | return site; 23 | } 24 | 25 | public void setSite(String site) { 26 | this.site = site; 27 | } 28 | 29 | public String getId() { 30 | return id; 31 | } 32 | 33 | public void setId(String id) { 34 | this.id = id; 35 | } 36 | 37 | public String getIso_639_1() { 38 | return iso_639_1; 39 | } 40 | 41 | public void setIso_639_1(String iso_639_1) { 42 | this.iso_639_1 = iso_639_1; 43 | } 44 | 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | 53 | public String getType() { 54 | return type; 55 | } 56 | 57 | public void setType(String type) { 58 | this.type = type; 59 | } 60 | 61 | public String getKey() { 62 | return key; 63 | } 64 | 65 | public void setKey(String key) { 66 | this.key = key; 67 | } 68 | 69 | public String getSize() { 70 | return size; 71 | } 72 | 73 | public void setSize(String size) { 74 | this.size = size; 75 | } 76 | 77 | @Override 78 | public String toString() { 79 | return "ClassPojo [site = " + site + ", id = " + id + ", iso_639_1 = " + iso_639_1 + ", name = " + name + ", type = " + type + ", key = " + key + ", size = " + size + "]"; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/modal/trailer/movieYoutubeModal.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.modal.trailer; 2 | 3 | /** 4 | * Created by S.Shivasurya on 1/10/2016 - androidStudio. 5 | */ 6 | public class movieYoutubeModal { 7 | 8 | private String id; 9 | 10 | private Results[] results; 11 | 12 | public String getId() { 13 | return id; 14 | } 15 | 16 | public void setId(String id) { 17 | this.id = id; 18 | } 19 | 20 | public Results[] getResults() { 21 | return results; 22 | } 23 | 24 | public void setResults(Results[] results) { 25 | this.results = results; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "ClassPojo [id = " + id + ", results = " + results + "]"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/movieDetailActivity.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.MenuItem; 7 | 8 | import com.ivb.udacity.modal.movieGeneralModal; 9 | 10 | /** 11 | * An activity representing a single movie detail screen. This 12 | * activity is only used narrow width devices. On tablet-size devices, 13 | * item details are presented side-by-side with a list of items 14 | * in a {@link movieListActivity}. 15 | */ 16 | public class movieDetailActivity extends AppCompatActivity { 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_movie_detail); 22 | Intent intent = getIntent(); 23 | 24 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 25 | getSupportActionBar().setDisplayShowHomeEnabled(true); 26 | 27 | movieGeneralModal moviegeneralModal = (movieGeneralModal) intent.getSerializableExtra("DATA_MOVIE"); 28 | 29 | if (savedInstanceState == null) { 30 | 31 | movieDetailFragment fragment = new movieDetailFragment(); 32 | fragment.setMovieData(moviegeneralModal); 33 | getSupportFragmentManager().beginTransaction() 34 | .add(R.id.movie_detail_container, fragment) 35 | .commit(); 36 | } 37 | } 38 | 39 | 40 | @Override 41 | public void onBackPressed() { 42 | super.onBackPressed(); 43 | } 44 | 45 | @Override 46 | public boolean onOptionsItemSelected(MenuItem item) { 47 | int id = item.getItemId(); 48 | if (id == android.R.id.home) { 49 | onBackPressed(); 50 | return true; 51 | } 52 | return super.onOptionsItemSelected(item); 53 | } 54 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/movieDetailFragment.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity; 2 | 3 | import android.content.ActivityNotFoundException; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | import android.os.Bundle; 7 | import android.support.annotation.Nullable; 8 | import android.support.design.widget.FloatingActionButton; 9 | import android.support.v4.app.Fragment; 10 | import android.support.v4.app.FragmentManager; 11 | import android.util.Log; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | import android.widget.ImageView; 16 | import android.widget.LinearLayout; 17 | import android.widget.TextView; 18 | import android.widget.Toast; 19 | 20 | import com.ivb.udacity.constants.constant; 21 | import com.ivb.udacity.database.favouritesSqliteHelper; 22 | import com.ivb.udacity.modal.movieGeneralModal; 23 | import com.ivb.udacity.modal.review.Results; 24 | import com.ivb.udacity.modal.review.movieReview; 25 | import com.ivb.udacity.modal.trailer.movieYoutubeModal; 26 | import com.ivb.udacity.network.MovieAPI; 27 | import com.ivb.udacity.network.NetworkAPI; 28 | import com.squareup.picasso.Picasso; 29 | 30 | import retrofit.Callback; 31 | import retrofit.RetrofitError; 32 | import retrofit.client.Response; 33 | 34 | /** 35 | * A fragment representing a single movie detail screen. 36 | * This fragment is either contained in a {@link movieListActivity} 37 | * in two-pane mode (on tablets) or a {@link movieDetailActivity} 38 | * on handsets. 39 | */ 40 | public class movieDetailFragment extends Fragment { 41 | 42 | private FragmentManager fm; 43 | private movieGeneralModal moviegeneralModal; 44 | private TextView reviewText, titleText, voteText, peoplesText, calendarText, plotSynopsis; 45 | private ImageView titleImage; 46 | private LinearLayout youtubeViewHolder; 47 | private TextView shareYoutube; 48 | private String shareYoutubeID; 49 | private FloatingActionButton fab; 50 | 51 | public movieDetailFragment() { 52 | 53 | } 54 | 55 | public void setArgument(FragmentManager fm) { 56 | this.fm = fm; 57 | } 58 | 59 | @Override 60 | public void onCreate(Bundle savedInstanceState) { 61 | super.onCreate(savedInstanceState); 62 | setHasOptionsMenu(true); 63 | } 64 | 65 | @Override 66 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 67 | Bundle savedInstanceState) { 68 | View rootView = inflater.inflate(R.layout.movie_detail, container, false); 69 | if (savedInstanceState != null) { 70 | this.moviegeneralModal = (movieGeneralModal) savedInstanceState.getSerializable("DATA"); 71 | } 72 | updateGeneralUI(rootView); 73 | return rootView; 74 | } 75 | 76 | @Override 77 | public void onSaveInstanceState(Bundle outState) { 78 | super.onSaveInstanceState(outState); 79 | outState.putSerializable("DATA", moviegeneralModal); 80 | } 81 | @Override 82 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 83 | super.onActivityCreated(savedInstanceState); 84 | } 85 | 86 | public void setMovieData(movieGeneralModal moviegeneralModal) { 87 | this.moviegeneralModal = moviegeneralModal; 88 | } 89 | 90 | private void updateGeneralUI(View v) { 91 | titleText = (TextView) v.findViewById(R.id.titleText); 92 | voteText = (TextView) v.findViewById(R.id.rating); 93 | calendarText = (TextView) v.findViewById(R.id.calendar); 94 | peoplesText = (TextView) v.findViewById(R.id.people); 95 | titleImage = (ImageView) v.findViewById(R.id.titleimg); 96 | plotSynopsis = (TextView) v.findViewById(R.id.plotsynopsis); 97 | reviewText = (TextView) v.findViewById(R.id.reviewText); 98 | youtubeViewHolder = (LinearLayout) v.findViewById(R.id.youtubelayout); 99 | shareYoutube = (TextView) v.findViewById(R.id.youtubesharer); 100 | fab = (FloatingActionButton) v.findViewById(R.id.fab); 101 | 102 | titleText.setText(moviegeneralModal.getTitle()); 103 | voteText.setText(moviegeneralModal.getmVote()); 104 | peoplesText.setText(moviegeneralModal.getmPeople()); 105 | calendarText.setText(moviegeneralModal.getmReleaseDate()); 106 | plotSynopsis.setText(moviegeneralModal.getmOverview()); 107 | getMovieReview(reviewText); 108 | Picasso.with(getContext()) 109 | .load(moviegeneralModal.getThumbnail()) 110 | .into(titleImage); 111 | getMovieReview(reviewText); 112 | getTrailer(youtubeViewHolder); 113 | shareYoutube.setOnClickListener(new View.OnClickListener() { 114 | @Override 115 | public void onClick(View v) { 116 | if (shareYoutubeID != null) { 117 | shareYoutubeIntent(shareYoutubeID); 118 | } else { 119 | Toast.makeText(getContext(), "No Youtube Videos Available! Sorry", Toast.LENGTH_LONG).show(); 120 | } 121 | } 122 | }); 123 | fab.setOnClickListener(new View.OnClickListener() { 124 | @Override 125 | public void onClick(View v) { 126 | saveToDatabase(); 127 | } 128 | }); 129 | } 130 | 131 | protected void saveToDatabase() { 132 | favouritesSqliteHelper db = new favouritesSqliteHelper(getContext()); 133 | if (!reviewText.getText().toString().contains("Sorry")) { 134 | moviegeneralModal.setmReview(reviewText.getText().toString()); 135 | } 136 | boolean b = db.insertMovie(moviegeneralModal); 137 | if (b) 138 | Toast.makeText(getContext(), "Added to Favourites", Toast.LENGTH_LONG).show(); 139 | else 140 | Toast.makeText(getContext(), "Seems Already in Favourites!", Toast.LENGTH_LONG).show(); 141 | } 142 | protected void shareYoutubeIntent(String shareYoutubeID) { 143 | String url = "http://www.youtube.com/watch?v" + shareYoutubeID; 144 | String shareMsg = "hey,there new film named " + moviegeneralModal.getTitle() + " has been released and here is the Trailer link,Have a look at it " + url; 145 | Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 146 | sharingIntent.setType("text/plain"); 147 | sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Movies Now - Android App"); 148 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMsg); 149 | startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using))); 150 | } 151 | 152 | protected String generateYoutubeThumbnailURL(String id) { 153 | String url = "http://img.youtube.com/vi/" + id + "/mqdefault.jpg"; 154 | return url; 155 | } 156 | 157 | public void watchYoutubeVideo(String id) { 158 | try { 159 | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id)); 160 | startActivity(intent); 161 | } catch (ActivityNotFoundException ex) { 162 | Intent intent = new Intent(Intent.ACTION_VIEW, 163 | Uri.parse("http://www.youtube.com/watch?v=" + id)); 164 | startActivity(intent); 165 | } 166 | } 167 | 168 | protected void getTrailer(final LinearLayout youtubeViewHolder) { 169 | MovieAPI mMovieAPI = NetworkAPI.createService(MovieAPI.class); 170 | mMovieAPI.fetchVideos(constant.ACCESS_TOKEN, this.moviegeneralModal.getmId(), new Callback() { 171 | 172 | @Override 173 | public void success(movieYoutubeModal movieYoutubeModal, Response response) { 174 | youtubeViewHolder.setPadding(5, 10, 5, 0); 175 | com.ivb.udacity.modal.trailer.Results[] trailer = movieYoutubeModal.getResults(); 176 | if (trailer.length > 0) { 177 | shareYoutubeID = trailer[0].getKey(); 178 | for (final com.ivb.udacity.modal.trailer.Results obj : trailer) { 179 | String url = generateYoutubeThumbnailURL(obj.getKey()); 180 | ImageView myImage = new ImageView(getContext()); 181 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( 182 | 180, 183 | LinearLayout.LayoutParams.WRAP_CONTENT 184 | ); 185 | params.leftMargin = 3; 186 | params.rightMargin = 3; 187 | params.topMargin = 6; 188 | params.bottomMargin = 3; 189 | myImage.setLayoutParams(params); 190 | Picasso.with(getContext()) 191 | .load(url) 192 | .into(myImage); 193 | youtubeViewHolder.addView(myImage); 194 | myImage.setOnClickListener(new View.OnClickListener() { 195 | @Override 196 | public void onClick(View v) { 197 | watchYoutubeVideo(obj.getKey()); 198 | } 199 | }); 200 | 201 | } 202 | 203 | } else { 204 | youtubeViewHolder.setPadding(50, 50, 50, 50); 205 | TextView errmsg = new TextView(getContext()); 206 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( 207 | LinearLayout.LayoutParams.WRAP_CONTENT, 208 | 30 209 | ); 210 | errmsg.setLayoutParams(params); 211 | errmsg.setText("That's Bad Luck,No Trailers Found!Check later"); 212 | youtubeViewHolder.addView(errmsg); 213 | } 214 | } 215 | 216 | @Override 217 | public void failure(RetrofitError error) { 218 | youtubeViewHolder.setPadding(50, 50, 50, 50); 219 | TextView errmsg = new TextView(getContext()); 220 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( 221 | LinearLayout.LayoutParams.WRAP_CONTENT, 222 | 30 223 | ); 224 | errmsg.setLayoutParams(params); 225 | errmsg.setText("Network Error! You can't view Trailers Rite Now"); 226 | youtubeViewHolder.addView(errmsg); 227 | 228 | } 229 | }); 230 | } 231 | 232 | protected void getMovieReview(final View review) { 233 | MovieAPI mMovieAPI = NetworkAPI.createService(MovieAPI.class); 234 | mMovieAPI.fetchReview(constant.ACCESS_TOKEN, this.moviegeneralModal.getmId(), new Callback() { 235 | 236 | @Override 237 | public void success(movieReview movieReview, Response response) { 238 | Results[] movieResult = movieReview.getResults(); 239 | if (movieResult.length > 0) 240 | ((TextView) review).setText(movieResult[0].getContent()); 241 | else 242 | ((TextView) review).setText("Sorry No Review is Available Till Now!"); 243 | 244 | } 245 | 246 | @Override 247 | public void failure(RetrofitError error) { 248 | Log.d("error", error.toString()); 249 | ((TextView) review).setText("Sorry! Check Back Latter! Network Error!"); 250 | } 251 | }); 252 | } 253 | 254 | protected void generateThumbnail() { 255 | 256 | } 257 | @Override 258 | public void onDestroy() { 259 | super.onDestroy(); 260 | } 261 | 262 | @Override 263 | public void onPause() { 264 | super.onPause(); 265 | } 266 | } -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/movieListActivity.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity; 2 | 3 | import android.content.DialogInterface; 4 | import android.content.res.Configuration; 5 | import android.os.Bundle; 6 | import android.support.annotation.NonNull; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v7.app.AlertDialog; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.support.v7.widget.GridLayoutManager; 11 | import android.support.v7.widget.RecyclerView; 12 | import android.util.DisplayMetrics; 13 | import android.view.Menu; 14 | import android.view.MenuInflater; 15 | import android.view.MenuItem; 16 | import android.view.View; 17 | import android.widget.ImageView; 18 | import android.widget.TextView; 19 | import android.widget.Toast; 20 | 21 | import com.ivb.udacity.adapter.movieGeneralAdapter; 22 | import com.ivb.udacity.constants.constant; 23 | import com.ivb.udacity.database.favouritesSqliteHelper; 24 | import com.ivb.udacity.modal.Results; 25 | import com.ivb.udacity.modal.movieGeneral; 26 | import com.ivb.udacity.modal.movieGeneralModal; 27 | import com.ivb.udacity.network.MovieAPI; 28 | import com.ivb.udacity.network.NetworkAPI; 29 | 30 | import java.util.ArrayList; 31 | import java.util.List; 32 | 33 | import retrofit.Callback; 34 | import retrofit.RetrofitError; 35 | import retrofit.client.Response; 36 | 37 | /** 38 | * An activity representing a list of movies. This activity 39 | * has different presentations for handset and tablet-size devices. On 40 | * handsets, the activity presents a list of items, which when touched, 41 | * lead to a {@link movieDetailActivity} representing 42 | * item details. On tablets, the activity presents the list of items and 43 | * item details side-by-side using two vertical panes. 44 | */ 45 | public class movieListActivity extends AppCompatActivity { 46 | final CharSequence[] items = {" Most Popular ", " Highest Rated ", " My Favourites "}; 47 | private final String MOST_POPULAR = "popularity.desc"; 48 | private final String HIGHLY_RATED = "vote_count.desc"; 49 | View recyclerView; 50 | private AlertDialog choice; 51 | private String FLAG_CURRENT = MOST_POPULAR; 52 | private String FLAG_FAV = "FAVOURITE"; 53 | private TextView errorTextView; 54 | private ImageView errorImageview; 55 | /** 56 | * Whether or not the activity is in two-pane mode, i.e. running on a tablet 57 | * device. 58 | */ 59 | private boolean mTwoPane; 60 | private movieGeneral mMoviegeneralData; 61 | 62 | @Override 63 | protected void onCreate(Bundle savedInstanceState) { 64 | super.onCreate(savedInstanceState); 65 | setContentView(R.layout.activity_movie_list); 66 | 67 | 68 | recyclerView = findViewById(R.id.movie_list); 69 | errorImageview = (ImageView) findViewById(R.id.errimg); 70 | errorTextView = (TextView) findViewById(R.id.errtext); 71 | 72 | assert recyclerView != null; 73 | 74 | if (findViewById(R.id.movie_detail_container) != null) { 75 | mTwoPane = true; 76 | } 77 | if (savedInstanceState == null) 78 | FetchMovie((RecyclerView) recyclerView, FLAG_CURRENT); 79 | else { 80 | if (savedInstanceState.getString("CURRENT") == FLAG_FAV) { 81 | FetchMovie((RecyclerView) recyclerView, FLAG_FAV); 82 | } else if (savedInstanceState.getSerializable("adapter") != null) { 83 | mMoviegeneralData = (movieGeneral) savedInstanceState.getSerializable("adapter"); 84 | drawLayout((RecyclerView) recyclerView, mMoviegeneralData); 85 | } else { 86 | FetchMovie((RecyclerView) recyclerView, FLAG_CURRENT); 87 | } 88 | } 89 | 90 | } 91 | 92 | @Override 93 | public boolean onCreateOptionsMenu(Menu menu) { 94 | MenuInflater inflater = getMenuInflater(); 95 | inflater.inflate(R.menu.main, menu); 96 | return true; 97 | } 98 | 99 | @Override 100 | public boolean onOptionsItemSelected(MenuItem item) { 101 | switch (item.getItemId()) { 102 | case R.id.mapMenu: 103 | showChoices(); 104 | break; 105 | } 106 | return true; 107 | } 108 | 109 | private void showChoices() { 110 | 111 | choice = new AlertDialog.Builder(this) 112 | .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { 113 | public void onClick(DialogInterface dialog, int item) { 114 | switch (item) { 115 | case 0: 116 | FetchMovie((RecyclerView) recyclerView, MOST_POPULAR); 117 | break; 118 | case 1: 119 | FetchMovie((RecyclerView) recyclerView, HIGHLY_RATED); 120 | break; 121 | case 2: 122 | FetchMovie((RecyclerView) recyclerView, FLAG_FAV); 123 | break; 124 | } 125 | choice.dismiss(); 126 | } 127 | }).setTitle("Choose") 128 | .show(); 129 | } 130 | 131 | protected void FetchFavourites(@NonNull final RecyclerView recyclerView) { 132 | favouritesSqliteHelper db = new favouritesSqliteHelper(getApplicationContext()); 133 | List movieGeneralModals = db.getAllMovies(); 134 | if (movieGeneralModals.size() > 0) 135 | attachAdapter(recyclerView, movieGeneralModals); 136 | else { 137 | Toast.makeText(getApplicationContext(), "It seems No Favourites! check back Later", Toast.LENGTH_LONG).show(); 138 | } 139 | } 140 | 141 | protected void getPaneChanges() { 142 | mTwoPane = findViewById(R.id.movie_detail_container) != null; 143 | } 144 | 145 | 146 | @Override 147 | protected void onDestroy() { 148 | super.onDestroy(); 149 | } 150 | 151 | @Override 152 | public void onConfigurationChanged(Configuration newConfig) { 153 | 154 | super.onConfigurationChanged(newConfig); 155 | getPaneChanges(); 156 | } 157 | 158 | @Override 159 | protected void onSaveInstanceState(Bundle outState) { 160 | super.onSaveInstanceState(outState); 161 | outState.putSerializable("adapter", mMoviegeneralData); 162 | outState.putString("CURRENT", FLAG_CURRENT); 163 | 164 | } 165 | 166 | private void attachAdapter(@NonNull final RecyclerView recyclerView, List movieGeneralModals) { 167 | DisplayMetrics displaymetrics = new DisplayMetrics(); 168 | getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); 169 | int width = displaymetrics.widthPixels; 170 | int number; 171 | if (!mTwoPane) { 172 | number = width / 170; 173 | } else { 174 | number = (width / 2) / 170; 175 | } 176 | GridLayoutManager lLayout = new GridLayoutManager(getApplicationContext(), number); 177 | RecyclerView rView = recyclerView; 178 | rView.setHasFixedSize(true); 179 | rView.setLayoutManager(lLayout); 180 | FragmentManager fm = getSupportFragmentManager(); 181 | movieGeneralAdapter mMovieGeneralAdapter = new movieGeneralAdapter(getApplicationContext(), movieGeneralModals, mTwoPane, fm); 182 | rView.setAdapter(mMovieGeneralAdapter); 183 | 184 | } 185 | 186 | private void drawLayout(@NonNull final RecyclerView recyclerView, movieGeneral mMoviegeneral) { 187 | List movieGeneralModals = new ArrayList(); 188 | Results[] mResult = mMoviegeneral.getResults(); 189 | for (Results result : mResult) { 190 | movieGeneralModal obj = new movieGeneralModal(result.getTitle(), result.getPoster_path(), result.getVote_average() 191 | , result.getId(), result.getVote_count(), result.getRelease_date(), result.getOverview()); 192 | movieGeneralModals.add(obj); 193 | } 194 | if (mResult.length > 0) { 195 | attachAdapter(recyclerView, movieGeneralModals); 196 | } else { 197 | errorImageview.setVisibility(View.VISIBLE); 198 | errorTextView.setVisibility(View.VISIBLE); 199 | } 200 | } 201 | 202 | private void FetchMovie(@NonNull final RecyclerView recyclerView, String temp) { 203 | 204 | errorImageview.setVisibility(View.INVISIBLE); 205 | errorTextView.setVisibility(View.INVISIBLE); 206 | errorTextView.setText("Sorry!Network Error! check back Later"); 207 | 208 | FLAG_CURRENT = temp; 209 | if (FLAG_CURRENT != FLAG_FAV) { 210 | MovieAPI mMovieAPI = NetworkAPI.createService(MovieAPI.class); 211 | mMovieAPI.fetchMovies(FLAG_CURRENT, constant.ACCESS_TOKEN, "en", new Callback() { 212 | @Override 213 | public void success(movieGeneral mMoviegeneral, Response response) { 214 | mMoviegeneralData = mMoviegeneral; 215 | drawLayout(recyclerView, mMoviegeneral); 216 | } 217 | 218 | @Override 219 | public void failure(RetrofitError error) { 220 | errorImageview.setVisibility(View.VISIBLE); 221 | errorTextView.setVisibility(View.VISIBLE); 222 | } 223 | }); 224 | } else { 225 | FetchFavourites(recyclerView); 226 | } 227 | } 228 | 229 | 230 | } 231 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/network/MovieAPI.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.network; 2 | 3 | import com.ivb.udacity.modal.movieGeneral; 4 | import com.ivb.udacity.modal.review.movieReview; 5 | import com.ivb.udacity.modal.trailer.movieYoutubeModal; 6 | 7 | import retrofit.Callback; 8 | import retrofit.http.GET; 9 | import retrofit.http.Path; 10 | import retrofit.http.Query; 11 | 12 | /** 13 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 14 | */ 15 | public interface MovieAPI { 16 | 17 | //this method is to fetch the ALL movies with specific sort 18 | @GET("/3/discover/movie") 19 | void fetchMovies( 20 | @Query("sort_by") String mSort, 21 | @Query("api_key") String mApiKey, 22 | @Query("language") String lang, 23 | Callback cb 24 | ); 25 | 26 | @GET("/3/movie/{id}/reviews") 27 | void fetchReview( 28 | @Query("api_key") String mApiKey, 29 | @Path("id") String id, 30 | Callback cb 31 | ); 32 | 33 | @GET("/3/movie/{id}/videos") 34 | void fetchVideos( 35 | @Query("api_key") String mApiKey, 36 | @Path("id") String id, 37 | Callback cb 38 | ); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/ivb/udacity/network/NetworkAPI.java: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity.network; 2 | 3 | import com.squareup.okhttp.OkHttpClient; 4 | 5 | import retrofit.RestAdapter; 6 | import retrofit.client.OkClient; 7 | 8 | /** 9 | * Created by S.Shivasurya on 1/1/2016 - androidStudio. 10 | */ 11 | public class NetworkAPI { 12 | public static final String API_BASE_URL = "http://api.themoviedb.org"; 13 | 14 | private static RestAdapter.Builder builder = new RestAdapter.Builder() 15 | .setEndpoint(API_BASE_URL) 16 | .setClient(new OkClient(new OkHttpClient())); 17 | 18 | public static S createService(Class serviceClass) { 19 | RestAdapter adapter = builder.build(); 20 | return adapter.create(serviceClass); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/calendar.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/groups.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/ic_action.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/menu_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/menu_main.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/mqdefault.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/mqdefault.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/review.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/drawable/review.png -------------------------------------------------------------------------------- /app/src/main/res/layout-w900dp/movie_list.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | 20 | 29 | 30 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_movie_detail.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_movie_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 18 | 19 | 24 | 25 | 26 | 27 | 34 | 35 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/movie_cards.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 32 | 33 | 37 | 38 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/movie_detail.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 18 | 19 | 25 | 26 | 30 | 31 | 37 | 38 | 42 | 43 | 53 | 54 | 61 | 68 | 69 | 72 | 73 | 81 | 82 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 102 | 103 | 106 | 110 | 111 | 121 | 126 | 127 | 128 | 133 | 134 | 139 | 140 | 141 | 142 | 143 | 148 | 149 | 154 | 155 | 163 | 164 | 165 | 166 | 167 | 168 | 174 | 175 | 180 | 181 | 187 | 188 | 194 | 195 | 201 | 202 | 203 | 204 | 210 | 211 | 216 | 217 | 223 | 224 | 230 | 231 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 251 | 252 | 253 | -------------------------------------------------------------------------------- /app/src/main/res/layout/movie_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/menu/detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF5722 4 | #E64A19 5 | #795548 6 | #212121 7 | #212121 8 | #B6B6B6 9 | #F44336 10 | #BA68C8 11 | #F50057 12 | #42A5F5 13 | #26A69A 14 | #00C853 15 | #455A64 16 | #fff 17 | #e7e7e7 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3dp 4 | 3dp 5 | 16dp 6 | 16dp 7 | 200dp 8 | 200dp 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Movies Now 3 | My NanoDegree Apps 4 | Spotify Streamer 5 | Scores App 6 | Library App 7 | Build It Bigger 8 | XYZ Reader 9 | CAPSTONE:My Own App 10 | sort 11 | MovieDetailActivity 12 | Share using 13 | Movies Now 14 | Movie 15 | Bad Luck!Network Error 16 | Trailer 17 | SHARE 18 | Plot Synopsis 19 | Review 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 17 | 18 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/test/java/com/ivb/udacity/.html: -------------------------------------------------------------------------------- 1 | package com.ivb.udacity; 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 | } 16 | -------------------------------------------------------------------------------- /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:2.0.0-alpha3' 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/shivasurya/android/5524b29686029779cd2c16da104c70826c5dfa99/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 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-2.8-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 | --------------------------------------------------------------------------------