>
</activity>
<activity android:name=".searchCatalog.MoreCopyInformation">
-
</activity>
<activity
android:name=".searchCatalog.SearchCatalogListView"
android:label="@string/app_name"
>
-
</activity>
-
+ <activity
+ android:name=".searchCatalog.AdvancedSearchActivity">
+ </activity>
<!-- Checkout Activities -->
<activity android:name=".accountAccess.checkout.ItemsCheckOutListView"></activity>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="#333"/>
+
+ <corners android:radius="8dip"/>
+</shape>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+
+ <include android:id="@+id/header_actionbar" layout="@layout/simple_actionbar"/>
+
+
+ <Spinner
+ android:id="@+id/advanced_spinner_index"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/header_actionbar"
+ android:entries="@array/advanced_search_index"
+ android:layout_marginTop="10dip"
+ />
+
+ <Spinner
+ android:id="@+id/advanced_spinner_option"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/header_actionbar"
+ android:layout_marginTop="10dip"
+ android:entries="@array/advanced_search_options"
+ android:layout_toRightOf="@id/advanced_spinner_index"
+ />
+
+ <LinearLayout
+ android:id="@+id/advanced_search_filter_container"
+ android:layout_below="@id/advanced_spinner_index"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+
+ <EditText
+ android:id="@+id/advanced_search_text"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:hint="@string/advanced_search_hint"
+ android:singleLine="true"
+ />
+
+
+ <Button
+ android:id="@+id/advanced_search_add_filter_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/advanced_search_add_filter_button"
+ />
+
+
+ </LinearLayout>
+
+ <ScrollView
+ android:id="@+id/advanced_search_scrollview"
+ android:layout_width="fill_parent"
+ android:layout_height="100dip"
+ android:layout_below="@id/advanced_search_filter_container"
+ android:background="@drawable/rounded_contentbox"
+ >
+
+ <LinearLayout
+ android:id="@+id/advanced_search_filters"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+
+ <TextView
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:text="@string/advanced_search_filter_text"
+ />
+
+ </LinearLayout>
+ </ScrollView>
+
+
+ <Button
+ android:id="@+id/advanced_search_cancel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/advanced_search_scrollview"
+ android:text="@string/cancel"
+ />
+
+
+ <Button
+ android:id="@+id/advanced_search_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/advanced_search_scrollview"
+ android:layout_toRightOf="@id/advanced_search_cancel"
+ android:text="@string/advanced_search"
+
+ />
+
+
+
+</RelativeLayout>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
-
-
- <Spinner
- android:id="@+id/advanced_spinner_index"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:entries="@array/advanced_search_index"
- />
-
- <Spinner
- android:id="@+id/advanced_spinner_option"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:entries="@array/advanced_search_options"
- android:layout_toRightOf="@id/advanced_spinner_index"
- />
-
- <LinearLayout
- android:id="@+id/advanced_search_filter_container"
- android:layout_below="@id/advanced_spinner_index"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
-
- <EditText
- android:id="@+id/advanced_search_text"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:hint="@string/advanced_search_hint"
- android:singleLine="true"
- />
-
-
- <Button
- android:id="@+id/advanced_search_add_filter_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/advanced_search_add_filter_button"
- />
-
-
- </LinearLayout>
-
- <ScrollView
- android:id="@+id/advanced_search_scrollview"
- android:layout_width="fill_parent"
- android:layout_height="100dip"
- android:layout_below="@id/advanced_search_filter_container"
- >
-
- <LinearLayout
- android:id="@+id/advanced_search_filters"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@color/white"
- >
-
- <TextView
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="@string/advanced_search_filter_text"
- />
-
- </LinearLayout>
- </ScrollView>
-
-
- <Button
- android:id="@+id/advanced_search_cancel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/advanced_search_scrollview"
- android:text="cancel"
- />
-
-
- <Button
- android:id="@+id/advanced_search_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/advanced_search_scrollview"
- android:layout_toRightOf="@id/advanced_search_cancel"
- android:text="search"
-
- />
-
-</RelativeLayout>
\ No newline at end of file
<string-array name="advanced_search_index">
<item>Keyword</item>
<item>Title</item>
- <item>Author</item>
+ <item>Suthor</item>
<item>Subject</item>
<item>Series</item>
</string-array>
<string name="password">Password: </string>
- <string name="cancel_button">cancel</string>
- <string name="connect_button">connect</string>
+ <string name="cancel_button">Cancel</string>
+ <string name="connect_button">Connect</string>
<string name="search_hint">What are you looking for?</string>
+ <string name="advanced_search">Search</string>
+
<string name="advanced_search_hint">Enter text here</string>
<string name="advanced_search_add_filter_button">Add filter</string>
<string name="advanced_search_filter_text">Added filters:</string>
--- /dev/null
+package org.evergreen.android.searchCatalog;
+
+import java.util.StringTokenizer;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.views.AccountScreenDashboard;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+public class AdvancedSearchActivity extends Activity{
+
+ private String TAG = "AdvancedSearchActivity";
+
+ private AccountAccess accountAccess = null;
+
+ private Context context;
+
+ private ImageButton homeButton;
+
+ private Button myAccountButton;
+
+ private TextView headerTitle;
+
+ private StringBuilder advancedSearchFormattedText;
+
+ public static final int RESULT_ADVANCED_SEARCH = 10;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.advanced_search);
+
+
+ //header portion actions
+ homeButton = (ImageButton) findViewById(R.id.library_logo);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
+ headerTitle = (TextView) findViewById(R.id.header_title);
+ headerTitle.setText(R.string.advanced_search);
+
+ advancedSearchFormattedText = new StringBuilder();
+
+ myAccountButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getApplicationContext(),AccountScreenDashboard.class);
+ startActivity(intent);
+ }
+ });
+
+ homeButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getApplicationContext(),SearchCatalogListView.class);
+ startActivity(intent);
+ }
+ });
+ //end header portion actions
+
+ context = this;
+
+ final LinearLayout layout = (LinearLayout) findViewById(R.id.advanced_search_filters);
+
+ Button addFilter = (Button) findViewById(R.id.advanced_search_add_filter_button);
+
+ final Spinner search_index = (Spinner) findViewById(R.id.advanced_spinner_index);
+ final Spinner search_option = (Spinner) findViewById(R.id.advanced_spinner_option);
+ final EditText search_filter_text = (EditText) findViewById(R.id.advanced_search_text);
+
+ addFilter.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ int searchOptionVal = search_option.getSelectedItemPosition();
+
+ String searchText = search_index.getSelectedItem().toString().toLowerCase() + ": ";
+
+ advancedSearchFormattedText.append(search_index.getSelectedItem().toString().toLowerCase() + ": ");
+
+ switch(searchOptionVal){
+
+ case 0 : {
+ //contains
+ advancedSearchFormattedText.append(search_filter_text.getText().toString());
+ searchText = searchText + search_filter_text.getText().toString();
+ }break;
+ case 1 : {
+ //excludes
+
+ StringTokenizer str = new StringTokenizer(search_filter_text.getText().toString());
+
+ while(str.hasMoreTokens()){
+ String token = str.nextToken(" ");
+ advancedSearchFormattedText.append(" -"+token);
+ searchText = searchText + " -"+token;
+ }
+
+ }break;
+ case 2 : {
+ //matches exactly
+ advancedSearchFormattedText.append(" \"" + search_filter_text.getText().toString() + "\"");
+ searchText = searchText + " \"" + search_filter_text.getText().toString() + "\"";
+ }break;
+
+ }
+
+ TextView text = new TextView(context);
+ text.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
+ text.setText(searchText);
+ layout.addView(text);
+
+ }
+ });
+
+ Button cancel = (Button) findViewById(R.id.advanced_search_cancel);
+
+ cancel.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ }
+ });
+
+ Button search = (Button) findViewById(R.id.advanced_search_button);
+
+ search.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra("advancedSearchText",advancedSearchFormattedText.toString());
+ setResult(RESULT_ADVANCED_SEARCH,returnIntent);
+ finish();
+ }
+ });
+
+ }
+
+}
@Override
public void onClick(View v) {
//show advanced view dialog
-
- final Dialog dialog = new Dialog(context);
- dialog.setContentView(R.layout.advanced_search_dialog);
- dialog.setTitle("Advanced search");
-
- final LinearLayout layout = (LinearLayout) dialog.findViewById(R.id.advanced_search_filters);
-
- Button addFilter = (Button) dialog.findViewById(R.id.advanced_search_add_filter_button);
-
- final Spinner search_index = (Spinner) dialog.findViewById(R.id.advanced_spinner_index);
- final Spinner search_option = (Spinner) dialog.findViewById(R.id.advanced_spinner_option);
- final EditText search_filter_text = (EditText) dialog.findViewById(R.id.advanced_search_text);
-
- addFilter.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- TextView text = new TextView(context);
- text.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
- text.setText(search_index.getSelectedItem().toString() + " " + search_option.getSelectedItem().toString() + " " + search_filter_text.getText().toString());
- layout.addView(text);
-
- }
- });
-
-
- Button cancel = (Button) dialog.findViewById(R.id.advanced_search_cancel);
-
- cancel.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- dialog.dismiss();
- }
- });
- dialog.setCancelable(true);
- dialog.show();
+ Intent advancedSearch = new Intent(context,AdvancedSearchActivity.class);
+ startActivityForResult(advancedSearch, 2);
}
});
//get bookbags
searchOptionsMenu = findViewById(R.id.search_preference_options);
- // Creating a button - Load More
- Button btnLoadMore = new Button(this);
- btnLoadMore.setText("Load More");
-
- // Adding button to listview at footer
- //lv.addFooterView(btnLoadMore);
-
- View footerView = findViewById(R.layout.search_result_footer_view);
- //call before set adapter
- //lv.addFooterView(footerView);
-
- //System.out.println("Here it is " + lv);
-
progressDialog = new ProgressDialog(context);
progressDialog.setMessage("Fetching data");
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo;
menu.setHeaderTitle("Options");
- menu.add(Menu.NONE, DETAILS,0,"Details");
- menu.add(Menu.NONE,PLACE_HOLD,1,"Place Hold");
- menu.add(Menu.NONE,BOOK_BAG,2,"Add to bookbag");
+ menu.add(Menu.NONE, DETAILS,0,"Details");
+ menu.add(Menu.NONE,PLACE_HOLD,1,"Place Hold");
+ menu.add(Menu.NONE,BOOK_BAG,2,"Add to bookbag");
}
}
return super.onContextItemSelected(item);
}
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+ switch(resultCode){
+
+ case AdvancedSearchActivity.RESULT_ADVANCED_SEARCH : {
+ Log.d(TAG, "result text"+data.getStringExtra("advancedSearchText"));
+ searchText.setText(data.getStringExtra("advancedSearchText"));
+ Thread searchThread = new Thread(searchForResultsRunnable);
+ searchThread.start();
+ } break;
+
+ }
+ }
class SearchArrayAdapter extends ArrayAdapter<RecordInfo> {
private static final String tag = "SearchArrayAdapter";
private ProgressBar progressBar;
-
private String TAG = "SplashActivity";
@Override
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-
- Log.d(TAG, "Result code return " + resultCode);
-
switch(resultCode){
-
case ConfigureApplicationActivity.RESULT_CONFIGURE_SUCCESS : {
new LoadingTask(progressBar, this, this, progressText, this).execute("download");