From 919a1d04f7acfe7a532cc84158bb2fdc63f73f2d Mon Sep 17 00:00:00 2001 From: Rebecca Franks Date: Fri, 8 Jan 2016 15:49:58 +0200 Subject: [PATCH 1/2] fixed issue with build tools not finding correct versions. --- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 99ae20a..7d390af 100644 --- a/build.gradle +++ b/build.gradle @@ -5,11 +5,11 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:2.0.0-alpha1" + classpath "com.android.tools.build:gradle:2.0.0-alpha3" classpath "com.android.databinding:dataBinder:1.+" classpath 'com.google.gms:google-services:1.5.0-beta2' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1' - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c71e76..07fc193 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip From 5dd1afb14628e642247dfd09eef26d6e820d4690 Mon Sep 17 00:00:00 2001 From: Rebecca Franks Date: Sun, 7 Feb 2016 10:45:35 +0200 Subject: [PATCH 2/2] Fix issue with Crash on BookInfoActivity when trying to share a book but the book information hasn't loaded yet. Refactor BookViewHolder Change gradle build tools to alpha9 --- app/build.gradle | 4 ++-- .../bookinfo/BookInfoPresenter.java | 10 +++++--- .../presentation/listbooks/BookAdapter.java | 10 ++++---- .../listbooks/BookViewHolder.java | 23 ++++++++++--------- .../listbooks/ListBooksActivity.java | 2 +- .../presentation/splash/SplashContract.java | 3 --- app/src/main/res/values/strings.xml | 1 + build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 31 insertions(+), 28 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 71601ba..6eb91ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "org.bookdash.android" minSdkVersion 16 targetSdkVersion 23 - versionCode 12 - versionName "1.0.12" + versionCode 13 + versionName "1.0.13" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" buildConfigField "String", "PARSE_APPLICATION_ID", "\"${BOOKDASH_PARSE_APP_ID}\"" buildConfigField "String", "PARSE_CLIENT_KEY", "\"${BOOKDASH_PARSE_CLIENT_ID}\"" diff --git a/app/src/main/java/org/bookdash/android/presentation/bookinfo/BookInfoPresenter.java b/app/src/main/java/org/bookdash/android/presentation/bookinfo/BookInfoPresenter.java index 0b8ad02..3d994e8 100644 --- a/app/src/main/java/org/bookdash/android/presentation/bookinfo/BookInfoPresenter.java +++ b/app/src/main/java/org/bookdash/android/presentation/bookinfo/BookInfoPresenter.java @@ -31,6 +31,7 @@ public class BookInfoPresenter implements BookInfoContract.UserActionsListener { private final BookDetailRepository bookDetailRepository; private final Context context; + public BookInfoPresenter(Context context, @NonNull BookInfoContract.View booksView, @NonNull BookDetailRepository bookDetailRepository) { this.booksView = booksView; @@ -60,7 +61,7 @@ private void showBookDetail(BookDetail bookDetail) { booksView.setBookInfoBinding(bookDetail); booksView.setToolbarTitle(bookDetail.getBookTitle()); - if (bookDetail.isDownloadedAlready()){ + if (bookDetail.isDownloadedAlready()) { booksView.showDownloadFinished(); } booksView.showBookDetailView(); @@ -81,7 +82,7 @@ public void onContributorsLoadError(Exception e) { @Override public void downloadBook(@NonNull final BookDetail bookInfo) { - if (bookInfo.isDownloading()){ + if (bookInfo.isDownloading()) { booksView.showSnackBarMessage(R.string.book_is_downloading); return; } @@ -132,7 +133,10 @@ public void onResourceReady(Bitmap resource, GlideAnimation glid @Override public void shareBookClicked(BookDetail bookInfo) { - + if (bookInfo == null) { + booksView.showError(context.getString(R.string.book_info_still_loading)); + return; + } booksView.sendShareEvent(bookInfo.getBookTitle()); } diff --git a/app/src/main/java/org/bookdash/android/presentation/listbooks/BookAdapter.java b/app/src/main/java/org/bookdash/android/presentation/listbooks/BookAdapter.java index a22d43a..0c1e70f 100644 --- a/app/src/main/java/org/bookdash/android/presentation/listbooks/BookAdapter.java +++ b/app/src/main/java/org/bookdash/android/presentation/listbooks/BookAdapter.java @@ -39,12 +39,12 @@ public BookViewHolder onCreateViewHolder(ViewGroup parent, @Override public void onBindViewHolder(BookViewHolder holder, int position) { BookDetail bookDetail = bookDetails.get(position); - holder.mTextView.setText(bookDetail.getBookTitle()); - Glide.with(context).load(bookDetail.getBookCoverUrl()).into(holder.mImageView); + holder.bookTitle.setText(bookDetail.getBookTitle()); + Glide.with(context).load(bookDetail.getBookCoverUrl()).into(holder.bookCover); holder.bookDetail = bookDetail; - holder.mImageViewDownloaded.setVisibility(bookDetail.isDownloadedAlready() ? View.VISIBLE : View.INVISIBLE); - holder.mCardView.setTag(holder); - holder.mCardView.setOnClickListener(onClickListener); + holder.downloadedIcon.setVisibility(bookDetail.isDownloadedAlready() ? View.VISIBLE : View.INVISIBLE); + holder.cardContainer.setTag(holder); + holder.cardContainer.setOnClickListener(onClickListener); } diff --git a/app/src/main/java/org/bookdash/android/presentation/listbooks/BookViewHolder.java b/app/src/main/java/org/bookdash/android/presentation/listbooks/BookViewHolder.java index 586264d..298d271 100644 --- a/app/src/main/java/org/bookdash/android/presentation/listbooks/BookViewHolder.java +++ b/app/src/main/java/org/bookdash/android/presentation/listbooks/BookViewHolder.java @@ -1,6 +1,5 @@ package org.bookdash.android.presentation.listbooks; -import android.media.Image; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.View; @@ -15,18 +14,20 @@ * @since 15/11/11. */ public class BookViewHolder extends RecyclerView.ViewHolder { - public TextView mTextViewBookAuthor; - public TextView mTextView; - public ImageView mImageView; - public CardView mCardView; + + public TextView author; + public TextView bookTitle; + public ImageView bookCover; + public CardView cardContainer; public BookDetail bookDetail; - public ImageView mImageViewDownloaded; + public ImageView downloadedIcon; + public BookViewHolder(View v) { super(v); - mCardView = (CardView) v.findViewById(R.id.card_view); - mTextView = (TextView) v.findViewById(R.id.textViewBookName); - mImageView = (ImageView) v.findViewById(R.id.imageViewBookCover); - mTextViewBookAuthor = (TextView) v.findViewById(R.id.textViewAuthor); - mImageViewDownloaded = (ImageView) v.findViewById(R.id.imageViewBookDownloaded); + cardContainer = (CardView) v.findViewById(R.id.card_view); + bookTitle = (TextView) v.findViewById(R.id.textViewBookName); + bookCover = (ImageView) v.findViewById(R.id.imageViewBookCover); + author = (TextView) v.findViewById(R.id.textViewAuthor); + downloadedIcon = (ImageView) v.findViewById(R.id.imageViewBookDownloaded); } } diff --git a/app/src/main/java/org/bookdash/android/presentation/listbooks/ListBooksActivity.java b/app/src/main/java/org/bookdash/android/presentation/listbooks/ListBooksActivity.java index d6a5e95..9186f50 100644 --- a/app/src/main/java/org/bookdash/android/presentation/listbooks/ListBooksActivity.java +++ b/app/src/main/java/org/bookdash/android/presentation/listbooks/ListBooksActivity.java @@ -362,7 +362,7 @@ public void showAboutPage() { public void openBookDetails(View v) { /* if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { ImageView imageView = - ((BookViewHolder) v.getTag()).mImageView; + ((BookViewHolder) v.getTag()).bookCover; imageView.setTransitionName(getString(R.string.transition_book)); v.setBackgroundColor( ContextCompat.getColor(ListBooksActivity.this, android.R.color.transparent)); diff --git a/app/src/main/java/org/bookdash/android/presentation/splash/SplashContract.java b/app/src/main/java/org/bookdash/android/presentation/splash/SplashContract.java index d46376b..c88b225 100644 --- a/app/src/main/java/org/bookdash/android/presentation/splash/SplashContract.java +++ b/app/src/main/java/org/bookdash/android/presentation/splash/SplashContract.java @@ -13,15 +13,12 @@ public interface SplashContract { interface View { void loadTutorial(); - void loadMainScreen(); } interface UserActionsListener { void loadSplash(); - ArrayList getTutorialItems(Context context); - void finishedTutorial(); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b460a55..e1ec4a3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -81,5 +81,6 @@ Downloaded Books No books are downloaded. Head to the \"All Books\" section to download some! No books available at the moment. Check back soon! + Book information is still loading... diff --git a/build.gradle b/build.gradle index 7d390af..5960334 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,8 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:2.0.0-alpha3" - classpath "com.android.databinding:dataBinder:1.+" + classpath 'com.android.tools.build:gradle:2.0.0-alpha9' + classpath "com.android.databinding:dataBinder:1.0-rc4" classpath 'com.google.gms:google-services:1.5.0-beta2' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 07fc193..d570517 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip