mirror of
https://github.com/MinimalBible/MinimalBible-Legacy
synced 2025-07-13 03:36:54 -04:00
Compare commits
12 Commits
Rx/Retrola
...
ugly-unit-
Author | SHA1 | Date | |
---|---|---|---|
df3cf9652e | |||
1c15767d10 | |||
b19b740c43 | |||
969adad9b0 | |||
018fe29a75 | |||
f5800388d3 | |||
8c71d4372e | |||
348a6da9a3 | |||
8e54fdb86d | |||
d260f98377 | |||
3649468e7f | |||
d9f6eaa339 |
@ -7,8 +7,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3'
|
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
|
||||||
//classpath 'me.tatarka:gradle-retrolambda:1.3.2'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,10 +26,11 @@ dependencies {
|
|||||||
apt 'de.devland.esperandro:esperandro:1.1.2'
|
apt 'de.devland.esperandro:esperandro:1.1.2'
|
||||||
// compile 'com.f2prateek.dart:dart:1.1.0'
|
// compile 'com.f2prateek.dart:dart:1.1.0'
|
||||||
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
|
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
|
||||||
// compile 'de.greenrobot:eventbus:2.2.0'
|
|
||||||
compile 'com.netflix.rxjava:rxjava-android:0.19.0'
|
compile 'com.netflix.rxjava:rxjava-android:0.19.0'
|
||||||
|
|
||||||
// Handled by appcompat
|
// Handled by appcompat
|
||||||
// compile 'com.google.android:support-v4:r7'
|
// compile 'com.google.android:support-v4:r7'
|
||||||
|
|
||||||
// And our unit testing needs some specific stuff (and specific stuff included again)
|
// And our unit testing needs some specific stuff (and specific stuff included again)
|
||||||
androidTestCompile 'junit:junit:4.11+'
|
androidTestCompile 'junit:junit:4.11+'
|
||||||
androidTestCompile 'com.jayway.awaitility:awaitility:1.6.0'
|
androidTestCompile 'com.jayway.awaitility:awaitility:1.6.0'
|
||||||
@ -39,10 +39,10 @@ dependencies {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 19
|
||||||
buildToolsVersion '19.1.0'
|
buildToolsVersion '20'
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'src/main/AndroidManifest.xml'
|
||||||
java.srcDirs = ['src/main/java']
|
java.srcDirs = ['src/main/java']
|
||||||
resources.srcDirs = ['src/main/res']
|
resources.srcDirs = ['src/main/res']
|
||||||
aidl.srcDirs = ['src']
|
aidl.srcDirs = ['src']
|
||||||
@ -75,17 +75,4 @@ android {
|
|||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
defaultConfig {}
|
|
||||||
productFlavors {
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="8"
|
android:minSdkVersion="8"
|
||||||
android:targetSdkVersion="19" />
|
android:targetSdkVersion="20" />
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|
11
MinimalBible/src/main/assets/book.html
Normal file
11
MinimalBible/src/main/assets/book.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div id="content" />
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function set_content(content) {
|
||||||
|
document.getElementById("content").innerHTML = content;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,12 @@
|
|||||||
|
package org.bspeice.minimalbible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Massive shout-out to <a href="https://github.com/vovkab">vovkab</a> for this idea.
|
||||||
|
*/
|
||||||
|
public interface Injectable {
|
||||||
|
|
||||||
|
public Object[] getModules();
|
||||||
|
|
||||||
|
public void inject(Object o);
|
||||||
|
|
||||||
|
}
|
@ -2,10 +2,15 @@ package org.bspeice.minimalbible;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.crosswire.jsword.book.sword.SwordBookPath;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import dagger.ObjectGraph;
|
import dagger.ObjectGraph;
|
||||||
|
|
||||||
public class MinimalBible extends Application {
|
public class MinimalBible extends Application implements Injectable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The graph used by Dagger to track dependencies
|
* The graph used by Dagger to track dependencies
|
||||||
@ -18,6 +23,8 @@ public class MinimalBible extends Application {
|
|||||||
*/
|
*/
|
||||||
private static MinimalBible instance;
|
private static MinimalBible instance;
|
||||||
|
|
||||||
|
private String TAG = "MinimalBible";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the application, and persist the application Context
|
* Create the application, and persist the application Context
|
||||||
*/
|
*/
|
||||||
@ -51,6 +58,7 @@ public class MinimalBible extends Application {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
//TODO: Is this necessary?
|
//TODO: Is this necessary?
|
||||||
inject(this);
|
inject(this);
|
||||||
|
setJswordHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,8 +71,29 @@ public class MinimalBible extends Application {
|
|||||||
|
|
||||||
public ObjectGraph getObjGraph() {
|
public ObjectGraph getObjGraph() {
|
||||||
if (graph == null) {
|
if (graph == null) {
|
||||||
graph = ObjectGraph.create(MinimalBibleModules.class);
|
graph = ObjectGraph.create(getModules());
|
||||||
}
|
}
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] getModules() {
|
||||||
|
return MinimalBibleModules.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = MinimalBible.getAppContext().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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,4 +16,12 @@ import dagger.Module;
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class MinimalBibleModules {
|
public class MinimalBibleModules {
|
||||||
|
|
||||||
|
private MinimalBibleModules() {}
|
||||||
|
|
||||||
|
public static Object[] list() {
|
||||||
|
return new Object[] {
|
||||||
|
MinimalBibleModules.class
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.bspeice.minimalbible.activities;
|
package org.bspeice.minimalbible.activities;
|
||||||
|
|
||||||
import org.bspeice.minimalbible.activities.downloader.ActivityDownloaderModule;
|
import org.bspeice.minimalbible.activities.downloader.ActivityDownloaderModule;
|
||||||
|
import org.bspeice.minimalbible.activities.viewer.ActivityViewerModule;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
|
|
||||||
@ -9,7 +10,8 @@ import dagger.Module;
|
|||||||
*/
|
*/
|
||||||
@Module(
|
@Module(
|
||||||
includes = {
|
includes = {
|
||||||
ActivityDownloaderModule.class
|
ActivityDownloaderModule.class,
|
||||||
|
ActivityViewerModule.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class ActivityModules {
|
public class ActivityModules {
|
||||||
|
@ -40,7 +40,7 @@ public class BookListFragment extends BaseFragment {
|
|||||||
* The fragment argument representing the section number for this fragment.
|
* The fragment argument representing the section number for this fragment.
|
||||||
* Not a candidate for Dart (yet) because I would have to write a Parcelable around it.
|
* Not a candidate for Dart (yet) because I would have to write a Parcelable around it.
|
||||||
*/
|
*/
|
||||||
private static final String ARG_BOOK_CATEGORY = "book_category";
|
protected static final String ARG_BOOK_CATEGORY = "book_category";
|
||||||
|
|
||||||
private final String TAG = "BookListFragment";
|
private final String TAG = "BookListFragment";
|
||||||
|
|
||||||
@ -48,9 +48,9 @@ public class BookListFragment extends BaseFragment {
|
|||||||
ListView downloadsAvailable;
|
ListView downloadsAvailable;
|
||||||
|
|
||||||
@Inject RefreshManager refreshManager;
|
@Inject RefreshManager refreshManager;
|
||||||
@Inject DownloadPrefs downloadPrefs;
|
@Inject protected DownloadPrefs downloadPrefs;
|
||||||
|
|
||||||
private ProgressDialog refreshDialog;
|
protected ProgressDialog refreshDialog;
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,7 +93,7 @@ public class BookListFragment extends BaseFragment {
|
|||||||
* Trigger the functionality to display a list of modules. Prompts user if downloading
|
* Trigger the functionality to display a list of modules. Prompts user if downloading
|
||||||
* from the internet is allowable.
|
* from the internet is allowable.
|
||||||
*/
|
*/
|
||||||
private void displayModules() {
|
protected void displayModules() {
|
||||||
boolean dialogDisplayed = downloadPrefs.hasShownDownloadDialog();
|
boolean dialogDisplayed = downloadPrefs.hasShownDownloadDialog();
|
||||||
|
|
||||||
if (!dialogDisplayed) {
|
if (!dialogDisplayed) {
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.bspeice.minimalbible.activities.viewer;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by bspeice on 6/18/14.
|
||||||
|
*/
|
||||||
|
@Module(
|
||||||
|
injects = {
|
||||||
|
BibleViewer.class,
|
||||||
|
BookFragment.class
|
||||||
|
}
|
||||||
|
)
|
||||||
|
public class ActivityViewerModule {
|
||||||
|
}
|
@ -1,27 +1,33 @@
|
|||||||
package org.bspeice.minimalbible.activities.viewer;
|
package org.bspeice.minimalbible.activities.viewer;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Looper;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.view.LayoutInflater;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.MinimalBible;
|
||||||
import org.bspeice.minimalbible.R;
|
import org.bspeice.minimalbible.R;
|
||||||
import org.bspeice.minimalbible.activities.BaseActivity;
|
import org.bspeice.minimalbible.activities.BaseActivity;
|
||||||
import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment;
|
import org.bspeice.minimalbible.activities.BaseNavigationDrawerFragment;
|
||||||
import org.bspeice.minimalbible.activities.downloader.DownloadActivity;
|
import org.bspeice.minimalbible.activities.downloader.DownloadActivity;
|
||||||
|
import org.crosswire.jsword.book.Book;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
|
import rx.functions.Action1;
|
||||||
|
|
||||||
public class BibleViewer extends BaseActivity implements
|
public class BibleViewer extends BaseActivity implements
|
||||||
BaseNavigationDrawerFragment.NavigationDrawerCallbacks {
|
BaseNavigationDrawerFragment.NavigationDrawerCallbacks {
|
||||||
|
|
||||||
|
@Inject BookManager bookManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment managing the behaviors, interactions and presentation of the
|
* Fragment managing the behaviors, interactions and presentation of the
|
||||||
* navigation drawer.
|
* navigation drawer.
|
||||||
@ -37,6 +43,31 @@ public class BibleViewer extends BaseActivity implements
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
MinimalBible.getApplication().inject(this);
|
||||||
|
|
||||||
|
// If no books are installed, we need to download one first.
|
||||||
|
int count = bookManager.getInstalledBooks()
|
||||||
|
.count()
|
||||||
|
.toBlocking()
|
||||||
|
.last();
|
||||||
|
if (count <= 0) {
|
||||||
|
Intent i = new Intent(this, DownloadActivity.class);
|
||||||
|
startActivityForResult(i, 0);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
bookManager.getInstalledBooks()
|
||||||
|
.first()
|
||||||
|
.subscribeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Action1<Book>() {
|
||||||
|
@Override
|
||||||
|
public void call(Book book) {
|
||||||
|
Log.d("BibleViewer", "Subscribed to display book: " + book.getName());
|
||||||
|
displayMainBook(book);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_bible_viewer);
|
setContentView(R.layout.activity_bible_viewer);
|
||||||
|
|
||||||
mNavigationDrawerFragment = (ViewerNavDrawerFragment) getSupportFragmentManager()
|
mNavigationDrawerFragment = (ViewerNavDrawerFragment) getSupportFragmentManager()
|
||||||
@ -50,26 +81,13 @@ public class BibleViewer extends BaseActivity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNavigationDrawerItemSelected(int position) {
|
public void onNavigationDrawerItemSelected(int position) {
|
||||||
// update the main content by replacing fragments
|
// Handle a navigation movement
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
|
||||||
fragmentManager
|
|
||||||
.beginTransaction()
|
|
||||||
.replace(R.id.container,
|
|
||||||
PlaceholderFragment.newInstance(position + 1)).commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSectionAttached(int number) {
|
public void setActionBarTitle(String title) {
|
||||||
switch (number) {
|
ActionBar actionBar = getSupportActionBar();
|
||||||
case 1:
|
mTitle = title;
|
||||||
mTitle = getString(R.string.title_section1);
|
actionBar.setTitle(title);
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
mTitle = getString(R.string.title_section2);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
mTitle = getString(R.string.title_section3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreActionBar() {
|
public void restoreActionBar() {
|
||||||
@ -106,48 +124,13 @@ public class BibleViewer extends BaseActivity implements
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void displayMainBook(Book b) {
|
||||||
* A placeholder fragment containing a simple view.
|
Log.d("BibleViewer", "Initializing main book: " + b.getName());
|
||||||
*/
|
Log.d("MainThread?", Boolean.toString(Looper.myLooper() == Looper.getMainLooper()));
|
||||||
public static class PlaceholderFragment extends Fragment {
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
/**
|
Fragment f = BookFragment.newInstance(b.getName());
|
||||||
* The fragment argument representing the section number for this
|
fragmentManager.beginTransaction()
|
||||||
* fragment.
|
.replace(R.id.container, f)
|
||||||
*/
|
.commit();
|
||||||
private static final String ARG_SECTION_NUMBER = "section_number";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new instance of this fragment for the given section number.
|
|
||||||
*/
|
|
||||||
public static PlaceholderFragment newInstance(int sectionNumber) {
|
|
||||||
PlaceholderFragment fragment = new PlaceholderFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaceholderFragment() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_main, container,
|
|
||||||
false);
|
|
||||||
TextView textView = (TextView) rootView
|
|
||||||
.findViewById(R.id.section_label);
|
|
||||||
textView.setText(Integer.toString(getArguments().getInt(
|
|
||||||
ARG_SECTION_NUMBER)));
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(Activity activity) {
|
|
||||||
super.onAttach(activity);
|
|
||||||
((BibleViewer) activity).onSectionAttached(getArguments().getInt(
|
|
||||||
ARG_SECTION_NUMBER));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,140 @@
|
|||||||
|
package org.bspeice.minimalbible.activities.viewer;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.MinimalBible;
|
||||||
|
import org.bspeice.minimalbible.R;
|
||||||
|
import org.bspeice.minimalbible.activities.BaseFragment;
|
||||||
|
import org.crosswire.jsword.book.Book;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.InjectView;
|
||||||
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
|
import rx.functions.Action1;
|
||||||
|
import rx.functions.Func1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A placeholder fragment containing a simple view.
|
||||||
|
*/
|
||||||
|
public class BookFragment extends BaseFragment {
|
||||||
|
|
||||||
|
@Inject BookManager bookManager;
|
||||||
|
|
||||||
|
@InjectView(R.id.book_content)
|
||||||
|
WebView mainContent;
|
||||||
|
|
||||||
|
private static final String ARG_BOOK_NAME = "book_name";
|
||||||
|
|
||||||
|
private Book mBook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new instance of this fragment for the given section number.
|
||||||
|
*/
|
||||||
|
public static BookFragment newInstance(String bookName) {
|
||||||
|
BookFragment fragment = new BookFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_BOOK_NAME, bookName);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle state) {
|
||||||
|
super.onCreate(state);
|
||||||
|
MinimalBible.getApplication().inject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View rootView = inflater.inflate(R.layout.fragment_viewer_main, container,
|
||||||
|
false);
|
||||||
|
ButterKnife.inject(this, rootView);
|
||||||
|
mainContent.getSettings().setJavaScriptEnabled(true);
|
||||||
|
|
||||||
|
// TODO: Load initial text from SharedPreferences
|
||||||
|
|
||||||
|
// And due to Observable async, we can kick off fetching the actual book asynchronously!
|
||||||
|
bookManager.getInstalledBooks()
|
||||||
|
.first(new Func1<Book, Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean call(Book book) {
|
||||||
|
String mBookName = getArguments().getString(ARG_BOOK_NAME);
|
||||||
|
return book.getName().equals(mBookName);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Action1<Book>() {
|
||||||
|
@Override
|
||||||
|
public void call(Book book) {
|
||||||
|
BookFragment.this.mBook = book;
|
||||||
|
displayBook(book);
|
||||||
|
}
|
||||||
|
}, new Action1<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void call(Throwable throwable) {
|
||||||
|
Log.d("BookFragment", "No books installed?");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove?
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayBook(Book b) {
|
||||||
|
Log.d("BookFragment", b.getName());
|
||||||
|
((BibleViewer)getActivity()).setActionBarTitle(b.getInitials());
|
||||||
|
mainContent.loadUrl(getString(R.string.content_page));
|
||||||
|
mainContent.setWebViewClient(new WebViewClient(){
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
super.onPageFinished(view, url);
|
||||||
|
invokeJavascript("set_content", BookFragment.this.mBook.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void invokeJavascript(String function, Object arg) {
|
||||||
|
mainContent.loadUrl("javascript:" + function + "('" + arg.toString() + "')");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void invokeJavascript(String function, List<Object> args) {
|
||||||
|
mainContent.loadUrl("javascript:" + function + "(" + joinString(",", args.toArray()) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convenience from http://stackoverflow.com/a/17795110/1454178
|
||||||
|
public static String joinString(String join, Object... strings) {
|
||||||
|
if (strings == null || strings.length == 0) {
|
||||||
|
return "";
|
||||||
|
} else if (strings.length == 1) {
|
||||||
|
return strings[0].toString();
|
||||||
|
} else {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(strings[0]);
|
||||||
|
for (int i = 1; i < strings.length; i++) {
|
||||||
|
sb.append(join).append(strings[i].toString());
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package org.bspeice.minimalbible.activities.viewer;
|
||||||
|
|
||||||
|
import org.crosswire.jsword.book.Book;
|
||||||
|
import org.crosswire.jsword.book.Books;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import rx.Observable;
|
||||||
|
import rx.functions.Action0;
|
||||||
|
import rx.functions.Action1;
|
||||||
|
import rx.schedulers.Schedulers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by bspeice on 6/18/14.
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class BookManager {
|
||||||
|
|
||||||
|
private Observable<Book> installedBooks;
|
||||||
|
private Boolean refreshComplete;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
BookManager() {
|
||||||
|
installedBooks = Observable.from(Books.installed().getBooks())
|
||||||
|
.cache();
|
||||||
|
installedBooks.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new Action1<Book>() {
|
||||||
|
@Override
|
||||||
|
public void call(Book book) {}
|
||||||
|
}, new Action1<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void call(Throwable throwable) {}
|
||||||
|
}, new Action0() {
|
||||||
|
@Override
|
||||||
|
public void call() {
|
||||||
|
BookManager.this.refreshComplete = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable<Book> getInstalledBooks() {
|
||||||
|
return installedBooks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isRefreshComplete() {
|
||||||
|
return refreshComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="org.bspeice.minimalbible.MainActivity$PlaceholderFragment" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/section_label"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
@ -3,6 +3,7 @@
|
|||||||
android:id="@+id/list_nav_drawer"
|
android:id="@+id/list_nav_drawer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="#cccccc"
|
||||||
android:choiceMode="singleChoice"
|
android:choiceMode="singleChoice"
|
||||||
android:divider="@android:color/transparent"
|
android:divider="@android:color/transparent"
|
||||||
android:dividerHeight="0dp"
|
android:dividerHeight="0dp"
|
||||||
|
12
MinimalBible/src/main/res/layout/fragment_viewer_main.xml
Normal file
12
MinimalBible/src/main/res/layout/fragment_viewer_main.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="org.bspeice.minimalbible.MainActivity$PlaceholderFragment" >
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/book_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -3,10 +3,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="org.bspeice.minimalbible.MainActivity" >
|
tools:context="org.bspeice.minimalbible.MainActivity" >
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_example"
|
|
||||||
android:title="@string/action_example"
|
|
||||||
app:showAsAction="withText|ifRoom"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
4
MinimalBible/src/main/res/values/html_strings.xml
Normal file
4
MinimalBible/src/main/res/values/html_strings.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="content_page">file:///android_asset/book.html</string>
|
||||||
|
</resources>
|
@ -1,99 +0,0 @@
|
|||||||
package org.bspeice.minimalbible.test;
|
|
||||||
|
|
||||||
import android.test.InstrumentationTestCase;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.bspeice.minimalbible.MinimalBible;
|
|
||||||
import org.bspeice.minimalbible.MinimalBibleModules;
|
|
||||||
import org.bspeice.minimalbible.activities.downloader.manager.BookDownloadManager;
|
|
||||||
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;
|
|
||||||
import org.crosswire.jsword.book.install.InstallException;
|
|
||||||
import org.crosswire.jsword.book.install.Installer;
|
|
||||||
import org.crosswire.jsword.passage.NoSuchKeyException;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import dagger.Module;
|
|
||||||
import dagger.ObjectGraph;
|
|
||||||
import rx.Observable;
|
|
||||||
|
|
||||||
import static com.jayway.awaitility.Awaitility.await;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for the Download activity
|
|
||||||
*/
|
|
||||||
public class DownloadActivityTest extends InstrumentationTestCase {
|
|
||||||
|
|
||||||
@Module(addsTo = MinimalBibleModules.class,
|
|
||||||
injects = DownloadActivityTest.class)
|
|
||||||
public static class DownloadActivityTestModule {}
|
|
||||||
|
|
||||||
@Inject DownloadManager dm;
|
|
||||||
@Inject InstalledManager im;
|
|
||||||
@Inject RefreshManager rm;
|
|
||||||
@Inject BookDownloadManager bdm;
|
|
||||||
|
|
||||||
public void setUp() {
|
|
||||||
MinimalBible application = MinimalBible.getApplication();
|
|
||||||
ObjectGraph graph = application.getObjGraph();
|
|
||||||
ObjectGraph plusGraph = graph.plus(DownloadActivityTestModule.class);
|
|
||||||
plusGraph.inject(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testBasicAssertion() {
|
|
||||||
assertEquals(true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test that we can successfully download and remove a book
|
|
||||||
*/
|
|
||||||
public void testInstallAndRemoveBook() {
|
|
||||||
// Install a book
|
|
||||||
Installer i = (Installer) dm.getInstallers().values().toArray()[0];
|
|
||||||
final Book testBook = i.getBooks().get(0);
|
|
||||||
bdm.installBook(testBook);
|
|
||||||
await().atMost(30, TimeUnit.SECONDS)
|
|
||||||
.until(new Callable<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean call() throws Exception {
|
|
||||||
return 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
|
|
||||||
try {
|
|
||||||
assertNotNull(testBook.getRawText(testBook.getKey("Gen 1:1")));
|
|
||||||
} catch (BookException e) {
|
|
||||||
fail(e.getMessage());
|
|
||||||
} catch (NoSuchKeyException e) {
|
|
||||||
fail(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the book and make sure it's gone
|
|
||||||
// TODO: Validate that the book is off the filesystem
|
|
||||||
im.removeBook(testBook);
|
|
||||||
await().atMost(10, TimeUnit.SECONDS)
|
|
||||||
.until(new Callable<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public Boolean call() throws Exception {
|
|
||||||
return !Books.installed().getBooks().contains(testBook);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
package org.bspeice.minimalbible.test;
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.MinimalBible;
|
||||||
|
import org.bspeice.minimalbible.MinimalBibleModules;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Master module for MinimalBible
|
||||||
|
*/
|
||||||
|
@Module(
|
||||||
|
injects = {
|
||||||
|
MinimalBible.class
|
||||||
|
},
|
||||||
|
includes = {
|
||||||
|
MinimalBibleModules.class
|
||||||
|
}
|
||||||
|
)
|
||||||
|
public class MinimalBibleModulesTest {
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package org.bspeice.minimalbible.test;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.MinimalBible;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import dagger.ObjectGraph;
|
||||||
|
|
||||||
|
public class MinimalBibleTest extends Application {
|
||||||
|
public MinimalBibleTest(Context ctx) {
|
||||||
|
attachBaseContext(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void attachBaseContext(Context base) {
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
super.attachBaseContext(base);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Class<Application> applicationClass = Application.class;
|
||||||
|
Method attach = applicationClass.getDeclaredMethod("attach", Context.class);
|
||||||
|
attach.setAccessible(true);
|
||||||
|
attach.invoke(this, base);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package org.bspeice.minimalbible.test;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.Injectable;
|
||||||
|
|
||||||
|
import dagger.ObjectGraph;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by bspeice on 6/27/14.
|
||||||
|
*/
|
||||||
|
public abstract class MinimalBibleTestMockable extends MinimalBibleTest implements Injectable {
|
||||||
|
|
||||||
|
private ObjectGraph mObjectGraph;
|
||||||
|
|
||||||
|
public MinimalBibleTestMockable(Context context) {
|
||||||
|
super(context);
|
||||||
|
mObjectGraph = ObjectGraph.create(getModules());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract Object[] getModules();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inject(Object o) {
|
||||||
|
mObjectGraph.inject(o);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,163 @@
|
|||||||
|
package org.bspeice.minimalbible.test.activities.downloader;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.ContextWrapper;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.test.ActivityUnitTestCase;
|
||||||
|
|
||||||
|
import org.bspeice.minimalbible.MinimalBible;
|
||||||
|
import org.bspeice.minimalbible.activities.downloader.BookListFragment;
|
||||||
|
import org.bspeice.minimalbible.activities.downloader.DownloadActivity;
|
||||||
|
import org.bspeice.minimalbible.activities.downloader.DownloadPrefs;
|
||||||
|
import org.bspeice.minimalbible.test.MinimalBibleModulesTest;
|
||||||
|
import org.bspeice.minimalbible.test.MinimalBibleTest;
|
||||||
|
import org.bspeice.minimalbible.test.MinimalBibleTestMockable;
|
||||||
|
import org.crosswire.jsword.book.BookCategory;
|
||||||
|
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import de.devland.esperandro.Esperandro;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by bspeice on 6/23/14.
|
||||||
|
*/
|
||||||
|
public class BookListFragmentTest extends ActivityUnitTestCase<DownloadActivity> {
|
||||||
|
private static Class activityUnderTest = DownloadActivity.class;
|
||||||
|
|
||||||
|
@Module(injects = TestDialogDisplayedIfFirstTimeFragment.class,
|
||||||
|
addsTo = MinimalBibleModulesTest.class,
|
||||||
|
overrides = true
|
||||||
|
)
|
||||||
|
protected static class BookListFragmentTestModule{
|
||||||
|
@Provides
|
||||||
|
DownloadPrefs providePrefs() {
|
||||||
|
return Esperandro.getPreferences(DownloadPrefs.class,
|
||||||
|
MinimalBible.getApplication());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookListFragmentTest() {
|
||||||
|
super(activityUnderTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject DownloadPrefs downloadPrefs;
|
||||||
|
FragmentManager mFragmentManager;
|
||||||
|
|
||||||
|
private Application mApplication;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
|
||||||
|
// Set 'dexmaker.dexcache' system property, otherwise sometimes it is null and test will crash
|
||||||
|
// System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());
|
||||||
|
|
||||||
|
mContext = new ContextWrapper(getInstrumentation().getTargetContext()) {
|
||||||
|
@Override
|
||||||
|
public Context getApplicationContext() {
|
||||||
|
return mApplication;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mApplication = new MinimalBibleTestMockable(mContext) {
|
||||||
|
@Override public Object[] getModules() {
|
||||||
|
return new Object[]{new BookListFragmentTestModule()};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
setApplication(mApplication);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public <F extends Fragment> F startFragment(F fragment) {
|
||||||
|
try {
|
||||||
|
mFragmentManager.beginTransaction()
|
||||||
|
.replace(android.R.id.content, fragment)
|
||||||
|
.commit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
final CountDownLatch signal = new CountDownLatch(1);
|
||||||
|
|
||||||
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mFragmentManager.executePendingTransactions();
|
||||||
|
signal.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
signal.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return (F)(mFragmentManager.findFragmentById(android.R.id.content));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testApplicationReplacementWorks() {
|
||||||
|
setActivityContext(mContext);
|
||||||
|
startActivity(new Intent(mContext, activityUnderTest), null, null);
|
||||||
|
|
||||||
|
assertTrue(getActivity().getApplicationContext() instanceof MinimalBibleTestMockable);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class TestDialogDisplayedIfFirstTimeFragment extends BookListFragment {
|
||||||
|
/**
|
||||||
|
* If the refresh dialog is blank after calling display, it must be showing the warning
|
||||||
|
* @return Whether the warning dialog is showing
|
||||||
|
*/
|
||||||
|
public boolean callDisplayModules() {
|
||||||
|
displayModules();
|
||||||
|
return (refreshDialog == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArgs(BookCategory c) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_BOOK_CATEGORY, c.toString());
|
||||||
|
this.setArguments(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDialogDisplayedIfFirstTime() {
|
||||||
|
setActivityContext(mContext);
|
||||||
|
startActivity(new Intent(mContext, activityUnderTest), null, null);
|
||||||
|
|
||||||
|
TestDialogDisplayedIfFirstTimeFragment f = new TestDialogDisplayedIfFirstTimeFragment();
|
||||||
|
f.setArgs(BookCategory.BIBLE);
|
||||||
|
startFragment(f);
|
||||||
|
|
||||||
|
assertNotNull(f);
|
||||||
|
|
||||||
|
downloadPrefs.hasShownDownloadDialog(false);
|
||||||
|
assertTrue(f.callDisplayModules());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRefreshDisplayedAfterFirstTime() {
|
||||||
|
setActivityContext(mContext);
|
||||||
|
startActivity(new Intent(mContext, activityUnderTest), null, null);
|
||||||
|
|
||||||
|
TestDialogDisplayedIfFirstTimeFragment f = new TestDialogDisplayedIfFirstTimeFragment();
|
||||||
|
f.setArgs(BookCategory.BIBLE);
|
||||||
|
startFragment(f);
|
||||||
|
|
||||||
|
assertNotNull(f);
|
||||||
|
|
||||||
|
downloadPrefs.hasShownDownloadDialog(true);
|
||||||
|
assertFalse(f.callDisplayModules());
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ dependencies {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 19
|
||||||
buildToolsVersion "19.1.0"
|
buildToolsVersion "20"
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
|
@ -4,6 +4,6 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:0.11.+'
|
classpath 'com.android.tools.build:gradle:0.12.+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,4 +1,4 @@
|
|||||||
#Tue Jun 10 19:26:46 EDT 2014
|
#Fri Jun 27 21:15:50 EDT 2014
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
Reference in New Issue
Block a user