From: drizea Date: Thu, 5 Jul 2012 22:56:04 +0000 (+0300) Subject: Fines partial info view added (no UI design, only info) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=76b414802e9a366a00fa7a4de994daed4128b80c;p=working%2FEvergreen.git Fines partial info view added (no UI design, only info) --- diff --git a/Open-ILS/src/Android/AndroidManifest.xml b/Open-ILS/src/Android/AndroidManifest.xml index cdda9c9763..10fe06fef7 100644 --- a/Open-ILS/src/Android/AndroidManifest.xml +++ b/Open-ILS/src/Android/AndroidManifest.xml @@ -39,18 +39,23 @@ - + + + + + + \ No newline at end of file diff --git a/Open-ILS/src/Android/bin/EvergreenApp.apk b/Open-ILS/src/Android/bin/EvergreenApp.apk index 2fc67114e4..a1ea8cc8aa 100644 Binary files a/Open-ILS/src/Android/bin/EvergreenApp.apk and b/Open-ILS/src/Android/bin/EvergreenApp.apk differ diff --git a/Open-ILS/src/Android/bin/classes.dex b/Open-ILS/src/Android/bin/classes.dex index 3f44d14469..7f5725863d 100644 Binary files a/Open-ILS/src/Android/bin/classes.dex and b/Open-ILS/src/Android/bin/classes.dex differ diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$id.class index 1df1557888..63bf8f274e 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$layout.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$layout.class index 026ddf8ef5..d2968ba3a5 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$string.class index 2e854693a5..5af3b3a748 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/R$style.class index 05641cd96c..fd2bb4dfc1 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/accountAccess/AccountAccess.class index de535e08d6..74119eb89d 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Info.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Info.class index 04d288ff34..0a04014c5d 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Simple.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/RecordDetails_Simple.class index eb7a51ee32..735df0901c 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView$SearchArrayAdapter.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView$SearchArrayAdapter.class index 795fe1d0e4..ba15cccd65 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/searchCatalog/SearchCatalogListView.class index 9a0a685a8a..32c35ab5a7 100644 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 diff --git a/Open-ILS/src/Android/bin/classes/org/evergreen/android/views/AccountScreenDashboard.class b/Open-ILS/src/Android/bin/classes/org/evergreen/android/views/AccountScreenDashboard.class index 3d1666a321..de374778f3 100644 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 diff --git a/Open-ILS/src/Android/bin/resources.ap_ b/Open-ILS/src/Android/bin/resources.ap_ index f5588e20a0..7501804f1d 100644 Binary files a/Open-ILS/src/Android/bin/resources.ap_ and b/Open-ILS/src/Android/bin/resources.ap_ differ diff --git a/Open-ILS/src/Android/gen/org/evergreen/android/R.java b/Open-ILS/src/Android/gen/org/evergreen/android/R.java index 2458fb71a3..f1ad2a62da 100644 --- a/Open-ILS/src/Android/gen/org/evergreen/android/R.java +++ b/Open-ILS/src/Android/gen/org/evergreen/android/R.java @@ -52,78 +52,84 @@ public final class R { public static final int account_btn_check_out=0x7f090007; public static final int account_btn_fines=0x7f090009; public static final int account_btn_holds=0x7f090008; - public static final int action_bar=0x7f090010; - public static final int back_button=0x7f090011; - public static final int cancel_hold=0x7f090021; - public static final int cancel_hold_button=0x7f090012; + public static final int action_bar=0x7f090014; + public static final int back_button=0x7f090015; + public static final int cancel_hold=0x7f090025; + public static final int cancel_hold_button=0x7f090016; public static final int checkout_due_date=0x7f090005; public static final int checkout_items_list=0x7f090001; 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=0x7f090036; - public static final int header=0x7f09000e; - public static final int header_title=0x7f09000f; - public static final int hold_author=0x7f090016; - public static final int hold_contact_telephone=0x7f090018; - public static final int hold_enable_email_notification=0x7f09001a; - public static final int hold_enable_phone_notification=0x7f090019; - public static final int hold_expiration_date=0x7f09001c; - public static final int hold_physical_description=0x7f090017; - public static final int hold_pickup_location=0x7f09001b; - public static final int hold_recipient=0x7f090014; - public static final int hold_status=0x7f090020; - public static final int hold_suspend_hold=0x7f09001d; - public static final int hold_thaw_date=0x7f090023; - public static final int hold_title=0x7f090015; - public static final int holds_item_list=0x7f09001f; - public static final int holds_number=0x7f09001e; + public static final int chose_organisation=0x7f09003a; + public static final int fined_balance_owed=0x7f090010; + public static final int fines_overdue_materials_list=0x7f090011; + public static final int fines_total_owned=0x7f09000e; + public static final int fines_total_paid=0x7f09000f; + public static final int header=0x7f090012; + public static final int header_title=0x7f090013; + public static final int hold_author=0x7f09001a; + public static final int hold_contact_telephone=0x7f09001c; + public static final int hold_enable_email_notification=0x7f09001e; + public static final int hold_enable_phone_notification=0x7f09001d; + public static final int hold_expiration_date=0x7f090020; + public static final int hold_physical_description=0x7f09001b; + public static final int hold_pickup_location=0x7f09001f; + public static final int hold_recipient=0x7f090018; + public static final int hold_status=0x7f090024; + public static final int hold_suspend_hold=0x7f090021; + public static final int hold_thaw_date=0x7f090027; + public static final int hold_title=0x7f090019; + public static final int holds_item_list=0x7f090023; + public static final int holds_number=0x7f090022; 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 place_hold=0x7f090022; - public static final int record_details_info_author=0x7f090025; - public static final int record_details_info_publisher=0x7f090026; - public static final int record_details_info_title=0x7f090024; - public static final int record_details_simple_author=0x7f090028; - public static final int record_details_simple_isbn=0x7f09002d; - public static final int record_details_simple_publisher=0x7f090029; - public static final int record_details_simple_series=0x7f09002b; - public static final int record_details_simple_subject=0x7f09002a; - public static final int record_details_simple_synopsis=0x7f09002c; - public static final int record_details_simple_title=0x7f090027; + public static final int place_hold=0x7f090026; + public static final int record_details_info_author=0x7f090029; + public static final int record_details_info_publisher=0x7f09002a; + public static final int record_details_info_title=0x7f090028; + public static final int record_details_simple_author=0x7f09002c; + public static final int record_details_simple_isbn=0x7f090031; + public static final int record_details_simple_publisher=0x7f09002d; + public static final int record_details_simple_series=0x7f09002f; + public static final int record_details_simple_subject=0x7f09002e; + public static final int record_details_simple_synopsis=0x7f090030; + public static final int record_details_simple_title=0x7f09002b; public static final int renew_button=0x7f090006; - public static final int searchButton=0x7f090034; - public static final int searchText=0x7f090033; - public static final int search_more_items_button=0x7f09002e; - public static final int search_record_author=0x7f090031; - public static final int search_record_img=0x7f09002f; - public static final int search_record_publishing=0x7f090032; - public static final int search_record_title=0x7f090030; + public static final int searchButton=0x7f090038; + public static final int searchText=0x7f090037; + public static final int search_more_items_button=0x7f090032; + public static final int search_record_author=0x7f090035; + public static final int search_record_img=0x7f090033; + public static final int search_record_publishing=0x7f090036; + public static final int search_record_title=0x7f090034; public static final int search_result_number=0x7f090000; - public static final int search_results_list=0x7f090035; - public static final int update_hold_button=0x7f090013; + public static final int search_results_list=0x7f090039; + public static final int update_hold_button=0x7f090017; } 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 hold_details=0x7f030004; - public static final int holds_list=0x7f030005; - public static final int holds_list_item=0x7f030006; - public static final int main=0x7f030007; - public static final int place_hold=0x7f030008; - public static final int record_details_info=0x7f030009; - public static final int record_details_simple=0x7f03000a; - public static final int search_result_footer_view=0x7f03000b; - public static final int search_result_item=0x7f03000c; - public static final int search_result_list=0x7f03000d; + public static final int fines=0x7f030004; + public static final int hold_details=0x7f030005; + public static final int holds_list=0x7f030006; + public static final int holds_list_item=0x7f030007; + public static final int main=0x7f030008; + public static final int place_hold=0x7f030009; + public static final int record_details_info=0x7f03000a; + public static final int record_details_simple=0x7f03000b; + public static final int search_result_footer_view=0x7f03000c; + public static final int search_result_item=0x7f03000d; + public static final int search_result_list=0x7f03000e; } public static final class string { public static final int app_name=0x7f070001; public static final int author=0x7f07000d; public static final int back=0x7f070019; + public static final int balance_owed=0x7f07001f; public static final int cancel=0x7f070017; public static final int cancel_hold=0x7f070018; public static final int cancel_hold_dialog_message=0x7f07001b; @@ -151,6 +157,10 @@ public final class R { public static final int title_holds=0x7f070006; public static final int title_my_account=0x7f070003; public static final int title_search=0x7f070002; + /** Fines Activity + */ + public static final int total_owned=0x7f07001d; + public static final int total_paid=0x7f07001e; public static final int update_hold=0x7f07001a; } public static final class style { diff --git a/Open-ILS/src/Android/res/layout/fines.xml b/Open-ILS/src/Android/res/layout/fines.xml new file mode 100644 index 0000000000..6be2116cfa --- /dev/null +++ b/Open-ILS/src/Android/res/layout/fines.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Open-ILS/src/Android/res/layout/search_result_item.xml b/Open-ILS/src/Android/res/layout/search_result_item.xml index aba6b727fc..045d5402e6 100644 --- a/Open-ILS/src/Android/res/layout/search_result_item.xml +++ b/Open-ILS/src/Android/res/layout/search_result_item.xml @@ -1,6 +1,6 @@ Update Hold Are you sure you want to cancel this hold? Automatically activate hold one + + + + Total Owned + Total Paid + Balance Owed + \ No newline at end of file diff --git a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/AccountAccess.java b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/AccountAccess.java index 15e05fa22d..cbd6ec3655 100644 --- a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/AccountAccess.java +++ b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/AccountAccess.java @@ -8,6 +8,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.evergreen.android.accountAccess.checkout.CircRecord; import org.evergreen.android.accountAccess.holds.HoldRecord; import org.evergreen.android.globals.Utils; import org.evergreen.android.searchCatalog.RecordInfo; @@ -824,16 +825,17 @@ public class AccountAccess { ahr.put("usr", userID); ahr.put("requestor", userID); + //TODO //do not set hold type, the systems knows the hold type - //ahr.put("hold_type", "T"); + ahr.put("hold_type", null); ahr.put("pickup_lib", pickup_lib); //pick-up lib - ahr.put("phone_notify", phone); - ahr.put("email_notify", email_notify); - ahr.put("expire_time",expire_time); + //ahr.put("phone_notify", phone); + //ahr.put("email_notify", email_notify); + //ahr.put("expire_time",expire_time); //frozen set, what this means ? ahr.put("frozen", suspendHold); //only if it is frozen - ahr.put("thaw_date",thaw_date); + //ahr.put("thaw_date",thaw_date); //extra parameters (not mandatory for hold creation) @@ -894,11 +896,21 @@ public class AccountAccess { //----------------------------Fines Summary------------------------------------// - public OSRFObject getFinesSummary(){ + public float[] getFinesSummary(){ + //mous object OSRFObject finesSummary = (OSRFObject) Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FETCH_FINES_SUMMARY, new Object[]{authToken,userID}); - return finesSummary; + float fines[] = new float[3]; + try{ + fines[0] = Float.parseFloat(finesSummary.getString("total_owed")); + fines[1] = Float.parseFloat(finesSummary.getString("total_paid")); + fines[2] = Float.parseFloat(finesSummary.getString("balance_owed")); + }catch(Exception e){ + System.err.println("Exception in parsing fines " + e.getMessage()); + } + + return fines; } private Object getTransactions(){ @@ -908,6 +920,8 @@ public class AccountAccess { return transactions; } + //---------------------------------------Book bags-----------------------------------// + public Object getBookbags(){ Object response = Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FLESH_CONTAINERS, new Object[]{authToken,userID,"biblio","bookbag"}); diff --git a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/CircRecord.java b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/CircRecord.java deleted file mode 100644 index e606cb68c0..0000000000 --- a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/CircRecord.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.evergreen.android.accountAccess; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.evergreen.android.globals.GlobalConfigs; -import org.opensrf.util.OSRFObject; - -/** - * This is a wrapper class that get the information out for a circ object - * @author daniel - * - */ -public class CircRecord { - - public static final int MVR_OBJ_TYPE = 1; - public static final int ACP_OBJ_TYPE = 2; - public static final int UNDEF_OBJ_TYPE = 0; - - public OSRFObject mvr = null; - - public OSRFObject acp = null; - - public OSRFObject circ = null; - - public int circ_info_type = UNDEF_OBJ_TYPE; - - public int circ_type; - - public static final int OUT = 0; - public static final int CLAIMS_RETURNED = 1; - public static final int LONG_OVERDUE = 2; - public static final int OVERDUE = 3; - public static final int LOST = 4; - - public int circ_id = -1; - - private Date circ_due_date = null; - - public CircRecord(OSRFObject circ, OSRFObject mvr, OSRFObject acp, int circ_type, int circ_id) { - - this.circ = circ; - - //one of the acp or mvr will be null this will determine the circ OSRFObject type - this.acp = acp; - this.mvr = mvr; - - if(this.acp != null) - this.circ_info_type = ACP_OBJ_TYPE; - - if(this.mvr != null) - this.circ_info_type = MVR_OBJ_TYPE; - - this.circ_type = circ_type; - this.circ_id = circ_id; - //parse due date - parseDate(circ); - } - - public CircRecord(OSRFObject circ,int circ_type, int circ_id){ - this.circ = circ; - this.circ_type = circ_type; - this.circ_id = circ_id; - //parse due date - parseDate(circ); - } - - public String getAuthor(){ - - String author = null; - - if(this.circ_info_type == MVR_OBJ_TYPE) - author = mvr.getString("author"); - if(this.circ_info_type == ACP_OBJ_TYPE) - author = acp.getString("dummy_author"); - - return author; - } - - - public String getDueDate(){ - - return circ_due_date.toLocaleString(); - } - - public String getTitle(){ - - String title = null; - - if(this.circ_info_type == MVR_OBJ_TYPE) - title = mvr.getString("title"); - if(this.circ_info_type == ACP_OBJ_TYPE) - title = acp.getString("dummy_title"); - - return title; - } - - public Integer getRenewals(){ - - if(circ != null) - return circ.getInt("renewal_remaining"); - - return null; - } - - public Integer getTargetCopy(){ - if(circ != null) - return circ.getInt("target_copy"); - - return null; - } - - private void parseDate(OSRFObject circ){ - - 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/ItemsCheckOutListView.java b/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/ItemsCheckOutListView.java deleted file mode 100644 index b6fa40b2ac..0000000000 --- a/Open-ILS/src/Android/src/org/evergreen/android/accountAccess/ItemsCheckOutListView.java +++ /dev/null @@ -1,230 +0,0 @@ -package org.evergreen.android.accountAccess; - -import java.util.ArrayList; -import java.util.List; - -import org.evergreen.android.R; - -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 ItemsCheckOutListView extends Activity{ - - private String TAG = "ItemsCheckOutListView"; - - private AccountAccess accountAccess = null; - - private ListView lv; - - private CheckOutArrayAdapter listAdapter = null; - - private ArrayList circRecords = 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.checkout_items_list); - circRecords = new ArrayList(); - listAdapter = new CheckOutArrayAdapter(context, R.layout.checkout_list_item, circRecords); - lv.setAdapter(listAdapter); - - Thread getCirc = new Thread(new Runnable() { - - @Override - public void run() { - - circRecords = accountAccess.getItemsCheckedOut(); - - runOnUiThread(new Runnable() { - - @Override - public void run() { - for(int i=0;i { - private static final String tag = "CheckoutArrayAdapter"; - - private TextView recordTitle; - private TextView recordAuthor; - private TextView recordDueDate; - private TextView recordRenewals; - private TextView renewButton; - - private List records = new ArrayList(); - - public CheckOutArrayAdapter(Context context, int textViewResourceId, - List 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 - recordTitle = (TextView) row.findViewById(R.id.checkout_record_title); - - // Get reference to TextView - author - recordAuthor = (TextView) row.findViewById(R.id.checkout_record_author); - - //Get reference to TextView - record Publisher date+publisher - recordDueDate = (TextView) row.findViewById(R.id.checkout_due_date); - - //Get remaining renewals - recordRenewals = (TextView) row.findViewById(R.id.checkout_renewals_remaining); - - renewButton = (TextView) row.findViewById(R.id.renew_button); - - renewButton.setText("renew : " + record.getRenewals()); - - renewButton.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - - Thread renew = new Thread(new Runnable() { - - @Override - public void run() { - boolean refresh = true; - AccountAccess ac = AccountAccess.getAccountAccess(); - - runOnUiThread(new Runnable() { - @Override - public void run() { - progressDialog = new ProgressDialog(context); - progressDialog.setMessage("Renew item please wait."); - progressDialog.show(); - } - }); - - try{ - ac.renewCirc(record.getTargetCopy()); - }catch(MaxRenewalsException e){ - runOnUiThread(new Runnable() { - - @Override - public void run() { - progressDialog.dismiss(); - Toast.makeText(context, "Max renewals reached", Toast.LENGTH_SHORT).show(); - } - }); - - refresh = false; - } - if(refresh){ - circRecords = accountAccess.getItemsCheckedOut(); - listAdapter.clear(); - for(int i=0;i circRecords = 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.checkout_items_list); + circRecords = new ArrayList(); + listAdapter = new CheckOutArrayAdapter(context, R.layout.checkout_list_item, circRecords); + lv.setAdapter(listAdapter); + + Thread getCirc = new Thread(new Runnable() { + + @Override + public void run() { + + circRecords = accountAccess.getItemsCheckedOut(); + + runOnUiThread(new Runnable() { + + @Override + public void run() { + for(int i=0;i { + private static final String tag = "CheckoutArrayAdapter"; + + private TextView recordTitle; + private TextView recordAuthor; + private TextView recordDueDate; + private TextView recordRenewals; + private TextView renewButton; + + private List records = new ArrayList(); + + public CheckOutArrayAdapter(Context context, int textViewResourceId, + List 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 + recordTitle = (TextView) row.findViewById(R.id.checkout_record_title); + + // Get reference to TextView - author + recordAuthor = (TextView) row.findViewById(R.id.checkout_record_author); + + //Get reference to TextView - record Publisher date+publisher + recordDueDate = (TextView) row.findViewById(R.id.checkout_due_date); + + //Get remaining renewals + recordRenewals = (TextView) row.findViewById(R.id.checkout_renewals_remaining); + + renewButton = (TextView) row.findViewById(R.id.renew_button); + + renewButton.setText("renew : " + record.getRenewals()); + + renewButton.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + + Thread renew = new Thread(new Runnable() { + + @Override + public void run() { + boolean refresh = true; + AccountAccess ac = AccountAccess.getAccountAccess(); + + runOnUiThread(new Runnable() { + @Override + public void run() { + progressDialog = new ProgressDialog(context); + progressDialog.setMessage("Renew item please wait."); + progressDialog.show(); + } + }); + + try{ + ac.renewCirc(record.getTargetCopy()); + }catch(MaxRenewalsException e){ + runOnUiThread(new Runnable() { + + @Override + public void run() { + progressDialog.dismiss(); + Toast.makeText(context, "Max renewals reached", Toast.LENGTH_SHORT).show(); + } + }); + + refresh = false; + } + if(refresh){ + circRecords = accountAccess.getItemsCheckedOut(); + listAdapter.clear(); + for(int i=0;i selectedOrgPos) + selectedOrgID = globalConfigs.organisations.get(selectedOrgPos).id; + accountAccess.createHold(record_id,selectedOrgID,email_notification.isChecked(),phone_notification.isChecked(),phone_number.getText().toString(),suspendHold.isChecked(),expire_date_s,thaw_date_s); } }); - phone_notification.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override @@ -168,8 +174,8 @@ public class PlaceHold extends Activity{ int monthOfYear, int dayOfMonth) { - - Date chosenDate = new Date(year, monthOfYear,dayOfMonth); + + Date chosenDate = new Date(year-1900, monthOfYear,dayOfMonth); expire_date = chosenDate; CharSequence strDate = DateFormat.format("MMMM dd, yyyy", chosenDate); expiration_date.setText(strDate); @@ -190,11 +196,11 @@ public class PlaceHold extends Activity{ int monthOfYear, int dayOfMonth) { - - Date chosenDate = new Date(year, monthOfYear,dayOfMonth); + + Date chosenDate = new Date(year-1900, monthOfYear,dayOfMonth); thaw_date = chosenDate; CharSequence strDate = DateFormat.format("MMMM dd, yyyy", chosenDate); - expiration_date.setText(strDate); + thaw_date_edittext.setText(strDate); //set current date }}, cal.get(Calendar.YEAR),cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH)); @@ -206,20 +212,30 @@ public class PlaceHold extends Activity{ } }); - + ArrayList list = new ArrayList(); + for(int i=0;i adapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item,list); orgSelector.setAdapter(adapter); - - orgSelector.setSelection(); - orgSelectorn.setOnItemSelectedListener(new OnItemSelectedListener() { + orgSelector.setSelection(selectedOrgPos); + + orgSelector.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int ID, long arg3) { - //select the specific organization - search.selectOrganisation(globalConfigs.organisations.get(ID)); + + selectedOrgPos = ID; } + + public void onNothingSelected(android.widget.AdapterView arg0) { + } + }); } public void disableView(View view){ diff --git a/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java b/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java index 8fe52100a9..a681d895ef 100644 --- a/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java +++ b/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java @@ -33,7 +33,7 @@ public class GlobalConfigs { //to parse date from requests public static final String datePattern = "yyyy-MM-dd'T'hh:mm:ssZ"; - + /** The locale. */ public String locale = "en-US"; diff --git a/Open-ILS/src/Android/src/org/evergreen/android/views/AccountScreenDashboard.java b/Open-ILS/src/Android/src/org/evergreen/android/views/AccountScreenDashboard.java index 86dc83a4cd..fae20d0866 100644 --- a/Open-ILS/src/Android/src/org/evergreen/android/views/AccountScreenDashboard.java +++ b/Open-ILS/src/Android/src/org/evergreen/android/views/AccountScreenDashboard.java @@ -2,7 +2,8 @@ package org.evergreen.android.views; import org.evergreen.android.R; -import org.evergreen.android.accountAccess.ItemsCheckOutListView; +import org.evergreen.android.accountAccess.checkout.ItemsCheckOutListView; +import org.evergreen.android.accountAccess.fines.FinesActivity; import org.evergreen.android.accountAccess.holds.HoldsListView; import android.app.Activity; @@ -118,7 +119,7 @@ public class AccountScreenDashboard extends Activity { startActivity (new Intent(getApplicationContext(), HoldsListView.class)); break; case R.id.account_btn_fines : - //startActivity (new Intent(getApplicationContext(), F5Activity.class)); + startActivity (new Intent(getApplicationContext(), FinesActivity.class)); break; case R.id.account_btn_book_bags : //startActivity (new Intent(getApplicationContext(), F6Activity.class));