</LinearLayout>
<ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:id="@+id/record_details_simple_image"
+ android:layout_width="140dip"
+ android:layout_height="180dip"
android:src="@drawable/no_image"
android:layout_marginRight="5dip"
android:layout_marginBottom="5dip"
+ android:padding="5dip"
+ android:background="@color/white"
/>
</LinearLayout>
<ImageView
android:id="@+id/search_record_img"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
+ android:layout_width="64dip"
+ android:layout_height="96dip"
android:layout_marginRight="6dip"
- android:src="@drawable/address_book"/>
+ android:src="@drawable/address_book"
+ android:padding="4dip"
+ />
private int MIN_IMG_HEIGHT = 75;
+ private int bitmap_width;
+ private int bitmap_height;
+ private boolean scale;
+
+ public ImageDownloader(int min_img_height){
+
+ MIN_IMG_HEIGHT = min_img_height;
+ }
+
+ public ImageDownloader(){
+
+ }
+
+ public ImageDownloader(int w, int h, boolean scale){
+ this.bitmap_height = h;
+ this.bitmap_width = w;
+ this.scale = scale;
+ }
/**
* Download the specified image from the Internet and binds it to the provided ImageView. The
* binding is immediate if the image is found in the cache and will be done asynchronously
// Change bitmap only if this process is still associated with it
// Or if we don't use any bitmap to task association (NO_DOWNLOADED_DRAWABLE mode)
if ((this == bitmapDownloaderTask) || (mode != Mode.CORRECT)) {
- imageView.setImageBitmap(bitmap);
+ Bitmap newScaledBitmap = null;
+ if(bitmap != null && scale == true){
+ newScaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap_width, bitmap_height, true);
+ imageView.setImageBitmap(newScaledBitmap);
+ }else{
+ imageView.setImageBitmap(bitmap);
+ }
}
if(bitmap == null){
if(imageView != null)
- imageView.setImageResource(R.drawable.address_book);
+ imageView.setImageResource(R.drawable.no_image);
}
}
Log.d(tag, "Successfully completed XML Row Inflation!");
}
-
- Log.d(TAG, "reord image value " + recordImage);
- // Get reference to ImageView
- recordImage = (ImageView) row.findViewById(R.id.search_record_img);
- //TODO fix bugs + features
- String imageHref = GlobalConfigs.httpAddress + "/opac/extras/ac/jacket/small/"+record.isbn;
- //start async download of image
- imageDownloader.download(imageHref, recordImage);
- // Get reference to TextView - title
- recordTitle = (TextView) row.findViewById(R.id.search_record_title);
-
- // Get reference to TextView - author
- recordAuthor = (TextView) row.findViewById(R.id.search_record_author);
-
- //Get referance to TextView - record Publisher date+publisher
- recordPublisher = (TextView) row.findViewById(R.id.search_record_publishing);
-
- //set text
-
- recordTitle.setText(record.title);
- recordAuthor.setText(record.author);
- recordPublisher.setText(record.pubdate + " " + record.publisher);
+
+ Log.d(TAG, "reord image value " + recordImage);
+ // Get reference to ImageView
+ recordImage = (ImageView) row.findViewById(R.id.search_record_img);
+ //TODO fix bugs + features
+ String imageHref = GlobalConfigs.httpAddress + "/opac/extras/ac/jacket/small/"+record.isbn;
+ //start async download of image
+ imageDownloader.download(imageHref, recordImage);
+ // Get reference to TextView - title
+ recordTitle = (TextView) row.findViewById(R.id.search_record_title);
+
+ // Get reference to TextView - author
+ recordAuthor = (TextView) row.findViewById(R.id.search_record_author);
+
+ //Get referance to TextView - record Publisher date+publisher
+ recordPublisher = (TextView) row.findViewById(R.id.search_record_publishing);
+
+ //set text
+
+ recordTitle.setText(record.title);
+ recordAuthor.setText(record.author);
+ recordPublisher.setText(record.pubdate + " " + record.publisher);
}
return row;
}
import org.evergreen.android.globals.NoAccessToServer;
import org.evergreen.android.globals.NoNetworkAccessException;
import org.evergreen.android.searchCatalog.CopyInformation;
+import org.evergreen.android.searchCatalog.ImageDownloader;
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.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
private Dialog dialog;
private ArrayList<BookBag> bookBags;
+
+ private final ImageDownloader imageDownloader = new ImageDownloader();
+ private ImageView recordImage;
//max display info
private int list_size = 3;
synopsisTextView = (TextView) layout.findViewById(R.id.record_details_simple_synopsis);
isbnTextView = (TextView) layout.findViewById(R.id.record_details_simple_isbn);
+ recordImage = (ImageView) layout.findViewById(R.id.record_details_simple_image);
+
placeHoldButton = (Button) layout.findViewById(R.id.simple_place_hold_button);
addToBookbagButton = (Button) layout.findViewById(R.id.simple_add_to_bookbag_button);
}
});
+ String imageHref = GlobalConfigs.httpAddress + "/opac/extras/ac/jacket/large/"+record.isbn;
+
+ //start async download of image
+ imageDownloader.download(imageHref, recordImage);
+
+
AccountAccess ac = AccountAccess.getAccountAccess();
bookBags = ac.bookBags;