diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f09c162..5209654 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,6 +11,11 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MinimalBible">
+
+
+
@@ -21,11 +26,30 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/search/BasicSearch.java b/app/src/main/java/org/bspeice/minimalbible/activity/search/BasicSearch.java
new file mode 100644
index 0000000..b7ac7ae
--- /dev/null
+++ b/app/src/main/java/org/bspeice/minimalbible/activity/search/BasicSearch.java
@@ -0,0 +1,70 @@
+package org.bspeice.minimalbible.activity.search;
+
+import android.app.SearchManager;
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.Toast;
+
+import org.bspeice.minimalbible.Injector;
+import org.bspeice.minimalbible.MinimalBible;
+import org.bspeice.minimalbible.OGHolder;
+import org.bspeice.minimalbible.R;
+import org.bspeice.minimalbible.activity.BaseActivity;
+
+import javax.inject.Inject;
+
+import dagger.ObjectGraph;
+
+
+public class BasicSearch extends BaseActivity
+ implements Injector {
+
+ @Inject
+ SearchProvider searchProvider;
+
+ private ObjectGraph searchObjGraph;
+
+ private void buildObjGraph() {
+ if (searchObjGraph == null) {
+ OGHolder holder = OGHolder.get(this);
+ searchObjGraph = holder.fetchGraph();
+ if (searchObjGraph == null) {
+ searchObjGraph = MinimalBible.get(this)
+ .plus(new SearchModules());
+ holder.persistGraph(searchObjGraph);
+ }
+ }
+ searchObjGraph.inject(this);
+ }
+
+ @Override
+ public void inject(Object o) {
+ buildObjGraph();
+ searchObjGraph.inject(o);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_search_results);
+ inject(this);
+
+ handleSearch(getIntent());
+ }
+
+ // Used for launchMode="singleTop"
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ handleSearch(intent);
+ }
+
+ public void handleSearch(Intent intent) {
+ if (!Intent.ACTION_SEARCH.equals(intent.getAction()))
+ return;
+
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ Toast.makeText(this, "Searching for: " + query, Toast.LENGTH_SHORT).show();
+ searchProvider.basicTextSearch(query);
+ }
+}
diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/search/SearchModules.java b/app/src/main/java/org/bspeice/minimalbible/activity/search/SearchModules.java
new file mode 100644
index 0000000..3ae5453
--- /dev/null
+++ b/app/src/main/java/org/bspeice/minimalbible/activity/search/SearchModules.java
@@ -0,0 +1,18 @@
+package org.bspeice.minimalbible.activity.search;
+
+import org.bspeice.minimalbible.MinimalBibleModules;
+
+import dagger.Module;
+import dagger.Provides;
+
+@Module(
+ injects = BasicSearch.class,
+ addsTo = MinimalBibleModules.class
+)
+public class SearchModules {
+
+ @Provides
+ SearchProvider searchProvider() {
+ return new SearchProvider();
+ }
+}
diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java
index 9df6bd2..817762b 100644
--- a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java
+++ b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java
@@ -1,9 +1,14 @@
package org.bspeice.minimalbible.activity.viewer;
+import android.app.SearchManager;
+import android.content.ComponentName;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
@@ -14,6 +19,7 @@ import org.bspeice.minimalbible.OGHolder;
import org.bspeice.minimalbible.R;
import org.bspeice.minimalbible.activity.BaseActivity;
import org.bspeice.minimalbible.activity.downloader.DownloadActivity;
+import org.bspeice.minimalbible.activity.search.BasicSearch;
import org.bspeice.minimalbible.activity.settings.MinimalBibleSettings;
import org.crosswire.jsword.book.Book;
@@ -136,6 +142,21 @@ public class BibleViewer extends BaseActivity implements Injector {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.viewer, menu);
+
+ // Set up search - most of it is handled by the SearchView itself, but
+ // we do have some work so that it knows which activity to start
+ SearchManager searchManager =
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+
+ // And we can't call getActionView() directly, because it needs API 11+
+ MenuItem item = menu.findItem(R.id.action_search);
+ SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
+
+ // The Android docs instruct you to set up search in the current activity.
+ // We want the search to actually run elsewhere.
+ ComponentName cN = new ComponentName(this, BasicSearch.class);
+ searchView.setSearchableInfo(searchManager.getSearchableInfo(cN));
+
return super.onCreateOptionsMenu(menu);
}
diff --git a/app/src/main/kotlin/org/bspeice/minimalbible/activity/search/SearchProvider.kt b/app/src/main/kotlin/org/bspeice/minimalbible/activity/search/SearchProvider.kt
new file mode 100644
index 0000000..2a7373b
--- /dev/null
+++ b/app/src/main/kotlin/org/bspeice/minimalbible/activity/search/SearchProvider.kt
@@ -0,0 +1,13 @@
+package org.bspeice.minimalbible.activity.search
+
+import org.crosswire.jsword.passage.Verse
+
+/**
+ * This is the entry point for handling the actual bible search. Likely will support
+ * an "advanced" search in the future, but for now, basicTextSearch is what you get.
+ */
+class SearchProvider() {
+
+ public fun basicTextSearch(text: String): List =
+ listOf()
+}
diff --git a/app/src/main/res/layout/activity_search_results.xml b/app/src/main/res/layout/activity_search_results.xml
new file mode 100644
index 0000000..b8bd3eb
--- /dev/null
+++ b/app/src/main/res/layout/activity_search_results.xml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d61f823..8af0513 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -8,11 +8,12 @@
Downloads
Could not remove, please restart application
Categories
-
Error refreshing. Try again later
-
bspeice.nc@gmail.com
MinimalBible Feedback
Search
+ SearchResults
+ Hello world!
+ Verse Content
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 7cbbeff..a88410d 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -10,6 +10,8 @@
- @color/textColor
- @style/DrawerArrowStyle
+
+ - @color/textColorPrimary
diff --git a/app/src/main/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml
new file mode 100644
index 0000000..e2aeabb
--- /dev/null
+++ b/app/src/main/res/xml/searchable.xml
@@ -0,0 +1,4 @@
+
+