Skip to content

Commit

Permalink
Finish Release-1.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
riggaroo committed Nov 30, 2015
2 parents fff5d6f + f4cf96d commit ed12b5a
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 18 deletions.
13 changes: 6 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
applicationId "org.bookdash.android"
minSdkVersion 16
targetSdkVersion 23
versionCode 10
versionName "1.0.10"
versionCode 11
versionName "1.0.11"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
Expand Down Expand Up @@ -89,13 +89,12 @@ android {
signingConfig signingConfigs.release
buildConfigField "String", "PARSE_APPLICATION_ID", appConfig.PARSE_APPLICATION_ID
buildConfigField "String", "PARSE_CLIENT_KEY", appConfig.PARSE_CLIENT_KEY

ext.enableCrashlytics = true
}
debug {
buildConfigField "String", "PARSE_APPLICATION_ID", appConfig.PARSE_APPLICATION_ID
buildConfigField "String", "PARSE_CLIENT_KEY", appConfig.PARSE_CLIENT_KEY
ext.enableCrashlytics = false

// Run code coverage reports by default on debug builds.
testCoverageEnabled = true
}
Expand Down Expand Up @@ -153,12 +152,12 @@ dependencies {
compile "com.android.support:design:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$rootProject.ext.supportLibraryVersion"
compile "com.android.support:percent:$rootProject.ext.supportLibraryVersion"

compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.2.0'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')

compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.parse:parse-android:1.11.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') {
transitive = true;
}
Expand Down
Binary file removed app/libs/Parse-1.9.3.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class BookDetailApiImpl implements BookDetailApi {
private final Executor DISK_EXECUTOR = Executors.newCachedThreadPool();

@Override
public void getBooksForLanguages(String language, final BookServiceCallback<List<BookDetail>> bookServiceCallback) {
public void getBooksForLanguages(@NonNull String language, @NonNull final BookServiceCallback<List<BookDetail>> bookServiceCallback) {
ParseQuery<Language> queryLanguagesNew = ParseQuery.getQuery(Language.class);
queryLanguagesNew.whereEqualTo(Language.LANG_NAME_COL, language);

Expand Down Expand Up @@ -127,7 +127,11 @@ public void done(List<Language> list, ParseException e) {

@Override
public void downloadBook(final BookDetail bookInfo, @NonNull final BookServiceCallback<BookPages> downloadBookCallback, @NonNull final BookServiceProgressCallback progressCallback) {

if (bookInfo.isDownloadedAlready()){
progressCallback.onProgressChanged(100);
downloadBookCallback.onLoaded(getBookPages(bookInfo.getFolderLocation(BookDashApplication.FILES_DIR) + File.separator + BookDetail.BOOK_INFO_FILE_NAME ));
return;
}
bookInfo.getBookFile().getDataInBackground(new GetDataCallback() {
@Override
public void done(final byte[] bytes, ParseException e) {
Expand Down Expand Up @@ -185,7 +189,7 @@ private BookPages saveBook(byte[] bytes, BookDetail bookDetail) {
FileManager.deleteFile(BookDashApplication.FILES_DIR, File.separator + bookDetail.getBookFile().getName());
}

return getBookPages(bookDetail.getFolderLocation(BookDashApplication.FILES_DIR) + File.separator + "bookdetails.json");
return getBookPages(bookDetail.getFolderLocation(BookDashApplication.FILES_DIR) + File.separator + BookDetail.BOOK_INFO_FILE_NAME);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public BookDetailRepositoryImpl(@NonNull BookDetailApi bookDetailApi){
}

@Override
public void getBooksForLanguage(String language, @NonNull final GetBooksForLanguageCallback booksForLanguageCallback) {
public void getBooksForLanguage(@NonNull String language, @NonNull final GetBooksForLanguageCallback booksForLanguageCallback) {
bookDetailApi.getBooksForLanguages(language, new BookDetailApi.BookServiceCallback<List<BookDetail>>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public class BookDetail extends ParseObject {
public static final String OBJECT_ID = "objectId";
public static final String BOOK_ENABLED_COL = "book_enabled";
public static final String CREATED_AT_COL = "createdAt";
public static final String BOOK_INFO_FILE_NAME = "bookdetails.json";


private boolean isDownloading = false;

public BookDetail() {
}
Expand Down Expand Up @@ -62,7 +66,7 @@ public String getAboutBook() {
return getString(ABOUT_BOOK_COL);
}

public String getBookDetailId(){
public String getBookDetailId() {
return getString(OBJECT_ID);
}

Expand All @@ -83,6 +87,13 @@ public boolean isDownloadedAlready() {
File f = new File("", targetLocation);
return f.exists();
}
public boolean isDownloading() {
return isDownloading;
}

public void setIsDownloading(boolean isDownloading) {
this.isDownloading = isDownloading;
}

public BookDetailParcelable toBookParcelable() {
BookDetailParcelable bookDetailParcelable = new BookDetailParcelable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ public void onClick(View v) {
binding.setVariable(BR.download_click, new View.OnClickListener() {
@Override
public void onClick(View v) {
if (bookInfo == null){
showSnackBarMessage(R.string.book_not_available);
return;
}
floatingActionButton.showProgress(true);

actionsListener.downloadBook(bookInfo);
}
});
Expand Down Expand Up @@ -298,6 +301,7 @@ public void showSnackBarMessage(int message) {

@Override
public void showDownloadProgress(int downloadProgress) {

Log.d(TAG, "Download progress:" + downloadProgress);
floatingActionButton.setProgress(downloadProgress, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ public void onContributorsLoadError(Exception e) {


@Override
public void downloadBook(final BookDetail bookInfo) {

if (bookInfo == null || bookInfo.getBookFile() == null || bookInfo.getBookFile().getUrl() == null) {
public void downloadBook(@NonNull final BookDetail bookInfo) {
if (bookInfo.isDownloading()){
booksView.showSnackBarMessage(R.string.book_is_downloading);
return;
}
bookInfo.setIsDownloading(true);
if (bookInfo.getBookFile() == null || bookInfo.getBookFile().getUrl() == null) {
booksView.showSnackBarMessage(R.string.book_not_available);
return;
}
Expand All @@ -95,11 +99,13 @@ public void onBookPagesLoaded(BookPages bookPages) {
booksView.showSnackBarMessage(R.string.failed_to_open_book);
return;
}
bookInfo.setIsDownloading(false);
booksView.openBook(bookInfo, bookPages, bookInfo.getFolderLocation(BookDashApplication.FILES_DIR));
}

@Override
public void onBookPagesLoadError(Exception e) {
bookInfo.setIsDownloading(false);
if (e != null) {
booksView.showSnackBarMessage(R.string.failed_to_download_book);
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/activity_book_information.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
app:fbb_endBitmap="@drawable/ic_open_book"
app:fbb_hideProgressOnComplete="true"
app:fbb_progressColor="?attr/colorAccent"
app:fbb_progressWidthRatio="0.1"
app:fbb_progressWidthRatio="0.125"
app:fbb_autoStart="true"
app:fbb_showEndBitmap="true"
app:fbb_showShadow="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_book_information.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
app:fbb_endBitmap="@drawable/ic_open_book"
app:fbb_hideProgressOnComplete="true"
app:fbb_progressColor="?attr/colorAccent"
app:fbb_progressWidthRatio="0.1"
app:fbb_progressWidthRatio="0.125"
app:fbb_showEndBitmap="true"
app:fbb_autoStart="true"
app:fbb_showShadow="true"
Expand Down

0 comments on commit ed12b5a

Please sign in to comment.