/**
  * 将输入流转化为压缩过后的bitmap
  *
  * @param is
  * @return
  */
 private Bitmap compressInStreamToBitmap(InputStream is) {
   BitmapFactory.Options options = new BitmapFactory.Options();
   options.inSampleSize = 4;
   Bitmap b = null;
   try {
     b = PictureUtils.scaleCompressImage(BitmapFactory.decodeStream(is));
   } catch (Exception e) {
     e.printStackTrace();
   }
   return b;
 }
  private void showPhoto() {
    // (Re)set the image button's image based on our photo
    Photo p = mCrime.getPhoto();
    BitmapDrawable b = null;

    Log.d(TAG, "Inside showPhoto");

    if (p != null) {
      String path = getActivity().getFileStreamPath(p.getFilename()).getAbsolutePath();
      b = PictureUtils.getScaledDrawable(getActivity(), path);
    }
    mPhotoView.setImageDrawable(b);
  }
Esempio n. 3
0
 public static void insertResort() throws IllegalArgumentException, IllegalAccessException {
   final String resortName = "West Wind";
   final String address = "123 address lane";
   final String city = "lakeville";
   final String state = "MN";
   final String zip = "550044";
   final String phone = "123-123-1234";
   final String email = "*****@*****.**";
   final Resort resort = new Resort(resortName, address, city, state, zip, phone, email);
   final List<Picture> resortPictures = PictureUtils.createResortPictures(7);
   resort.addPictures(resortPictures);
   resort.insert();
 }
Esempio n. 4
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // return super.onCreateView(inflater, container, savedInstanceState);

    mImageView = new ImageView(getActivity());
    String path = (String) getArguments().getSerializable(EXTRA_IMAGE_PATH);

    BitmapDrawable bitmapDrawable = PictureUtils.getScaledDrawable(getActivity(), path);
    mImageView.setImageDrawable(bitmapDrawable);

    return mImageView;
  }
 @Override
 public void onStop() {
   super.onStop();
   PictureUtils.cleanImageView(mPhotoView);
 }
Esempio n. 6
0
 @Override
 public void onDestroyView() {
   super.onDestroyView();
   PictureUtils.cleanImageView(mImageView);
 }