<activity android:name=".searchCatalog.RecordDetails"></activity>
<activity android:name=".searchCatalog.RecordDetails_Simple"></activity>
+ <!-- Bookbags -->
+ <activity android:name=".accountAccess.bookbags.BookbagsListView"></activity>
</application>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/search_result_text"
+ />
+
+ <TextView
+ android:id="@+id/search_result_number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textStyle="bold"
+ />
+
+ </LinearLayout>
+
+ <ListView
+ android:id="@+id/checkout_items_list"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ ></ListView>
+
+</LinearLayout>
\ 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="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="left|center"
+ android:paddingBottom="3dip"
+ android:paddingTop="3dip"
+ android:paddingLeft="3dip"
+ android:orientation="horizontal" >
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:paddingLeft="5dip"
+ android:layout_alignParentLeft="true"
+ >
+
+
+
+ <TextView
+ android:id="@+id/bookbag_name"
+ style="@style/TitleSearchStyleList"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:id="@+id/bookbag_items"
+ style="@style/AuthorSearchStyleList"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+
+
+ <TextView
+ android:id="@+id/bookbag_shared"
+ style="@style/PubSearchStyleList"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+
+ </LinearLayout>
+ <Button
+ android:id="@+id/renew_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/delete_button"
+ android:layout_gravity="right"
+ android:layout_alignParentRight="true"
+ />
+
+</RelativeLayout>
\ No newline at end of file
android:layout_height="fill_parent"
android:orientation="vertical" >
-
- <LinearLayout android:layout_width="fill_parent"
+ <LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textStyle="bold"
/>
- </LinearLayout>
+ </LinearLayout>
<ListView
- android:id="@+id/checkout_items_list"
+ android:id="@+id/bookbag_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- ></ListView>
+ >
+
+ </ListView>
</LinearLayout>
\ No newline at end of file
<string name="balance_owed">Balance Owed</string>
<string name="overdue_materials">Overdue Materials</string>
+ <!-- Bookbag Activities -->
+ <string name="delete_button">delete</string>
+
</resources>
\ No newline at end of file
import java.util.List;
import java.util.Map;
+import org.evergreen.android.accountAccess.bookbags.BookBag;
+import org.evergreen.android.accountAccess.bookbags.BookBagItem;
import org.evergreen.android.accountAccess.checkout.CircRecord;
import org.evergreen.android.accountAccess.fines.FinesRecord;
import org.evergreen.android.accountAccess.holds.HoldRecord;
//---------------------------------------Book bags-----------------------------------//
- public Object getBookbags()
+ public ArrayList<BookBag> getBookbags()
throws SessionNotFoundException, NoNetworkAccessException, NoAccessToServer{
Object response = Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FLESH_CONTAINERS, authToken, cm, new Object[]{authToken,userID,"biblio","bookbag"});
List<OSRFObject> bookbags = (List<OSRFObject>)response;
+ ArrayList<BookBag> bookBagObj = new ArrayList<BookBag>();
+
for(int i=0;i<bookbags.size();i++){
- getBookbagContent(bookbags.get(i).getInt("id"));
- }
-
+ BookBag bag = new BookBag(bookbags.get(i));
+ getBookbagContent(bag,bookbags.get(i).getInt("id"));
- return bookbags;
+ bookBagObj.add(bag);
+ }
+ return bookBagObj;
}
- private Object getBookbagContent(Integer bookbagID)
+ private Object getBookbagContent(BookBag bag, Integer bookbagID)
throws SessionNotFoundException, NoNetworkAccessException, NoAccessToServer{
- return Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FLESH_PUBLIC_CONTAINER, authToken, cm, new Object[]{authToken,"biblio",bookbagID});
+ Map<String,?> map =(Map<String,?>) Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FLESH_PUBLIC_CONTAINER, authToken, cm, new Object[]{authToken,"biblio",bookbagID});
+
+ List<OSRFObject> items =(List<OSRFObject>) map.get("items");
+
+ for(int i=0;i<items.size();i++){
+
+ BookBagItem bookBagItem = new BookBagItem(items.get(i));
+
+ bag.items.add(bookBagItem);
+ }
+
+ return items;
}
}
--- /dev/null
+package org.evergreen.android.accountAccess.bookbags;
+
+import java.util.ArrayList;
+
+import org.opensrf.util.OSRFObject;
+
+public class BookBag {
+
+ public int id;
+
+ public String name = null;
+
+ public String description = null;
+
+ public String shared = null;
+
+ public ArrayList<BookBagItem> items = null;
+
+ public BookBag(OSRFObject object){
+
+ this.id = object.getInt("id");
+ this.name = object.getString("name");
+ this.description = object.getString("description");
+ this.items = new ArrayList<BookBagItem>();
+
+
+ String pub_visible = object.getString("pub");
+
+ if(pub_visible.equals("f"))
+ this.shared = "false";
+ else
+ this.shared = "true";
+ }
+
+}
--- /dev/null
+package org.evergreen.android.accountAccess.bookbags;
+
+import org.opensrf.util.OSRFObject;
+
+public class BookBagItem {
+
+ public int target_copy;
+
+ public BookBagItem(OSRFObject cbrebi){
+
+
+ this.target_copy = cbrebi.getInt("target_biblio_record_entry");
+ }
+}
--- /dev/null
+package org.evergreen.android.accountAccess.bookbags;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.accountAccess.MaxRenewalsException;
+import org.evergreen.android.accountAccess.SessionNotFoundException;
+import org.evergreen.android.accountAccess.checkout.CircRecord;
+import org.evergreen.android.globals.NoAccessToServer;
+import org.evergreen.android.globals.NoNetworkAccessException;
+import org.evergreen.android.globals.Utils;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class BookbagsListView extends Activity{
+
+ private String TAG = "BookBags";
+
+ private AccountAccess accountAccess = null;
+
+ private ListView lv;
+
+ private BookBagsArrayAdapter listAdapter = null;
+
+ private ArrayList<BookBag> bookBags = null;
+
+ private Context context;
+
+ private ProgressDialog progressDialog;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.checkout_list);
+
+ context = this;
+ accountAccess = AccountAccess.getAccountAccess();
+ lv = (ListView) findViewById(R.id.bookbag_list);
+ bookBags = new ArrayList<BookBag>();
+ listAdapter = new BookBagsArrayAdapter(context, R.layout.bookbag_list_item, bookBags);
+ lv.setAdapter(listAdapter);
+
+ Thread getBookBags = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+
+ try {
+ bookBags = accountAccess.getBookbags();
+
+ } catch (NoNetworkAccessException e) {
+ Utils.showNetworkNotAvailableDialog(context);
+ } catch (NoAccessToServer e) {
+ Utils.showServerNotAvailableDialog(context);
+
+ }catch (SessionNotFoundException e) {
+ //TODO other way?
+ try{
+ if(accountAccess.authenticate())
+ accountAccess.getBookbags();
+ }catch(Exception eauth){
+ System.out.println("Exception in reAuth");
+ }
+ }
+
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ for(int i=0;i<bookBags.size();i++)
+ listAdapter.add(bookBags.get(i));
+
+
+ progressDialog.dismiss();
+
+ if(bookBags.size() == 0)
+ Toast.makeText(context, "No circ records", Toast.LENGTH_LONG);
+
+ listAdapter.notifyDataSetChanged();
+ }
+ });
+
+
+ }
+ });
+
+
+ if(accountAccess.isAuthenticated()){
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setMessage("Please wait while retrieving Book Bag data");
+ progressDialog.show();
+ getBookBags.start();
+
+ }
+ else
+ Toast.makeText(context, "You must be authenticated to retrieve circ records", Toast.LENGTH_LONG);
+
+
+
+
+ }
+
+ class BookBagsArrayAdapter extends ArrayAdapter<BookBag> {
+ private static final String tag = "BookbagArrayAdapter";
+
+ private TextView name;
+ private TextView items;
+ private TextView shared;
+
+
+ private List<BookBag> records = new ArrayList<BookBag>();
+
+ public BookBagsArrayAdapter(Context context, int textViewResourceId,
+ List<BookBag> objects) {
+ super(context, textViewResourceId, objects);
+ this.records = objects;
+ }
+
+ public int getCount() {
+ return this.records.size();
+ }
+
+ public BookBag getItem(int index) {
+ return this.records.get(index);
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View row = convertView;
+
+ // Get item
+ final BookBag record = getItem(position);
+
+
+ //if it is the right type of view
+ if (row == null ) {
+
+ Log.d(tag, "Starting XML Row Inflation ... ");
+ LayoutInflater inflater = (LayoutInflater) this.getContext()
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ row = inflater.inflate(R.layout.bookbag_list_item, parent, false);
+ Log.d(tag, "Successfully completed XML Row Inflation!");
+
+ }
+
+ name = (TextView) row.findViewById(R.id.bookbag_name);
+
+ items = (TextView) row.findViewById(R.id.bookbag_items);
+
+ shared = (TextView) row.findViewById(R.id.bookbag_shared);
+
+ name.setText(record.name+"");
+
+ items.setText("items :" + record.items.size());
+
+ shared.setText(record.shared);
+
+ return row;
+ }
+ }
+}
package org.evergreen.android.views;
import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.bookbags.BookbagsListView;
import org.evergreen.android.accountAccess.checkout.ItemsCheckOutListView;
import org.evergreen.android.accountAccess.fines.FinesActivity;
import org.evergreen.android.accountAccess.holds.HoldsListView;
startActivity (new Intent(getApplicationContext(), FinesActivity.class));
break;
case R.id.account_btn_book_bags :
- //startActivity (new Intent(getApplicationContext(), F6Activity.class));
+ startActivity (new Intent(getApplicationContext(), BookbagsListView.class));
break;
default:
break;