From 5e2bd76e107b47bc73210b808abee65ca8bdb38d Mon Sep 17 00:00:00 2001 From: jendib Date: Sat, 12 Mar 2016 21:27:53 +0100 Subject: [PATCH] Close #71: Android: Advanced search by creator --- docs-android/app/app.iml | 14 +++++++------- docs-android/app/build.gradle | 2 +- .../com/sismics/docs/fragment/SearchFragment.java | 2 ++ .../com/sismics/docs/util/SearchQueryBuilder.java | 15 +++++++++++++++ .../app/src/main/res/layout/search_dialog.xml | 9 +++++++++ docs-android/app/src/main/res/values/strings.xml | 1 + 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/docs-android/app/app.iml b/docs-android/app/app.iml index ebea7fce..0c8f28f8 100644 --- a/docs-android/app/app.iml +++ b/docs-android/app/app.iml @@ -61,13 +61,6 @@ - - - - - - - @@ -75,6 +68,13 @@ + + + + + + + diff --git a/docs-android/app/build.gradle b/docs-android/app/build.gradle index 7a4d2326..7b93e78d 100644 --- a/docs-android/app/build.gradle +++ b/docs-android/app/build.gradle @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0-beta6' + classpath 'com.android.tools.build:gradle:2.1.0-alpha1' } } apply plugin: 'com.android.application' diff --git a/docs-android/app/src/main/java/com/sismics/docs/fragment/SearchFragment.java b/docs-android/app/src/main/java/com/sismics/docs/fragment/SearchFragment.java index d5eeedc5..a1e8cadb 100644 --- a/docs-android/app/src/main/java/com/sismics/docs/fragment/SearchFragment.java +++ b/docs-android/app/src/main/java/com/sismics/docs/fragment/SearchFragment.java @@ -55,6 +55,7 @@ public class SearchFragment extends DialogFragment { View view = inflater.inflate(R.layout.search_dialog, null); final EditText searchEditText = (EditText) view.findViewById(R.id.searchEditText); final EditText fulltextEditText = (EditText) view.findViewById(R.id.fulltextEditText); + final EditText creatorEditText = (EditText) view.findViewById(R.id.creatorEditText); final CheckBox sharedCheckbox = (CheckBox) view.findViewById(R.id.sharedCheckbox); final Spinner languageSpinner = (Spinner) view.findViewById(R.id.languageSpinner); final DatePickerView beforeDatePicker = (DatePickerView) view.findViewById(R.id.beforeDatePicker); @@ -89,6 +90,7 @@ public class SearchFragment extends DialogFragment { // Build the simple criterias SearchQueryBuilder queryBuilder = new SearchQueryBuilder() .simpleSearch(searchEditText.getText().toString()) + .creator(creatorEditText.getText().toString()) .shared(sharedCheckbox.isChecked()) .language(((LanguageAdapter.Language) languageSpinner.getSelectedItem()).getId()) .before(beforeDatePicker.getDate()) diff --git a/docs-android/app/src/main/java/com/sismics/docs/util/SearchQueryBuilder.java b/docs-android/app/src/main/java/com/sismics/docs/util/SearchQueryBuilder.java index 54ab1f94..42522174 100644 --- a/docs-android/app/src/main/java/com/sismics/docs/util/SearchQueryBuilder.java +++ b/docs-android/app/src/main/java/com/sismics/docs/util/SearchQueryBuilder.java @@ -59,6 +59,21 @@ public class SearchQueryBuilder { return this; } + /** + * Add a creator criteria. + * + * @param creator Creator criteria + * @return The builder + */ + public SearchQueryBuilder creator(String creator) { + if (isValid(creator)) { + query.append(SEARCH_SEPARATOR) + .append("by:") + .append(creator); + } + return this; + } + /** * Add a language criteria. * diff --git a/docs-android/app/src/main/res/layout/search_dialog.xml b/docs-android/app/src/main/res/layout/search_dialog.xml index 52d76d8c..69a29e1a 100644 --- a/docs-android/app/src/main/res/layout/search_dialog.xml +++ b/docs-android/app/src/main/res/layout/search_dialog.xml @@ -27,6 +27,15 @@ android:textSize="18sp" android:hint="@string/fulltext_search"/> + + + Title Simple search Fulltext search + Creator After date Before date Search tags