Add lots of Lint fixes

This commit is contained in:
Bradlee Speice 2014-06-14 15:13:44 -04:00
parent dda5c79299
commit 04fe4d13b4
11 changed files with 21 additions and 50 deletions

View File

@ -17,7 +17,7 @@ public class BaseFragment extends Fragment {
* @param context The {@link android.app.Activity} we are displaying in
* @param view The {@link android.view.View} we need to calculate the offset for.
*/
public static void setInsets(Activity context, View view) {
protected static void setInsets(Activity context, View view) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
SystemBarTintManager tintManager = new SystemBarTintManager(context);
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();

View File

@ -3,7 +3,6 @@ package org.bspeice.minimalbible.activities.downloader;
import org.bspeice.minimalbible.MinimalBible;
import org.bspeice.minimalbible.activities.downloader.manager.BookDownloadManager;
import org.bspeice.minimalbible.activities.downloader.manager.BookDownloadThread;
import org.bspeice.minimalbible.activities.downloader.manager.InstalledManager;
import org.bspeice.minimalbible.activities.downloader.manager.RefreshManager;
import dagger.Module;

View File

@ -38,8 +38,8 @@ public class BookItemHolder {
@Inject BookDownloadManager bookDownloadManager;
@Inject InstalledManager installedManager;
Book b;
Subscription subscription;
private final Book b;
private Subscription subscription;
public BookItemHolder(View v, Book b) {
ButterKnife.inject(this, v);
@ -59,8 +59,8 @@ public class BookItemHolder {
//TODO: Refactor
subscription = bookDownloadManager.getDownloadEvents()
.observeOn(AndroidSchedulers.mainThread())
.filter((event) -> event.getB().getInitials() == b.getInitials())
.subscribe((event) -> displayProgress((int)event.toCircular()));
.filter((event) -> event.getB().getInitials().equals(b.getInitials()))
.subscribe((event) -> displayProgress((int) event.toCircular()));
}
private void displayInstalled() {

View File

@ -15,9 +15,9 @@ import java.util.List;
* Adapter to inflate list_download_items.xml
*/
public class BookListAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
private List<Book> bookList;
private final List<Book> bookList;
private LayoutInflater inflater;
private final LayoutInflater inflater;
public BookListAdapter(LayoutInflater inflater, List<Book> bookList) {
this.bookList = bookList;

View File

@ -5,8 +5,6 @@ import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -17,15 +15,8 @@ import org.bspeice.minimalbible.MinimalBible;
import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.BaseFragment;
import org.bspeice.minimalbible.activities.downloader.manager.RefreshManager;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookCategory;
import org.crosswire.jsword.book.BookComparators;
import org.crosswire.jsword.book.BookFilter;
import org.crosswire.jsword.book.FilterUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
@ -96,7 +87,7 @@ public class BookListFragment extends BaseFragment {
* Trigger the functionality to display a list of modules. Prompts user if downloading
* from the internet is allowable.
*/
public void displayModules() {
private void displayModules() {
boolean dialogDisplayed = downloadPrefs.hasShownDownloadDialog();
if (!dialogDisplayed) {
@ -131,7 +122,7 @@ public class BookListFragment extends BaseFragment {
// First flatten the Map to its lists
.flatMap((books) -> Observable.from(books.values()))
// Then flatten the lists
.flatMap((books) -> Observable.from(books))
.flatMap(Observable::from)
.filter((book) -> book.getBookCategory() ==
BookCategory.fromString(getArguments().getString(ARG_BOOK_CATEGORY)))
// Repack all the books

View File

@ -1,18 +1,17 @@
package org.bspeice.minimalbible.activities.downloader;
import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.BaseActivity;
import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuItem;
import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activities.BaseActivity;
import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
public class DownloadActivity extends BaseActivity implements
BaseNavigationDrawerFragment.NavigationDrawerCallbacks {

View File

@ -32,14 +32,14 @@ public class BookDownloadManager implements WorkListener, BooksListener {
/**
* Mapping of Job ID to the EventBus we should trigger progress on
*/
private Map<String, Book> bookMappings;
private final Map<String, Book> bookMappings;
/**
* Cached copy of downloads in progress so views displaying this info can get it quickly.
*/
private Map<Book, DLProgressEvent> inProgressDownloads;
private final Map<Book, DLProgressEvent> inProgressDownloads;
private PublishSubject<DLProgressEvent> downloadEvents = PublishSubject.create();
private final PublishSubject<DLProgressEvent> downloadEvents = PublishSubject.create();
@Inject
Provider<BookDownloadThread> dlThreadProvider;

View File

@ -5,7 +5,6 @@ import android.util.Log;
import org.bspeice.minimalbible.MinimalBible;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.install.InstallException;
import org.crosswire.jsword.book.install.Installer;
import javax.inject.Inject;

View File

@ -6,8 +6,8 @@ import org.crosswire.jsword.book.Book;
* Used for notifying that a book's download progress is ongoing
*/
public class DLProgressEvent {
private int progress;
private Book b;
private final int progress;
private final Book b;
public static final int PROGRESS_COMPLETE = 100;
public static final int PROGRESS_BEGINNING = 0;

View File

@ -1,8 +1,5 @@
package org.bspeice.minimalbible.activities.downloader.manager;
import android.os.Handler;
import android.os.HandlerThread;
import org.bspeice.minimalbible.MinimalBible;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.install.Installer;
@ -17,8 +14,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.android.schedulers.HandlerThreadScheduler;
import rx.schedulers.Schedulers;
/**

View File

@ -4,11 +4,8 @@ import android.test.InstrumentationTestCase;
import org.bspeice.minimalbible.MinimalBible;
import org.bspeice.minimalbible.MinimalBibleModules;
import org.bspeice.minimalbible.activities.downloader.manager.BookDownloadThread;
import org.bspeice.minimalbible.activities.downloader.manager.DLProgressEvent;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
import org.bspeice.minimalbible.activities.downloader.manager.InstalledManager;
import org.bspeice.minimalbible.activities.downloader.manager.RefreshManager;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.book.Books;
@ -16,16 +13,14 @@ import org.crosswire.jsword.book.install.Installer;
import org.crosswire.jsword.passage.NoSuchKeyException;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Provider;
import dagger.Module;
import dagger.ObjectGraph;
import static com.jayway.awaitility.Awaitility.*;
import static com.jayway.awaitility.Awaitility.await;
/**
* Tests for the Download activity
@ -38,8 +33,6 @@ public class DownloadActivityTest extends InstrumentationTestCase {
@Inject DownloadManager dm;
@Inject InstalledManager im;
@Inject Provider<BookDownloadThread> bookDownloadThreadProvider;
@Inject RefreshManager rm;
public void setUp() {
MinimalBible application = MinimalBible.getApplication();
@ -95,12 +88,7 @@ public class DownloadActivityTest extends InstrumentationTestCase {
// Install a book
Installer i = (Installer) dm.getInstallers().values().toArray()[0];
final Book testBook = i.getBooks().get(0);
await().atMost(30, TimeUnit.SECONDS).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return Books.installed().getBooks().contains(testBook);
}
});
await().atMost(30, TimeUnit.SECONDS).until(() -> Books.installed().getBooks().contains(testBook));
// Validate that we can actually do something with the book
// TODO: Validate that the book exists on the filesystem too