diff --git a/app/build.gradle b/app/build.gradle
index 27d8aec..ec45517 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,13 +3,12 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
-
defaultConfig {
- applicationId "org.bspeice.minimalbible"
+ applicationId 'org.bspeice.minimalbible'
minSdkVersion 8
targetSdkVersion 20
versionCode 1
- versionName "1.0"
+ versionName '1.0'
}
buildTypes {
release {
@@ -24,10 +23,22 @@ android {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
+ productFlavors {
+ testConfig {
+ minSdkVersion 8
+ applicationId 'org.bspeice.minimalbible'
+ targetSdkVersion 20
+ }
+ mainConfig {
+ minSdkVersion 8
+ applicationId 'org.bspeice.minimalbible'
+ targetSdkVersion 20
+ }
+ }
}
dependencies {
- compile project(path: ':jsword-minimalbible', configuration: 'buildJSword')
-
+ compile 'com.squareup.dagger:dagger:1.2.1'
+ provided 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.android.support:appcompat-v7:20.+'
}
diff --git a/app/src/androidTest/java/org/bspeice/minimalbible/ApplicationTest.java b/app/src/androidTest/java/org/bspeice/minimalbible/ApplicationTest.java
deleted file mode 100644
index b86e77e..0000000
--- a/app/src/androidTest/java/org/bspeice/minimalbible/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.bspeice.minimalbible;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java b/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java
new file mode 100644
index 0000000..c0e123a
--- /dev/null
+++ b/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java
@@ -0,0 +1,30 @@
+package org.bspeice.minimalbible;
+
+import android.content.Intent;
+import android.test.ActivityUnitTestCase;
+import android.util.Log;
+
+/**
+ * Created by Bradlee Speice on 7/5/2014.
+ */
+public class DownloadActivityTest extends ActivityUnitTestCase {
+
+ public DownloadActivityTest() {
+ super(DownloadActivity.class);
+ }
+
+ public void testAndroidTestInjection() {
+ MinimalBible m = new MinimalBible();
+ m.buildObjGraph();
+ setApplication(m);
+
+ startActivity(new Intent(getInstrumentation().getTargetContext(),
+ DownloadActivity.class), null, null);
+
+ DownloadActivity a = getActivity();
+ assertNotNull(a);
+
+ Log.w("DownloadActivityTest", a.actionTitle);
+ assertEquals(a.actionTitle, a.actionTitle, "Test");
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ecfdf8b..cd1fd2c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -6,7 +6,8 @@
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
+ android:theme="@style/AppTheme"
+ android:name=".MinimalBible" >
diff --git a/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java b/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java
index 7cfaafb..2f7a754 100644
--- a/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java
+++ b/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java
@@ -1,22 +1,19 @@
package org.bspeice.minimalbible;
import android.app.Activity;
-import android.support.v7.app.ActionBarActivity;
-import android.support.v7.app.ActionBar;
+import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
-import android.content.Context;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.Gravity;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBarActivity;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.support.v4.widget.DrawerLayout;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
+
+import javax.inject.Inject;
public class DownloadActivity extends ActionBarActivity
@@ -32,19 +29,28 @@ public class DownloadActivity extends ActionBarActivity
*/
private CharSequence mTitle;
+ @Inject String actionTitle;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
+ setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
+
+ MinimalBible.get(this).inject(this);
+
setContentView(R.layout.activity_download);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
+ Log.w("DownloadActivity", "Title: " + mTitle.toString());
+ /*
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
+ */
}
@Override
diff --git a/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java b/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java
new file mode 100644
index 0000000..3a73912
--- /dev/null
+++ b/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java
@@ -0,0 +1,31 @@
+package org.bspeice.minimalbible;
+
+import android.app.Application;
+import android.content.Context;
+
+import dagger.ObjectGraph;
+
+/**
+ * Created by Bradlee Speice on 7/5/2014.
+ */
+public class MinimalBible extends Application {
+ private ObjectGraph mObjectGraph;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ buildObjGraph();
+ }
+
+ public void buildObjGraph() {
+ mObjectGraph = ObjectGraph.create(Modules.list(this));
+ }
+
+ public void inject(Object o) {
+ mObjectGraph.inject(o);
+ }
+
+ public static MinimalBible get(Context ctx) {
+ return (MinimalBible)ctx.getApplicationContext();
+ }
+}
diff --git a/app/src/main/java/org/bspeice/minimalbible/MinimalBibleModules.java b/app/src/main/java/org/bspeice/minimalbible/MinimalBibleModules.java
new file mode 100644
index 0000000..8a971fc
--- /dev/null
+++ b/app/src/main/java/org/bspeice/minimalbible/MinimalBibleModules.java
@@ -0,0 +1,30 @@
+package org.bspeice.minimalbible;
+
+import android.app.Application;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+
+/**
+ * Entry point for the default modules used by MinimalBible
+ */
+@Module(injects = DownloadActivity.class,
+ library = true)
+public class MinimalBibleModules {
+ MinimalBible app;
+
+ public MinimalBibleModules(MinimalBible app) {
+ this.app = app;
+ }
+
+ @Provides @Singleton
+ Application provideApplication() {
+ return app;
+ }
+
+ @Provides String provideString() {
+ return "Main";
+ }
+}
diff --git a/app/src/main/java/org/bspeice/minimalbible/NavigationDrawerFragment.java b/app/src/main/java/org/bspeice/minimalbible/NavigationDrawerFragment.java
index 94b5dcd..c264d11 100644
--- a/app/src/main/java/org/bspeice/minimalbible/NavigationDrawerFragment.java
+++ b/app/src/main/java/org/bspeice/minimalbible/NavigationDrawerFragment.java
@@ -98,7 +98,8 @@ public class NavigationDrawerFragment extends Fragment {
}
});
mDrawerListView.setAdapter(new ArrayAdapter(
- getActionBar().getThemedContext(),
+ //getActionBar().getThemedContext(),
+ getActivity(),
android.R.layout.simple_list_item_1,
android.R.id.text1,
new String[]{
diff --git a/app/src/mainConfig/java/org/bspeice/minimalbible/Modules.java b/app/src/mainConfig/java/org/bspeice/minimalbible/Modules.java
new file mode 100644
index 0000000..2e6f518
--- /dev/null
+++ b/app/src/mainConfig/java/org/bspeice/minimalbible/Modules.java
@@ -0,0 +1,14 @@
+package org.bspeice.minimalbible;
+
+/**
+ * List modules used by default MinimalBible configuration
+ */
+public class Modules {
+ private Modules() {}
+
+ public static Object[] list(MinimalBible app) {
+ return new Object[] {
+ new MinimalBibleModules(app)
+ };
+ }
+}
diff --git a/app/src/testConfig/java/org/bspeice/minimalbible/Modules.java b/app/src/testConfig/java/org/bspeice/minimalbible/Modules.java
new file mode 100644
index 0000000..669e2eb
--- /dev/null
+++ b/app/src/testConfig/java/org/bspeice/minimalbible/Modules.java
@@ -0,0 +1,15 @@
+package org.bspeice.minimalbible;
+
+/**
+ * List modules to be used during testing
+ */
+public class Modules {
+ private Modules() {}
+
+ public static Object[] list(MinimalBible app) {
+ return new Object[] {
+ new MinimalBibleModules(app),
+ new TestModules()
+ };
+ }
+}
diff --git a/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java b/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java
new file mode 100644
index 0000000..f534cda
--- /dev/null
+++ b/app/src/testConfig/java/org/bspeice/minimalbible/TestModules.java
@@ -0,0 +1,16 @@
+package org.bspeice.minimalbible;
+
+import dagger.Module;
+import dagger.Provides;
+
+/**
+ * Created by Bradlee Speice on 7/5/2014.
+ */
+@Module(injects = DownloadActivity.class,
+ overrides = true)
+public class TestModules {
+
+ @Provides String provideString() {
+ return "Test";
+ }
+}