work started on holds list view
authordrizea <danielrizea27@gmail.com>
Tue, 3 Jul 2012 13:28:32 +0000 (16:28 +0300)
committerdrizea <danielrizea27@gmail.com>
Tue, 3 Jul 2012 13:28:32 +0000 (16:28 +0300)
27 files changed:
Open-ILS/src/Android/AndroidManifest.xml
Open-ILS/src/Android/bin/EvergreenApp.apk
Open-ILS/src/Android/bin/classes.dex
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$layout.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/globals/GlobalConfigs.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/globals/Utils.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Info.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Simple.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView$SearchArrayAdapter.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView.class
Open-ILS/src/Android/bin/classes/org/evergreen/android/views/AccountScreenDashboard.class
Open-ILS/src/Android/bin/resources.ap_
Open-ILS/src/Android/gen/org/evergreen/android/R.java
Open-ILS/src/Android/res/layout/holds_list.xml [new file with mode: 0644]
Open-ILS/src/Android/res/layout/holds_list_item.xml [new file with mode: 0644]
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/AccountAccess.java
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/CircRecord.java
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/HoldItem.java [new file with mode: 0644]
Open-ILS/src/Android/src/org/evergreen/android/accountAccess/HoldsListView.java [new file with mode: 0644]
Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java
Open-ILS/src/Android/src/org/evergreen/android/globals/Utils.java
Open-ILS/src/Android/src/org/evergreen/android/views/AccountScreenDashboard.java
Open-ILS/src/Android/src/org/evergreen/android/views/ApplicationPreferences.java

index f7e108d..236824c 100644 (file)
@@ -41,6 +41,8 @@
         <!-- Checkout Activities -->
         <activity android:name=".accountAccess.ItemsCheckOutListView"></activity>
         
+        <!-- Holds Activities -->
+        <activity android:name=".accountAccess.HoldsListView"></activity>
         
         <activity android:name=".searchCatalog.RecordDetails_Info"></activity>
                <activity android:name=".searchCatalog.RecordDetails_Content"></activity>
