Skip to content

Commit

Permalink
Finish Release-1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
riggaroo committed May 2, 2016
2 parents fbd962c + dfec726 commit 5347fa0
Show file tree
Hide file tree
Showing 34 changed files with 174 additions and 945 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ android {
applicationId "org.bookdash.android"
minSdkVersion 16
targetSdkVersion 23
versionCode 19
versionName "1.1.1"
versionCode 20
versionName "1.1.2"
testInstrumentationRunner "org.bookdash.android.presentation.CustomTestRunner"
buildConfigField "String", "PARSE_APPLICATION_ID", "\"${BOOKDASH_PARSE_APP_ID}\""
buildConfigField "String", "PARSE_CLIENT_KEY", "\"${BOOKDASH_PARSE_CLIENT_ID}\""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package org.bookdash.android;

import android.app.Application;
import android.util.Log;

import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParsePush;
import com.parse.SaveCallback;

import org.bookdash.android.domain.pojo.Book;
import org.bookdash.android.domain.pojo.BookContributor;
Expand Down Expand Up @@ -56,6 +52,7 @@ public void onCreate() {

/**
* Gets the default {@link Tracker} for this {@link Application}.
*
* @return tracker
*/
synchronized public Tracker getDefaultTracker() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
*/
public interface SettingsApi {
boolean isFirstTime();

void setIsFirstTime(boolean isFirstTime);

String getLanguagePreference();

void saveLanguagePreference(String languagePreference);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
public interface SettingsRepository {

boolean isFirstTime();

void setIsFirstTime(boolean isFirstTime);

String getLanguagePreference();

void saveLanguagePreference(String languagePreference);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ public Contributor(String name, String role) {
put(COL_ROLE, role);
}

public String getName(){
public String getName() {
return getString(COL_NAME);
}
public String getRole(){

public String getRole() {
return getString(COL_ROLE);
}

public ParseFile getAvatar(){
public ParseFile getAvatar() {
return getParseFile("avatar");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public Page[] newArray(int size) {
};

public Spanned getHtmlText() {
if (TextUtils.isEmpty(getText())){
if (TextUtils.isEmpty(getText())) {
return SpannedString.valueOf("");
}
return Html.fromHtml(getText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ public class AboutPresenter implements AboutContract.UserActions {

public AboutPresenter(AboutContract.View aboutView) {
this.aboutView = aboutView;

}


@Override
public void clickLearnMore() {
aboutView.showLearnMorePage(BOOKDASH_SITE_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import android.support.v7.app.AppCompatActivity;


import org.bookdash.android.BookDashApplication;


public abstract class BaseAppCompatActivity extends AppCompatActivity {
// protected Tracker tracker;
// protected Tracker tracker;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -18,5 +15,6 @@ protected void onCreate(Bundle savedInstanceState) {
tracker.setScreenName(getScreenName());
tracker.send(new HitBuilders.ScreenViewBuilder().build());*/
}

protected abstract String getScreenName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public void setBookInfoBinding(BookDetail bookInfo) {
bookInfo.getWebUrl() == null ? null : Uri.parse(bookInfo.getWebUrl()),
Uri.parse("android-app://org.bookdash.android/http/bookdash.org/books/" + bookInfo.getObjectId())
);
if (viewAction != null && client != null) {
if (client != null) {
AppIndex.AppIndexApi.start(client, viewAction);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class DownloadsFragment extends Fragment implements DownloadsContract.Vie
private TextView textViewErrorMessage;
private CircularProgressBar circularProgressBar;
private NavDrawerInterface navDrawerInterface;
private Toolbar toolbar;


public static DownloadsFragment newInstance() {
Expand Down Expand Up @@ -84,7 +83,7 @@ public void onClick(View v) {
buttonRetry = (Button) view.findViewById(R.id.button_retry);
textViewErrorMessage = (TextView) view.findViewById(R.id.text_view_error_screen);
circularProgressBar = (CircularProgressBar) view.findViewById(R.id.fragment_loading_downloads);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
if (navDrawerInterface != null) {
navDrawerInterface.setToolbar(toolbar);

Expand Down Expand Up @@ -196,8 +195,14 @@ public void run() {

@Override
public void showNoBooksDownloadedMessage() {
showErrorScreen(true, getString(R.string.no_books_downloaded), false);
listDownloadsRecyclerView.setVisibility(View.GONE);
runUiThread(new Runnable() {
@Override
public void run() {
showErrorScreen(true, getString(R.string.no_books_downloaded), false);
listDownloadsRecyclerView.setVisibility(View.GONE);
}
});

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;

public class DownloadsPresenter implements DownloadsContract.UserActions {
private static final String TAG = "DownloadsPresenter";
private final BookDetailRepository bookRepository;
private final DownloadsContract.View view;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public DownloadsViewHolder(View itemView) {
downloadImageTextView = (ImageView) itemView.findViewById(R.id.image_view_download_book_cover);
downloadProgressTextView = (TextView) itemView.findViewById(R.id.download_progress);
downloadTitleTextView = (TextView) itemView.findViewById(R.id.text_view_book_title_download);
downloadRelativeLayout = (RelativeLayout)itemView.findViewById(R.id.download_relative_layout);
downloadRelativeLayout = (RelativeLayout) itemView.findViewById(R.id.download_relative_layout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.bumptech.glide.Glide;

Expand Down Expand Up @@ -47,9 +46,6 @@ public void onBindViewHolder(BookViewHolder holder, int position) {
holder.downloadedIcon.setVisibility(bookDetail.isDownloadedAlready() ? View.VISIBLE : View.INVISIBLE);
holder.cardContainer.setTag(holder);
holder.cardContainer.setOnClickListener(onClickListener);
// int width = holder.cardContainer.getMeasuredWidth();
/* holder.bookCover.setLayoutParams(new RelativeLayout.LayoutParams(width, width));
holder.bookCover.invalidate();*/
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import android.widget.TextView;

import org.bookdash.android.R;
import org.bookdash.android.domain.pojo.*;
import org.bookdash.android.domain.pojo.BookDetail;

/**
* @author rebeccafranks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ public interface ListBooksContract {

interface View {
void showErrorScreen(boolean show, String errorMessage, boolean showRetryButton);

void showLoading(boolean visible);

void showBooks(List<BookDetail> bookDetailList);

void showSnackBarError(int message);

void showLanguagePopover(String[] languages, int selected);
}

interface UserActionsListener {
void loadLanguages();

void saveSelectedLanguage(int indexOfLanguage);

void loadBooksForLanguagePreference();

void clickOpenLanguagePopover();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.bookdash.android.presentation.listbooks;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand Down Expand Up @@ -112,6 +113,14 @@ public void openBookDetails(View v) {

}

private void runUiThread(Runnable runnable) {
Activity activity = getActivity();
if (activity == null) {
return;
}
activity.runOnUiThread(runnable);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand All @@ -125,39 +134,71 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
}

@Override
public void showErrorScreen(boolean show, String errorMessage, boolean showRetryButton) {
if (show) {
linearLayoutErrorScreen.setVisibility(View.VISIBLE);
recyclerViewBooks.setVisibility(View.GONE);
} else {
linearLayoutErrorScreen.setVisibility(View.GONE);
recyclerViewBooks.setVisibility(View.VISIBLE);
}
buttonRetry.setVisibility(showRetryButton ? View.VISIBLE : View.GONE);
textViewErrorMessage.setText(errorMessage);
public void showErrorScreen(final boolean show, final String errorMessage, final boolean showRetryButton) {
runUiThread(new Runnable() {
@Override
public void run() {
if (show) {
linearLayoutErrorScreen.setVisibility(View.VISIBLE);
recyclerViewBooks.setVisibility(View.GONE);
} else {
linearLayoutErrorScreen.setVisibility(View.GONE);
recyclerViewBooks.setVisibility(View.VISIBLE);
}
buttonRetry.setVisibility(showRetryButton ? View.VISIBLE : View.GONE);
textViewErrorMessage.setText(errorMessage);
}
});


}

@Override
public void showLoading(boolean visible) {
circularProgressBar.setVisibility(visible ? View.VISIBLE : View.GONE);
recyclerViewBooks.setVisibility(visible ? View.GONE : View.VISIBLE);
public void showLoading(final boolean visible) {
runUiThread(new Runnable() {
@Override
public void run() {
if (visible) {
linearLayoutErrorScreen.setVisibility(View.GONE);
buttonRetry.setVisibility(View.GONE);
recyclerViewBooks.setVisibility(View.GONE);
circularProgressBar.setVisibility(View.VISIBLE);
} else {
linearLayoutErrorScreen.setVisibility(View.GONE);
buttonRetry.setVisibility(View.GONE);
circularProgressBar.setVisibility(View.GONE);
recyclerViewBooks.setVisibility(View.GONE);
}

}
});

}

@Override
public void showBooks(List<BookDetail> bookDetailList) {
if (bookDetailList.isEmpty()) {
showErrorScreen(true, getString(R.string.no_books_available), true);
}
bookAdapter = new BookAdapter(bookDetailList, ListBooksFragment.this.getActivity(), bookClickListener);
recyclerViewBooks.setAdapter(bookAdapter);
public void showBooks(final List<BookDetail> bookDetailList) {
runUiThread(new Runnable() {
@Override
public void run() {
if (bookDetailList.isEmpty()) {
showErrorScreen(true, getString(R.string.no_books_available), true);
}
bookAdapter = new BookAdapter(bookDetailList, ListBooksFragment.this.getActivity(), bookClickListener);
recyclerViewBooks.setAdapter(bookAdapter);
}
});


}

@Override
public void showSnackBarError(int message) {
Snackbar.make(recyclerViewBooks, message, Snackbar.LENGTH_LONG).show();
public void showSnackBarError(final int message) {
runUiThread(new Runnable() {
@Override
public void run() {
Snackbar.make(recyclerViewBooks, message, Snackbar.LENGTH_LONG).show();
}
});
}

private DialogInterface.OnClickListener languageClickListener = new DialogInterface.OnClickListener() {
Expand All @@ -173,11 +214,17 @@ public void onClick(DialogInterface dialog, int which) {
};

@Override
public void showLanguagePopover(String[] languages, int selected) {
AlertDialog alertDialogLanguages = new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.language_selection_heading))
.setSingleChoiceItems(languages, selected, languageClickListener).create();
alertDialogLanguages.show();
public void showLanguagePopover(final String[] languages, final int selected) {
runUiThread(new Runnable() {
@Override
public void run() {
AlertDialog alertDialogLanguages = new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.language_selection_heading))
.setSingleChoiceItems(languages, selected, languageClickListener).create();
alertDialogLanguages.show();
}
});

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public void loadBooksForLanguagePreference() {

private void loadBooksForLanguage(String language) {
listBooksView.showLoading(true);
listBooksView.showErrorScreen(false, "", false);
bookDetailRepository.getBooksForLanguage(language, new BookDetailRepository.GetBooksForLanguageCallback() {
bookDetailRepository.getBooksForLanguage(language, new BookDetailRepository.GetBooksForLanguageCallback() {
@Override
public void onBooksLoaded(List<BookDetail> books) {
listBooksView.showLoading(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package org.bookdash.android.presentation.main;

import org.bookdash.android.data.settings.SettingsApi;
import org.bookdash.android.domain.pojo.Language;

import java.util.List;

/**
* Created by rebeccafranks on 16/04/19.
*/
public class MainPresenter implements MainContract.MainUserActions {

private MainContract.MainView mainView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import android.view.WindowManager;

import org.bookdash.android.R;
import org.bookdash.android.presentation.activity.BaseAppCompatActivity;
import org.bookdash.android.domain.pojo.gson.BookPages;
import org.bookdash.android.presentation.activity.BaseAppCompatActivity;

/**
* @author Rebecca Franks ([email protected])
Expand Down
Loading

0 comments on commit 5347fa0

Please sign in to comment.