mirror of
https://github.com/MinimalBible/MinimalBible-Legacy
synced 2025-07-12 11:14:49 -04:00
Compare commits
20 Commits
master-old
...
Rx/Retrola
Author | SHA1 | Date | |
---|---|---|---|
4269988b7c | |||
e945ef51a7 | |||
04fe4d13b4 | |||
dda5c79299 | |||
93abe065a2 | |||
ba3c6ebe6c | |||
3869cf0b9b | |||
8d17b6db64 | |||
7070c933d1 | |||
28dfec81d7 | |||
fb0c5fdaaa | |||
6eb5f66dcc | |||
e356c8d1fc | |||
287b8cb40d | |||
899b054c8b | |||
8f346f17e4 | |||
1a7364da86 | |||
ca1ccd9942 | |||
5770e8dd74 | |||
3f5909be08 |
@ -2,11 +2,6 @@ language: android
|
|||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- ANDROID_SDKS=android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
|
- ANDROID_SDKS=android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
|
||||||
|
|
||||||
android:
|
|
||||||
components:
|
|
||||||
- build-tools-20.0.0
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
|
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
|
||||||
- emulator -avd test -no-skin -no-audio -no-window &
|
- emulator -avd test -no-skin -no-audio -no-window &
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="8"
|
android:minSdkVersion="8"
|
||||||
android:targetSdkVersion="20" />
|
android:targetSdkVersion="19" />
|
||||||
<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"/>
|
||||||
|
|
@ -7,7 +7,8 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
|
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3'
|
||||||
|
//classpath 'me.tatarka:gradle-retrolambda:1.3.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,11 +27,10 @@ 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 '20'
|
buildToolsVersion '19.1.0'
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
manifest.srcFile 'src/main/AndroidManifest.xml'
|
manifest.srcFile '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']
|
||||||
@ -52,12 +52,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move the tests to tests/java, tests/res, etc...
|
// Move the tests to tests/java, tests/res, etc...
|
||||||
androidTest {
|
androidTest.setRoot('src/test')
|
||||||
manifest.srcFile 'src/test/AndroidManifest.xml'
|
|
||||||
java.srcDirs = ['src/test/java']
|
|
||||||
resources.srcDirs = ['src/test/res']
|
|
||||||
assets.srcDirs = ['src/test/assets']
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move the build types to build-types/<type>
|
// Move the build types to build-types/<type>
|
||||||
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
||||||
@ -80,4 +75,17 @@ android {
|
|||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
defaultConfig {}
|
||||||
|
productFlavors {
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,11 +0,0 @@
|
|||||||
<html>
|
|
||||||
<body>
|
|
||||||
<div id="content" />
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function set_content(content) {
|
|
||||||
document.getElementById("content").innerHTML = content;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -2,11 +2,6 @@ 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;
|
||||||
|
|
||||||
@ -23,8 +18,6 @@ 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
|
||||||
*/
|
*/
|
||||||
@ -58,7 +51,6 @@ public class MinimalBible extends Application {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
//TODO: Is this necessary?
|
//TODO: Is this necessary?
|
||||||
inject(this);
|
inject(this);
|
||||||
setJswordHome();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,24 +67,4 @@ public class MinimalBible extends Application {
|
|||||||
}
|
}
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void plusObjGraph(Object... modules) {
|
|
||||||
graph = graph.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 = 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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
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;
|
||||||
|
|
||||||
@ -10,8 +9,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
protected static final String ARG_BOOK_CATEGORY = "book_category";
|
private 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 protected DownloadPrefs downloadPrefs;
|
@Inject DownloadPrefs downloadPrefs;
|
||||||
|
|
||||||
protected ProgressDialog refreshDialog;
|
private 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.
|
||||||
*/
|
*/
|
||||||
protected void displayModules() {
|
private void displayModules() {
|
||||||
boolean dialogDisplayed = downloadPrefs.hasShownDownloadDialog();
|
boolean dialogDisplayed = downloadPrefs.hasShownDownloadDialog();
|
||||||
|
|
||||||
if (!dialogDisplayed) {
|
if (!dialogDisplayed) {
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
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,33 +1,27 @@
|
|||||||
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.util.Log;
|
import android.view.LayoutInflater;
|
||||||
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.
|
||||||
@ -43,31 +37,6 @@ 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()
|
||||||
@ -76,19 +45,32 @@ public class BibleViewer extends BaseActivity implements
|
|||||||
|
|
||||||
// Set up the drawer.
|
// Set up the drawer.
|
||||||
mNavigationDrawerFragment.setUp(R.id.navigation_drawer,
|
mNavigationDrawerFragment.setUp(R.id.navigation_drawer,
|
||||||
(DrawerLayout) findViewById(R.id.drawer_layout));
|
(DrawerLayout) findViewById(R.id.drawer_layout));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNavigationDrawerItemSelected(int position) {
|
public void onNavigationDrawerItemSelected(int position) {
|
||||||
// Handle a navigation movement
|
// update the main content by replacing fragments
|
||||||
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
fragmentManager
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.container,
|
||||||
|
PlaceholderFragment.newInstance(position + 1)).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActionBarTitle(String title) {
|
public void onSectionAttached(int number) {
|
||||||
ActionBar actionBar = getSupportActionBar();
|
switch (number) {
|
||||||
mTitle = title;
|
case 1:
|
||||||
actionBar.setTitle(title);
|
mTitle = getString(R.string.title_section1);
|
||||||
}
|
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() {
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
@ -124,13 +106,48 @@ public class BibleViewer extends BaseActivity implements
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMainBook(Book b) {
|
/**
|
||||||
Log.d("BibleViewer", "Initializing main book: " + b.getName());
|
* A placeholder fragment containing a simple view.
|
||||||
Log.d("MainThread?", Boolean.toString(Looper.myLooper() == Looper.getMainLooper()));
|
*/
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
public static class PlaceholderFragment extends Fragment {
|
||||||
Fragment f = BookFragment.newInstance(b.getName());
|
/**
|
||||||
fragmentManager.beginTransaction()
|
* The fragment argument representing the section number for this
|
||||||
.replace(R.id.container, f)
|
* fragment.
|
||||||
.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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,140 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
16
MinimalBible/src/main/res/layout/fragment_main.xml
Normal file
16
MinimalBible/src/main/res/layout/fragment_main.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<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,7 +3,6 @@
|
|||||||
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"
|
||||||
|
@ -1,12 +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"
|
|
||||||
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,6 +3,10 @@
|
|||||||
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"
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="content_page">file:///android_asset/book.html</string>
|
|
||||||
</resources>
|
|
@ -1,19 +0,0 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="org.bspeice.minimalbible">
|
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="8"
|
|
||||||
android:targetSdkVersion="20" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/AppTheme"
|
|
||||||
android:name="org.bspeice.minimalbible.test.MinimalBibleTest" >
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
@ -0,0 +1,99 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,20 +0,0 @@
|
|||||||
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 {
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
package org.bspeice.minimalbible.test;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import org.bspeice.minimalbible.MinimalBible;
|
|
||||||
|
|
||||||
import dagger.ObjectGraph;
|
|
||||||
|
|
||||||
public class MinimalBibleTest extends MinimalBible {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The graph used by Dagger to track dependencies
|
|
||||||
*/
|
|
||||||
private ObjectGraph graph;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A singleton reference to the Application currently being run.
|
|
||||||
* Used mostly so we have a fixed point to get the App Context from
|
|
||||||
*/
|
|
||||||
private static MinimalBibleTest instance;
|
|
||||||
|
|
||||||
private String TAG = "MinimalBibleTest";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the application, and persist the application Context
|
|
||||||
*/
|
|
||||||
public MinimalBibleTest() {
|
|
||||||
instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Application Context. Please note, all attempts to get the App Context should come
|
|
||||||
* through here, and please be sure that the Application won't satisfy what you need.
|
|
||||||
* @return The Application Context
|
|
||||||
*/
|
|
||||||
public static Context getAppContext() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Application, rather than just the Application Context. You likely should be using
|
|
||||||
* this, rather than {@link #getAppContext()}
|
|
||||||
* @return The MinimalBible {@link android.app.Application} object
|
|
||||||
*/
|
|
||||||
public static MinimalBibleTest getApplication() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the {@link android.app.Application}. Responsible for building and
|
|
||||||
* holding on to the master ObjectGraph.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
//TODO: Is this necessary?
|
|
||||||
inject(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inject a Dagger object
|
|
||||||
* @param o The object to be injected
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void inject(Object o) {
|
|
||||||
getObjGraph().inject(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectGraph getObjGraph() {
|
|
||||||
if (graph == null) {
|
|
||||||
graph = ObjectGraph.create(MinimalBibleModulesTest.class);
|
|
||||||
}
|
|
||||||
return graph;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
package org.bspeice.minimalbible.test.activities.downloader;
|
|
||||||
|
|
||||||
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.ActivityInstrumentationTestCase2;
|
|
||||||
|
|
||||||
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.crosswire.jsword.book.BookCategory;
|
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
|
|
||||||
import dagger.Module;
|
|
||||||
import de.devland.esperandro.Esperandro;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by bspeice on 6/23/14.
|
|
||||||
*/
|
|
||||||
public class BookListFragmentTest extends ActivityInstrumentationTestCase2<DownloadActivity> {
|
|
||||||
|
|
||||||
@Module(injects = TestDialogDisplayedIfFirstTimeFragment.class,
|
|
||||||
addsTo = MinimalBibleModulesTest.class
|
|
||||||
)
|
|
||||||
protected static class BookListFragmentTestModule{}
|
|
||||||
|
|
||||||
public BookListFragmentTest() {
|
|
||||||
super(DownloadActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
FragmentManager mFragmentManager;
|
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
mFragmentManager = getActivity().getSupportFragmentManager();
|
|
||||||
assertNotNull(mFragmentManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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(DownloadPrefs prefs) {
|
|
||||||
// Inject the new preferences...
|
|
||||||
this.downloadPrefs = prefs;
|
|
||||||
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() {
|
|
||||||
((MinimalBible)getActivity().getApplication()).plusObjGraph(BookListFragmentTestModule.class);
|
|
||||||
TestDialogDisplayedIfFirstTimeFragment f = new TestDialogDisplayedIfFirstTimeFragment();
|
|
||||||
f.setArgs(BookCategory.BIBLE);
|
|
||||||
startFragment(f);
|
|
||||||
|
|
||||||
DownloadPrefs prefs = Esperandro.getPreferences(DownloadPrefs.class, getActivity());
|
|
||||||
prefs.hasShownDownloadDialog(false);
|
|
||||||
|
|
||||||
assertNotNull(f);
|
|
||||||
assertTrue(f.callDisplayModules(Esperandro.getPreferences(DownloadPrefs.class, getActivity())));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testRefreshDisplayedAfterFirstTime() {
|
|
||||||
((MinimalBible)getActivity().getApplication()).plusObjGraph(BookListFragmentTestModule.class);
|
|
||||||
|
|
||||||
TestDialogDisplayedIfFirstTimeFragment f = new TestDialogDisplayedIfFirstTimeFragment();
|
|
||||||
f.setArgs(BookCategory.BIBLE);
|
|
||||||
startFragment(f);
|
|
||||||
|
|
||||||
DownloadPrefs prefs = Esperandro.getPreferences(DownloadPrefs.class, getActivity());
|
|
||||||
prefs.hasShownDownloadDialog(true);
|
|
||||||
|
|
||||||
assertNotNull(f);
|
|
||||||
assertFalse(f.callDisplayModules(Esperandro.getPreferences(DownloadPrefs.class, getActivity())));
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ dependencies {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 19
|
||||||
buildToolsVersion "20"
|
buildToolsVersion "19.1.0"
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
|
@ -4,6 +4,6 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:0.12.+'
|
classpath 'com.android.tools.build:gradle:0.11.+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,4 +1,4 @@
|
|||||||
#Fri Jun 27 21:15:50 EDT 2014
|
#Tue Jun 10 19:26:46 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