Revert "Remove the build flavors"

This reverts commit c38dad605a.
This commit is contained in:
Bradlee Speice
2014-11-06 19:57:13 -05:00
parent dc9700e268
commit 72f375ff9f
15 changed files with 112 additions and 24 deletions

View File

@ -1,66 +0,0 @@
package org.bspeice.minimalbible;
import android.content.Context;
import android.util.Log;
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.crosswire.jsword.book.sword.SwordBookPath;
import java.io.File;
import dagger.ObjectGraph;
/**
* Created by bspeice on 9/12/14.
*/
@ReportsCrashes(formKey = "",
mailTo = "bspeice.nc@gmail.com",
mode = ReportingInteractionMode.SILENT
)
@SuppressWarnings("unused")
public class MinimalBibleTest extends MinimalBible implements Injector {
private String TAG = "MinimalBible";
private ObjectGraph mObjectGraph;
public static MinimalBibleTest get(Context ctx) {
return (MinimalBibleTest) ctx.getApplicationContext();
}
@Override
public void onCreate() {
super.onCreate();
buildObjGraph();
setJswordHome();
ACRA.init(this);
}
public void buildObjGraph() {
mObjectGraph = ObjectGraph.create(Modules.list(this));
}
public void inject(Object o) {
mObjectGraph.inject(o);
}
public ObjectGraph plus(Object... modules) {
return mObjectGraph.plus(modules);
}
/**
* Notify jSword that it needs to store files in the Android internal directory
* NOTE: Android will uninstall these files if you uninstall MinimalBible.
*/
@SuppressWarnings("null")
private void setJswordHome() {
// We need to set the download directory for jSword to stick with
// Android.
String home = this.getFilesDir().toString();
Log.d(TAG, "Setting jsword.home to: " + home);
System.setProperty("jsword.home", home);
System.setProperty("sword.home", home);
SwordBookPath.setDownloadDir(new File(home));
Log.d(TAG, "Sword download path: " + SwordBookPath.getSwordDownloadDir());
}
}

View File

@ -2,7 +2,17 @@ package org.bspeice.minimalbible.test.activity.viewer;
import android.test.ActivityInstrumentationTestCase2;
import org.bspeice.minimalbible.Modules;
import org.bspeice.minimalbible.activity.viewer.BibleViewer;
import org.bspeice.minimalbible.service.manager.BookManager;
import org.crosswire.jsword.book.Book;
import java.util.ArrayList;
import rx.Observable;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class BibleViewerTest extends ActivityInstrumentationTestCase2<BibleViewer> {
@ -19,10 +29,7 @@ public class BibleViewerTest extends ActivityInstrumentationTestCase2<BibleViewe
/**
* It may happen to be the case that we start and there are no installed books.
* This likely triggers a runtime exception from Rx, and is no excuse for dying.
*
* Test disabled until I can get some refactoring done
*/
/*
public void testInitializationNoInstalledBooks() {
BookManager mockBookManager = mock(BookManager.class);
when(mockBookManager.getInstalledBooks()).thenReturn(
@ -31,5 +38,5 @@ public class BibleViewerTest extends ActivityInstrumentationTestCase2<BibleViewe
assertNotNull(getActivity());
}
*/
}