index 3a5081f..715dc55 100644 (file)
Binary files a/Open-ILS/src/Android/bin/EvergreenApp.apk and b/Open-ILS/src/Android/bin/EvergreenApp.apk differ
index 2cc778e..5d557a2 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes.dex and b/Open-ILS/src/Android/bin/classes.dex differ
index dccadd7..36831ef 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class differ
index 8c8ff71..d7c621d 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$layout.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$layout.class differ
index 56a2da5..73eaa73 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class differ
index fe1bd3f..1907398 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class differ
index 24522e2..5dba9b7 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class differ
index 93cf34d..6511d14 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/globals/GlobalConfigs.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/globals/GlobalConfigs.class differ
index 833b2ed..f77d4d7 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/globals/Utils.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/globals/Utils.class differ
index 18a743f..349270f 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Info.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Info.class differ
index 763aeb6..a0ce90c 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Simple.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Simple.class differ
index 45826cb..93bea92 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView$SearchArrayAdapter.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView$SearchArrayAdapter.class differ
index 8507896..18e33a8 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView.class differ
index ad50b41..6ddf31c 100644 (file)
Binary files a/Open-ILS/src/Android/bin/classes/org/evergreen/android/views/AccountScreenDashboard.class and b/Open-ILS/src/Android/bin/classes/org/evergreen/android/views/AccountScreenDashboard.class differ
index ff9fb22..97cf74f 100644 (file)
Binary files a/Open-ILS/src/Android/bin/resources.ap_ and b/Open-ILS/src/Android/bin/resources.ap_ differ
index fcd4b07..1f9bbe8 100644 (file)
@@ -57,42 +57,51 @@ public final class R {
         public static final int checkout_record_author=0x7f090003;
         public static final int checkout_record_title=0x7f090002;
         public static final int checkout_renewals_remaining=0x7f090004;
-        public static final int chose_organisation=0x7f090020;
+        public static final int chose_organisation=0x7f090027;
+        public static final int hold_active=0x7f090013;
+        public static final int hold_author=0x7f090011;
+        public static final int hold_expiration_date=0x7f090014;
+        public static final int hold_status=0x7f090012;
+        public static final int hold_title=0x7f090010;
+        public static final int holds_item_list=0x7f09000f;
+        public static final int holds_number=0x7f09000e;
         public static final int main_btn_account=0x7f09000c;
         public static final int main_btn_app_settings=0x7f09000d;
         public static final int main_btn_search=0x7f09000b;
-        public static final int record_details_info_author=0x7f09000f;
-        public static final int record_details_info_publisher=0x7f090010;
-        public static final int record_details_info_title=0x7f09000e;
-        public static final int record_details_simple_author=0x7f090012;
-        public static final int record_details_simple_isbn=0x7f090017;
-        public static final int record_details_simple_publisher=0x7f090013;
-        public static final int record_details_simple_series=0x7f090015;
-        public static final int record_details_simple_subject=0x7f090014;
-        public static final int record_details_simple_synopsis=0x7f090016;
-        public static final int record_details_simple_title=0x7f090011;
+        public static final int record_details_info_author=0x7f090016;
+        public static final int record_details_info_publisher=0x7f090017;
+        public static final int record_details_info_title=0x7f090015;
+        public static final int record_details_simple_author=0x7f090019;
+        public static final int record_details_simple_isbn=0x7f09001e;
+        public static final int record_details_simple_publisher=0x7f09001a;
+        public static final int record_details_simple_series=0x7f09001c;
+        public static final int record_details_simple_subject=0x7f09001b;
+        public static final int record_details_simple_synopsis=0x7f09001d;
+        public static final int record_details_simple_title=0x7f090018;
         public static final int renew_button=0x7f090006;
-        public static final int searchButton=0x7f09001e;
-        public static final int searchText=0x7f09001d;
-        public static final int search_more_items_button=0x7f090018;
-        public static final int search_record_author=0x7f09001b;
-        public static final int search_record_img=0x7f090019;
-        public static final int search_record_publishing=0x7f09001c;
-        public static final int search_record_title=0x7f09001a;
+        public static final int searchButton=0x7f090025;
+        public static final int searchText=0x7f090024;
+        public static final int search_more_items_button=0x7f09001f;
+        public static final int search_record_author=0x7f090022;
+        public static final int search_record_img=0x7f090020;
+        public static final int search_record_publishing=0x7f090023;
+        public static final int search_record_title=0x7f090021;
         public static final int search_result_number=0x7f090000;
-        public static final int search_results_list=0x7f09001f;
+        public static final int search_results_list=0x7f090026;
     }
     public static final class layout {
         public static final int checkout_list=0x7f030000;
         public static final int checkout_list_item=0x7f030001;
         public static final int dashbord_account=0x7f030002;
         public static final int dashbord_main=0x7f030003;
-        public static final int main=0x7f030004;
-        public static final int record_details_info=0x7f030005;
-        public static final int record_details_simple=0x7f030006;
-        public static final int search_result_footer_view=0x7f030007;
-        public static final int search_result_item=0x7f030008;
-        public static final int search_result_list=0x7f030009;
+        public static final int holds_list=0x7f030004;
+        public static final int holds_list_item=0x7f030005;
+        public static final int main=0x7f030006;
+        public static final int record_details_info=0x7f030007;
+        public static final int record_details_simple=0x7f030008;
+        public static final int search_result_footer_view=0x7f030009;
+        public static final int search_result_item=0x7f03000a;
+        public static final int search_result_list=0x7f03000b;
     }
     public static final class string {
         public static final int app_name=0x7f070001;
diff --git a/Open-ILS/src/Android/res/layout/holds_list.xml b/Open-ILS/src/Android/res/layout/holds_list.xml
new file mode 100644 (file)
index 0000000..b03267e
--- /dev/null
@@ -0,0 +1,29 @@
+<?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/holds_number"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:textStyle="bold"
+             />
+         
+     </LinearLayout>
+     
+       <ListView 
+         android:id="@+id/holds_item_list"
+         android:layout_width="fill_parent"
+         android:layout_height="wrap_content"  
+       ></ListView>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/Open-ILS/src/Android/res/layout/holds_list_item.xml b/Open-ILS/src/Android/res/layout/holds_list_item.xml
new file mode 100644 (file)
index 0000000..3c0a85c
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+    
+
+    <TextView 
+     android:layout_width="wrap_content"   
+     android:layout_height="wrap_content"
+     android:id="@+id/hold_title"   
+        />
+    
+     <TextView 
+     android:layout_width="wrap_content"   
+     android:layout_height="wrap_content"
+     android:id="@+id/hold_author"
+     android:layout_below="@+id/hold_title"   
+        />
+    
+        
+     <TextView 
+     android:layout_width="wrap_content"   
+     android:layout_height="wrap_content"
+     android:id="@+id/hold_status"
+     android:layout_below="@+id/hold_author"   
+        />   
+    
+     <TextView 
+     android:layout_width="wrap_content"   
+     android:layout_height="wrap_content"
+     android:id="@+id/hold_active"
+     android:layout_below="@+id/hold_status"   
+        />   
+    
+          <TextView 
+     android:layout_width="wrap_content"   
+     android:layout_height="wrap_content"
+     android:id="@+id/hold_expiration_date"
+     android:layout_below="@+id/hold_active"   
+        />  
+     
+    
+</RelativeLayout>
\ No newline at end of file
index 89212b3..f2d22b9 100644 (file)
@@ -111,11 +111,11 @@ public class AccountAccess {
        /** The METHOD_FETCH_MRMODS
         * 
         */
-       // if holdtype == M
+       // if holdtype == M  return mvr OSRFObject
        public static String METHOD_FETCH_MRMODS = "open-ils.search.biblio.metarecord.mods_slim.retrieve";
-       // if holdtype == T
+       // if holdtype == T return mvr OSRFObject
        public static String METHOD_FETCH_RMODS = "open-ils.search.biblio.records.mods_slim.retrieve";
-       //if hold type V
+       //if hold type V 
        public static String METHOD_FETCH_VOLUME = "open-ils.search.asset.call_number.retrieve";
        //if hold type I
        public static String METHOD_FETCH_ISSUANCE = "open-ils.serial.issuance.pub_fleshed.batch.retrieve";
@@ -601,23 +601,34 @@ public class AccountAccess {
        
        
        
-       public void getHolds(){
+       public List<HoldItem> getHolds(){
 
+               
+               ArrayList<HoldItem> holds = new ArrayList<HoldItem>();
+               
+               //fields of interest : expire_time
                List<OSRFObject> listHoldsAhr = null;
                
                // holds description for each hold
                List<OSRFObject> listHoldsMvr = null;
                
                //status of holds, fields like : potential_copies, status, total_holds, queue_position, estimated_wait
-               List<HashMap<String,Integer>> listHoldsStatus = null; 
-
-               listHoldsAhr = (List<OSRFObject>) Utils.doRequest(conn, SERVICE_CIRC, METHOD_FETCH_HOLDS, new Object[]{authToken,userID});
+               List<HashMap<String,Integer>> listHoldsStatus = null;
                
-               for(int i=0;i<listHoldsAhr.size();i++){
-                       fetchHoldTitleInfo(listHoldsAhr.get(i));
-                       fetchHoldStatus(listHoldsAhr.get(i));
-               }
+               listHoldsAhr = (List<OSRFObject>) Utils.doRequest(conn, SERVICE_CIRC, METHOD_FETCH_HOLDS, new Object[]{authToken,userID});
                
+               //for(int i=0;i<listHoldsAhr.size();i++){
+                       //create hold item
+                       HoldItem hold = new HoldItem(listHoldsAhr.get(0));
+                       //get title 
+                       fetchHoldTitleInfo(listHoldsAhr.get(0), hold);
+                       
+                       //get status 
+                       fetchHoldStatus(listHoldsAhr.get(0),hold);
+                       
+                       holds.add(hold);
+               //}
+               return holds;
        }
        
        /* hold target type :
@@ -629,7 +640,7 @@ public class AccountAccess {
         *  P - pat
         */
        
-       private Object fetchHoldTitleInfo(OSRFObject holdArhObject){
+       private Object fetchHoldTitleInfo(OSRFObject holdArhObject, HoldItem hold){
                
                
                String holdType = (String)holdArhObject.get("hold_type");
@@ -647,11 +658,15 @@ public class AccountAccess {
                        
                        holdInfo = Utils.doRequest(conn,SERVICE_SEARCH, method, new Object[]{holdArhObject.get("target")});
 
+                       System.out.println("Hold here " + holdInfo);
+                       ((OSRFObject)holdInfo).getString("title");
+                       ((OSRFObject)holdInfo).getString("author");
+                       
                }
                else{
                                //multiple objects per hold ????
                                holdInfo = holdFetchObjects(holdArhObject);
-;
+
                        }
                return holdInfo;
        }
@@ -702,12 +717,15 @@ public class AccountAccess {
        }
        
        
-       public Object fetchHoldStatus(OSRFObject hold){
+       public Object fetchHoldStatus(OSRFObject hold, HoldItem holdObj){
                
                Integer hold_id = hold.getInt("id");
                // MAP : potential_copies, status, total_holds, queue_position, estimated_wait
                Object hold_status = Utils.doRequest(conn,SERVICE_CIRC, METHOD_FETCH_HOLD_STATUS, new Object[]{authToken,hold_id});
        
+               //get status
+               holdObj.status = ((Map<String,Integer>)hold_status).get("status");
+               
                return hold_status;
        }
        
index 83be720..e606cb6 100644 (file)
@@ -4,6 +4,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.evergreen.android.globals.GlobalConfigs;
 import org.opensrf.util.OSRFObject;
 
 /**
@@ -35,8 +36,6 @@ public class CircRecord {
        
        public int circ_id = -1;
        
-       private static final String datePattern = "yyyy-MM-dd'T'hh:mm:ssZ";
-       
        private Date circ_due_date = null;
        
        public CircRecord(OSRFObject circ, OSRFObject mvr, OSRFObject acp, int circ_type, int circ_id) {
@@ -114,18 +113,9 @@ public class CircRecord {
        
        private void parseDate(OSRFObject circ){
                
-               final SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
-        
-               if(circ.getString("due_date") != null)
-                       try
-               {
-                   this.circ_due_date = sdf.parse(circ.getString("due_date"));
-                   System.out.println(this.circ_due_date);
-               } 
-               catch (ParseException e)
-               {
-                   e.printStackTrace();
-               }
+               this.circ_due_date = GlobalConfigs.parseDate(circ.getString("due_date"));
+               System.out.println(this.circ_due_date);
+
        }
        
 }
diff --git a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/HoldItem.java b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/HoldItem.java
new file mode 100644 (file)
index 0000000..40dbb2c
--- /dev/null
@@ -0,0 +1,75 @@
+package org.evergreen.android.accountAccess;
+
+import java.util.Date;
+
+import org.evergreen.android.globals.GlobalConfigs;
+import org.opensrf.util.OSRFObject;
+
+public class HoldItem {
+
+       //metarecord
+       public static final int M = 0;
+       //record
+       public static final int T = 1;
+       //volume
+       public static final int V = 2;
+       //issuance
+       public static final int I = 3;
+       //copy
+       public static final int C = 4;
+       //part
+       public static final int P = 5;
+       
+       private Integer requestLibID = null; 
+       
+       private Integer pickupLibID = null;
+       
+       public Integer holdType = null;
+       //id for target object
+       public Integer target = null;
+       public Date expire_time = null;
+       
+       public String title = null;
+       
+       public String author = null;
+       
+       
+       /* Hold status 
+       *  holdStatus == 4 => AVAILABLE
+       *  holdStatus == 3 => WAITING
+       *  holdStatus <= 3 => TRANSIT 
+       */
+       
+       public Integer status = null;
+       
+       public Boolean active = null;
+       
+       public HoldItem(OSRFObject ahr){
+               
+               this.target = ahr.getInt("target");
+               String type = ahr.getString("hold_type");
+               
+               if(type.equals("M")){
+                       holdType = M;
+               }else
+                       if(type.equals("T")){
+                               holdType = T;
+                       }else
+                               if(type.equals("V")){
+                                       holdType = V;
+                               }else
+                                       if(type.equals("I")){
+                                               holdType = I;
+                                       }else
+                                               if(type.equals("C")){
+                                                       holdType = C;
+                                               }else
+                                                       if(type.equals("P"))
+                                                               holdType = P;
+       
+               this.expire_time = GlobalConfigs.parseDate(ahr.getString("expire_time"));
+                                               
+       }
+       
+       
+}
diff --git a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/HoldsListView.java b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/HoldsListView.java
new file mode 100644 (file)
index 0000000..51d5d1b
--- /dev/null
@@ -0,0 +1,143 @@
+package org.evergreen.android.accountAccess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.ItemsCheckOutListView.CheckOutArrayAdapter;
+
+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.ViewGroup;
+import android.view.View.OnClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class HoldsListView extends Activity{
+
+       private String TAG = "HoldsListView";
+       
+       private AccountAccess accountAccess = null;
+       
+       private ListView lv;
+       
+       private HoldsArrayAdapter listAdapter = null;
+
+       private ArrayList<CircRecord> holdRecords = null;
+
+       private Context context;
+       
+       private ProgressDialog progressDialog;
+       @Override
+       protected void onCreate(Bundle savedInstanceState) {
+               super.onCreate(savedInstanceState);
+               
+               setContentView(R.layout.holds_list);
+               
+               context = this;
+               accountAccess = AccountAccess.getAccountAccess();
+               
+               accountAccess.getHolds();
+               /*
+               lv = (ListView) findViewById(R.id.checkout_items_list);
+               
+               holdRecords = new ArrayList<CircRecord>();
+               listAdapter = new HoldsArrayAdapter(context, R.layout.holds_list_item, holdRecords);
+               lv.setAdapter(listAdapter);
+               */
+               
+               
+       }
+       
+       
+       class HoldsArrayAdapter extends ArrayAdapter<CircRecord> {
+       private static final String tag = "CheckoutArrayAdapter";
+       
+       private TextView holdTitle;
+       private TextView holdAuthor;
+       private TextView expirationDate;
+       private TextView status;
+       private TextView active;
+       
+       private List<CircRecord> records = new ArrayList<CircRecord>();
+
+       public HoldsArrayAdapter(Context context, int textViewResourceId,
+                       List<CircRecord> objects) {
+               super(context, textViewResourceId, objects);
+               this.records = objects;
+       }
+
+       public int getCount() {
+               return this.records.size();
+       }
+
+       public CircRecord getItem(int index) {
+               return this.records.get(index);
+       }
+
+       public View getView(int position, View convertView, ViewGroup parent) {
+               View row = convertView;
+               
+               // Get item
+               final CircRecord record = getItem(position);
+               
+               
+               if(record == null)
+               {
+                               Log.d(tag, "Starting XML view more infaltion ... ");
+                       LayoutInflater inflater = (LayoutInflater) this.getContext()
+                                       .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+                       row = inflater.inflate(R.layout.search_result_footer_view, parent, false);
+                       Log.d(tag, "Successfully completed XML view more Inflation!");
+
+                       
+                       }
+               else{
+               
+                       //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.checkout_list_item, parent, false);
+                                               Log.d(tag, "Successfully completed XML Row Inflation!");
+       
+                               }
+
+                       // Get reference to TextView - title
+                       holdTitle = (TextView) row.findViewById(R.id.hold_title);
+                       
+                       // Get reference to TextView author
+                       holdAuthor = (TextView) row.findViewById(R.id.hold_author);
+                       
+                       //Get hold expiration date
+                       expirationDate = (TextView) row.findViewById(R.id.hold_expiration_date);
+           
+                       //Get hold status
+                       status = (TextView) row.findViewById(R.id.hold_status);
+                       
+                       active = (TextView) row.findViewById(R.id.hold_active);
+                       
+                       
+                       //set text
+                       /*
+                       System.out.println("Row" + record.getTitle() + " " + record.getAuthor() + " " + record.getDueDate() + " " + record.getRenewals());
+                       recordTitle.setText(record.getTitle());
+                       recordAuthor.setText(record.getAuthor());
+                       recordDueDate.setText(record.getDueDate());
+                       recordRenewals.setText(record.getRenewals()+"");
+                       */
+               }
+               
+               return row;
+       }
+    }
+}
index a5fc6f1..c3b88b2 100644 (file)
@@ -1,7 +1,10 @@
 package org.evergreen.android.globals;
 
 import java.io.InputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.StringTokenizer;
 
 import org.evergreen.android.accountAccess.AccountAccess;
@@ -9,7 +12,6 @@ import org.evergreen.android.searchCatalog.Organisation;
 import org.evergreen.android.views.ApplicationPreferences;
 import org.open_ils.idl.IDLParser;
 
-import android.app.AlertDialog;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -29,6 +31,9 @@ public class GlobalConfigs {
        
        public static boolean loadedOrgTree = false;
        
+       //to parse date from requests
+       public static final String datePattern = "yyyy-MM-dd'T'hh:mm:ssZ";
+       
        /** The locale. */
        public String locale = "en-US";  
        
@@ -65,30 +70,36 @@ public class GlobalConfigs {
                        init = true;
                        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
                        GlobalConfigs.httpAddress = preferences.getString("library_url", "");
-                       
+                       boolean noNetworkAccess = false;
                        System.out.println("Check for network conenctivity");
                        try{
                                Utils.checkNetworkStatus((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE), context);
-                       }catch(NoNetworkAccessException e){
                                
+                       }catch(NoNetworkAccessException e){
+                               noNetworkAccess = true;
                        }catch(NoAccessToHttpAddress e){
 
                                System.out.println("No access to network");
                                Intent preferencesAnctivity = new Intent(context, ApplicationPreferences.class);
                                context.startActivity(preferencesAnctivity);
+                               
+                               noNetworkAccess = true;
+                               
                        }
+                       if(!noNetworkAccess){
+                               loadIDLFile();
+                               getOrganisations();
                        
-                       loadIDLFile();
-                       getOrganisations();
-               
-                       AccountAccess.setAccountInfo(preferences.getString("username", ""), preferences.getString("password", ""));
-                       
-                       
-                       //authenticate
-                       AccountAccess ac = AccountAccess.getAccountAccess(GlobalConfigs.httpAddress);
-                       ac.authenticate();
-                       
-                       return true;
+                               AccountAccess.setAccountInfo(preferences.getString("username", ""), preferences.getString("password", ""));
+                               
+                               
+                               //authenticate
+                               AccountAccess ac = AccountAccess.getAccountAccess(GlobalConfigs.httpAddress);
+                               ac.authenticate();
+                               
+                               return true;
+                       }
+                       return false;
                }
                return false;
        }
@@ -251,4 +262,26 @@ public class GlobalConfigs {
                        loadedOrgTree = true;
                }
        }
+       //parse from opac methods query results to Java date
+       public static Date parseDate(String dateString){
+               
+               if(dateString == null)
+                       return null;
+               
+               Date date = null;
+               final SimpleDateFormat sdf = new SimpleDateFormat(GlobalConfigs.datePattern);
+        
+                       try
+               {
+                   date = sdf.parse(dateString);
+                   System.out.println(date);
+               } 
+               catch (ParseException e)
+               {
+                   e.printStackTrace();
+               }
+                       
+                       return date;
+       }
+       
 }
index 13b41eb..10b63ad 100644 (file)
@@ -230,7 +230,7 @@ public class Utils {
                        method.addParam(params[i]);
                        System.out.print("Param "+i+":" + params[i]);
                }
-               System.out.println();
+               System.out.println("Request to method " + methodName + " service " + service + " conn " + conn);
                //sync request
                HttpRequest req = new GatewayRequest(conn, service, method).send();
                Object resp;
@@ -248,7 +248,7 @@ public class Utils {
                                                
                                        }
                                }catch(Exception e){
-                                       
+                                       System.err.println("Exception in retreive" + e.getMessage());
                                }
                                return response;
                        
index 30c20e7..7d2ce98 100644 (file)
@@ -2,6 +2,7 @@
 package org.evergreen.android.views;
 
 import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.HoldsListView;
 import org.evergreen.android.accountAccess.ItemsCheckOutListView;
 
 import android.app.Activity;
@@ -114,7 +115,7 @@ public class AccountScreenDashboard extends Activity {
                   startActivity (new Intent(getApplicationContext(),ItemsCheckOutListView.class));
                   break;
              case R.id.account_btn_holds:
-                  //startActivity (new Intent(getApplicationContext(), F4Activity.class));
+                  startActivity (new Intent(getApplicationContext(), HoldsListView.class));
                   break;
              case R.id.account_btn_fines :
                   //startActivity (new Intent(getApplicationContext(), F5Activity.class));
index 6b91e11..e470e05 100644 (file)
@@ -160,8 +160,7 @@ public class ApplicationPreferences extends PreferenceActivity implements OnShar
                                                }
                                        });
                        }
-               });
-               
+               });     
                
                if(key.equals("username")){
                        AccountAccess.userName = sharedPreferences.getString("username", "");