diff --git a/README.md b/README.md index 897c40b..bc29e8b 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,7 @@ raw directory and your own api_key.txt file). The file should only contain your API key without quotes or any blank lines. + +# Attributions + - Icon made by [Freepik](https://www.flaticon.com/authors/freepik) from + www.flaticon.com diff --git a/app/build.gradle b/app/build.gradle index a815ce6..fcab343 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,6 +27,7 @@ dependencies { implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.android.support:design:28.0.0-beta01' implementation 'com.squareup.okhttp3:okhttp:3.11.0' + implementation 'com.android.support:cardview-v7:28.0.0-beta01' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png new file mode 100644 index 0000000..5174533 Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/com/presentedbykaran/bookshelf/Book.java b/app/src/main/java/com/presentedbykaran/bookshelf/Book.java index 37289e3..04305ac 100644 --- a/app/src/main/java/com/presentedbykaran/bookshelf/Book.java +++ b/app/src/main/java/com/presentedbykaran/bookshelf/Book.java @@ -17,7 +17,10 @@ // Class to store book data public class Book implements Serializable { private String bookTitle; - private double rating; + +// private double rating; + private String rating = "Rating on Google Books: "; + // private ImageView image; private String authors = "By "; @@ -28,18 +31,27 @@ public Book(Activity activity) { findViews(activity); } +// public Book(String bookTitle, List authors, double rating, ImageView image, +// Activity activity) { +// this.bookTitle = bookTitle; +// setAuthors(authors); // to get the comma separated list +// this.rating = rating; +//// this.image = image; +// +// findViews(activity); +// } + public Book(String bookTitle, List authors, double rating, ImageView image, - Activity activity) { + Activity activity) { this.bookTitle = bookTitle; setAuthors(authors); // to get the comma separated list - this.rating = rating; + this.rating += rating; // this.image = image; findViews(activity); } - private void findViews(Activity activity) { // image = activity.findViewById(R.id.imageView); } @@ -68,12 +80,16 @@ public void setAuthors(List authors) { Log.d(TAG, "strAuthors = " + authors); } - public double getRating() { +// public double getRating() { +// return rating; +// } + + public String getRating() { return rating; } public void setRating(double rating) { - this.rating = rating; + this.rating += rating; } // public ImageView getImage() { diff --git a/app/src/main/java/com/presentedbykaran/bookshelf/SearchableActivity.java b/app/src/main/java/com/presentedbykaran/bookshelf/SearchableActivity.java index fa5d3a3..6b61af2 100644 --- a/app/src/main/java/com/presentedbykaran/bookshelf/SearchableActivity.java +++ b/app/src/main/java/com/presentedbykaran/bookshelf/SearchableActivity.java @@ -62,6 +62,8 @@ private void searchFor(String query) { String bookURL = "https://www.googleapis.com/books/v1/volumes?" + volumesWithTxt + "+" + "&key=" + apiKey; + Log.d(TAG, bookURL); + if (isNetworkAvailable()) { // OkHttp asynchronous GET recipe @@ -128,11 +130,9 @@ private Book[] getBookDetails(String jsonData) throws JSONException { Book[] books = new Book[items.length()]; for (int i = 0; i < books.length; i++) { -// for (int i = 0; i < mBooks.length; i++) { JSONObject jsonBook = items.getJSONObject(i); JSONObject volumeInfo = jsonBook.getJSONObject("volumeInfo"); -// Book book = new Book(); Book book = new Book(this); if (volumeInfo.has("title")) @@ -154,7 +154,6 @@ private Book[] getBookDetails(String jsonData) throws JSONException { if (volumeInfo.has("averageRating")) { double rating = volumeInfo.getDouble("averageRating"); book.setRating(rating); -// book.setRating(volumeInfo.getDouble("averageRating")); } else { Log.d(TAG, "No averageRating for index " + i); book.setRating(0); diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index d5fccc5..01f0af0 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,170 +1,74 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:viewportWidth="108" + xmlns:android="http://schemas.android.com/apk/res/android"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/single_list_row.xml b/app/src/main/res/layout/single_list_row.xml index 293ea7e..9f70da1 100644 --- a/app/src/main/res/layout/single_list_row.xml +++ b/app/src/main/res/layout/single_list_row.xml @@ -1,61 +1,73 @@ - + + - - - - - - - - - - + + + android:layout_height="match_parent"> + + + + + + + + + + + + + + - diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cf..c4a603d 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cf..c4a603d 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index a2f5908..68289d4 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..1bc5c18 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index 1b52399..7721f79 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index ff10afd..387187a 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..3518c53 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index 115a4c7..3a02b9d 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index dcd3cd8..e4a95ba 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..d4b2c3f Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 459ca60..08b4f81 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 8ca12fe..ce0f493 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..f145c61 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index 8e19b41..ab3a724 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index b824ebd..c610ffa 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..010a3e9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index 4c19a13..fb10c1a 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/build.gradle b/build.gradle index 077cb2f..654620b 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,9 @@ allprojects { repositories { google() jcenter() + maven { + url "https://maven.google.com" + } } }