--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:state_focused="true" android:color="@color/dark">
+ </item>
+ <item android:state_pressed="true" android:color="@color/dark">
+ </item>
+ <item android:color="@color/white">
+ </item>
+</selector>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true">
+ <shape>
+ <gradient android:startColor="@color/light_green"
+ android:endColor="@color/light_green" android:angle="270" />
+ <corners android:radius="5dp" />
+ <stroke android:width="1dp" android:color="@color/button_stroke"/>
+ <padding android:left="4dp" android:top="4dp" android:right="4dp" android:bottom="4dp" />
+ </shape>
+ </item>
+ <item android:state_focused="true">
+ <shape>
+ <gradient android:endColor="@color/light_green"
+ android:startColor="@color/light_green" android:angle="270" />
+ <corners android:radius="5dp" />
+ <stroke android:width="1dp" android:color="@color/button_stroke"/>
+ <padding android:left="4dp" android:top="4dp" android:right="4dp" android:bottom="4dp" />
+ </shape>
+ </item>
+ <item>
+ <shape>
+
+ <gradient android:endColor="@color/dark_green"
+ android:startColor="@color/normal_green" android:angle="270" />
+ <corners android:radius="5dp" />
+ <stroke android:width="1dp" android:color="@color/button_stroke"/>
+ <padding android:left="4dp" android:top="4dp" android:right="4dp" android:bottom="4dp" />
+ </shape>
+ </item>
+
+</selector>
<?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:layout_width="wrap_content"
+ android:layout_height="200dip"
android:orientation="vertical" >
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/bookbag_choose_text"
+ />
+
<Spinner
android:id="@+id/bookbag_spinner"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dip"
+ android:layout_marginLeft="20dip"
+ />
<Button
android:id="@+id/add_to_bookbag_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/add_button"
-
- />
+ android:text="@string/add_button"/>
</LinearLayout>
android:layout_height="match_parent" >
- <LinearLayout
- android:id="@+id/header"
- android:layout_width="fill_parent"
- android:layout_height="40dip"
- android:background="@color/blue"
- android:layout_alignParentTop="true"
- >
- <TextView
- android:id="@+id/header_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="5dip"
- android:paddingTop="5dip"
- android:textColor="@color/white"
- android:textStyle="bold"
- android:textSize="16dip"
- />
-
-
- </LinearLayout>
+ <include android:id="@+id/header_actionbar" layout="@layout/simple_actionbar"/>
+
<LinearLayout
android:id="@+id/action_bar"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_above="@id/action_bar"
- android:layout_below="@id/header"
+ android:layout_below="@id/header_actionbar"
>
<LinearLayout
android:layout_width="fill_parent"
/>
</LinearLayout>
-
-
+
+ <RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <Button
+ android:id="@+id/simple_place_hold_button"
+ style="@style/SearchDetailsActionButton"
+ android:layout_height="wrap_content"
+ android:layout_width="150dip"
+ android:layout_alignParentLeft="true"
+ android:text="@string/button_place_hold"
+ />
+
+ <Button
+ android:id="@+id/simple_add_to_bookbag_button"
+ style="@style/SearchDetailsActionButton"
+ android:layout_height="wrap_content"
+ android:layout_width="150dip"
+ android:layout_alignParentRight="true"
+ android:text="@string/button_add_to_bookbag"
+ />
+ </RelativeLayout>
<TextView
android:id="@+id/record_details_simple_copy_count"
/>
<Button
- android:id="@+id/my_acount_button"
+ android:id="@+id/my_account_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_account_button_text"
<color name="header_gradient_stop">#6F9669</color>
<color name="library_logo_text_coor">#000</color>
+
+
+ <color name="dark_green">#387962</color>
+ <color name="light_green">#E0F6E0</color>
+ <color name="normal_green">#A7EA9D</color>
+
<color name="header_title">#ffffff</color>
+ <color name="button_stroke">#aaa</color>
+
<!-- Search Details -->
<color name="dark">#000</color>
</resources>
<string name="bookbag_details_title">bookbag details</string>
<string name="fines_title">fines</string>
-
+ <string name="button_place_hold">Place Hold</string>
+ <string name="button_add_to_bookbag">Add to Bookbag</string>
<string name="server_name_dialog">http:// </string>
<string name="username">username : </string>
<string name="password">password : </string>
+ <string name="bookbag_choose_text">Choose a bookbag from the list.</string>
+
<string name="cancel_button">cancel</string>
<string name="connect_button">connect</string>
</style>
+ <style name="SearchDetailsActionButton">
+ <item name="android:background">@drawable/details_button</item>
+ <item name="android:textColor">@drawable/dark_text_color</item>
+
+ </style>
+
<style name="HeaderTitle">
<item name="android:background">@drawable/header_rounded_corners</item>
<item name="android:textSize">16dip</item>
setContentView(R.layout.bookbagitem_list);
//header portion actions
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.bookbag_details_title);
//header portion actions
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.bookbag_items_title);
//header portion actions
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.checkout_items_title);
//header portion actions
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.fines_title);
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.hold_details_title);
homeButton.setOnClickListener(new OnClickListener() {
//header portion actions
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.hold_items_title);
RecordInfo record = (RecordInfo) getIntent().getSerializableExtra("recordInfo");
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.hold_place_title);
//header portion actions
homeButton = (ImageButton) findViewById(R.id.library_logo);
- myAccountButton = (Button) findViewById(R.id.my_acount_button);
+ myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
headerTitle.setText(R.string.search_details_title);
private String TAG ="SearchCatalogListView";
- private List<RecordInfo> recordList;
+ private ArrayList<RecordInfo> recordList;
private EditText searchText;
intent.putExtra("orgID",search.selectedOrganization.id);
intent.putExtra("depth",(search.selectedOrganization.level-1));
- intent.putExtra("recordList", searchResults);
+ intent.putExtra("recordList", recordList);
intent.putExtra("recordPosition", position);
startActivity(intent);
}
});
searchText = (EditText) findViewById(R.id.searchText);
-
-
+
searchText.setOnKeyListener(new OnKeyListener() {
@Override
searchButton = (ImageButton) findViewById(R.id.searchButton);
searchButton.setOnClickListener(new OnClickListener() {
-
-
+
@Override
public void onClick(View v) {
Thread searchThread = new Thread(searchForResultsRunnable);
public void onItemSelected(AdapterView<?> arg0, View arg1,
int ID, long arg3) {
//select the specific organization
- search.selectOrganisation(globalConfigs.organisations.get(ID));
-
+ search.selectOrganisation(globalConfigs.organisations.get(ID));
}
@Override
intent.putExtra("recordInfo", info);
startActivity(intent);
- }
-
+ }
case BOOK_BAG : {
-
-
+
if(bookBags.size() > 0){
String array_spinner[] = new String[bookBags.size()];
for(int i=0;i<array_spinner.length;i++)
array_spinner[i] = bookBags.get(i).name;
-
-
+
AlertDialog.Builder builder;
-
LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.bookbag_spinner,null);
addtoBookbag.start();
}});
-
-
alertDialog.show();
s.setOnItemSelectedListener(new OnItemSelectedListener() {
}
});
-
-
}
else
Toast.makeText(context, "No bookbags", Toast.LENGTH_SHORT).show();
-
}
break;
}
.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{
recordTitle.setText(record.title);
recordAuthor.setText(record.author);
recordPublisher.setText(record.pubdate + " " + record.publisher);
- }
-
+ }
return row;
}
}
-
-}
-
-
+}
\ No newline at end of file
package org.evergreen.android.utils.ui;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.zip.Inflater;
import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.accountAccess.SessionNotFoundException;
+import org.evergreen.android.accountAccess.bookbags.BookBag;
+import org.evergreen.android.accountAccess.holds.PlaceHold;
import org.evergreen.android.globals.GlobalConfigs;
+import org.evergreen.android.globals.NoAccessToServer;
+import org.evergreen.android.globals.NoNetworkAccessException;
import org.evergreen.android.searchCatalog.CopyInformation;
import org.evergreen.android.searchCatalog.RecordInfo;
import org.evergreen.android.searchCatalog.SearchCatalog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.LinearLayout;
+import android.widget.Spinner;
import android.widget.TextView;
+import android.widget.Toast;
public class BasicDetailsFragment extends Fragment{
private TextView synopsisTextView;
private TextView isbnTextView;
- private TextView copyCountTestView;
+ private TextView copyCountTestView;
+
+ private Button placeHoldButton;
+
+ private Button addToBookbagButton;
private LinearLayout showMore;
private SearchCatalog search = null;
private GlobalConfigs gl;
+
+ private ProgressDialog progressDialog;
+
+ private Integer bookbag_selected;
+
+ private Dialog dialog;
+
+ private ArrayList<BookBag> bookBags;
//max display info
private int list_size = 3;
gl = GlobalConfigs.getGlobalConfigs(getActivity());
- LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.record_details_basic_fragment, null);
+ LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.record_details_basic_fragment,null);
+
record_header = (TextView) layout.findViewById(R.id.record_header_text);
copyCountTestView = (TextView) layout.findViewById(R.id.record_details_simple_copy_count);
subjectTextView = (TextView) layout.findViewById(R.id.record_details_simple_subject);
synopsisTextView = (TextView) layout.findViewById(R.id.record_details_simple_synopsis);
isbnTextView = (TextView) layout.findViewById(R.id.record_details_simple_isbn);
+
+ placeHoldButton = (Button) layout.findViewById(R.id.simple_place_hold_button);
+ addToBookbagButton = (Button) layout.findViewById(R.id.simple_add_to_bookbag_button);
+
+ placeHoldButton.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getActivity().getApplicationContext(),PlaceHold.class);
+ intent.putExtra("recordInfo",record);
+ startActivity(intent);
+ }
+ });
+
+ AccountAccess ac = AccountAccess.getAccountAccess();
+
+ bookBags = ac.bookBags;
+ String array_spinner[] = new String[bookBags.size()];
+
+ for(int i=0;i<array_spinner.length;i++)
+ array_spinner[i] = bookBags.get(i).name;
+
+
+ dialog = new Dialog(getActivity());
+ dialog.setContentView(R.layout.bookbag_spinner);
+ dialog.setTitle("Choose bookbag");
+ Spinner s = (Spinner) dialog.findViewById(R.id.bookbag_spinner);
+
+ Button add = (Button) dialog.findViewById(R.id.add_to_bookbag_button);
+ ArrayAdapter adapter = new ArrayAdapter(getActivity().getApplicationContext(),android.R.layout.simple_spinner_item, array_spinner);
+ s.setAdapter(adapter);
+
+ add.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ // TODO Auto-generated method stub
+ Thread addtoBookbag = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ AccountAccess ac = AccountAccess.getAccountAccess();
+ try {
+ ac.addRecordToBookBag(record.doc_id, ac.bookBags.get(bookbag_selected).id);
+ } catch (SessionNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoAccessToServer e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoNetworkAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ dialog.dismiss();
+ }
+ });
+
+ }
+ });
+ progressDialog = ProgressDialog.show(getActivity(), "Please wait", "Add to bookbag");
+ addtoBookbag.start();
+
+ }});
+ s.setOnItemSelectedListener(new OnItemSelectedListener() {
+
+ @Override
+ public void onItemSelected(AdapterView<?> arg0, View arg1,
+ int position, long arg3) {
+ bookbag_selected = position;
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> arg0) {
+ }
+
+ });
+
+
+ addToBookbagButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+ if(bookBags.size() > 0)
+ dialog.show();
+ else
+ Toast.makeText(getActivity(), "No bookbags", Toast.LENGTH_SHORT).show();
+ }
+
+ });
+ }
+ });
record_header.setText("Record " + position + "of " + total );
synopsisTextView.setText(record.synopsis);
isbnTextView.setText(record.isbn);
+
int current_org = 0;
if(search != null)
addCopyInfo(0, list_size, inflater, insertPoint);
+
return layout;
}