Android Open Source - UniversalImagePick Test






From Project

Back to project page UniversalImagePick.

License

The source code is released under:

Apache License

If you think the Android project UniversalImagePick listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.luffyjet.universalimagepick;
/*ww w .jav  a2 s.  c  o m*/
import java.io.File;

import com.luffyjet.universalimagepick.utils.LogUtil;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.Toast;

public class Test extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
//    Bitmap bitmap = MainActivity.mBitmap;
    Intent intent = getIntent();
    Uri uri = intent.getParcelableExtra("uri");
    File file = new File(uri.getPath());
    
    Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
    
    long size =  file.length()/1024;
    LogUtil.showLog("???????: "+size+"K");

    ImageView imageView = new ImageView(this);
    imageView.setScaleType(ScaleType.CENTER);
    imageView.setImageBitmap(bitmap);
    setContentView(imageView);

//    Toast.makeText(this, bitmap.getWidth() + "/" + bitmap.getHeight() + " size: " + size, 3000).show();
  }

  public long getBitmapsize(Bitmap bitmap) {

//    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
//      return bitmap.getByteCount();
//    }
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
  }
}




Java Source Code List

com.luffyjet.universalimagepick.App.java
com.luffyjet.universalimagepick.Constants.java
com.luffyjet.universalimagepick.MainActivity.java
com.luffyjet.universalimagepick.Test.java
com.luffyjet.universalimagepick.adapter.BucketAdapter.java
com.luffyjet.universalimagepick.adapter.GalleryAdapter.java
com.luffyjet.universalimagepick.adapter.PickGridAdapter.java
com.luffyjet.universalimagepick.adapter.PreviewAdapter.java
com.luffyjet.universalimagepick.adapter.ResultAdapter.java
com.luffyjet.universalimagepick.model.ImageBucket.java
com.luffyjet.universalimagepick.model.Image.java
com.luffyjet.universalimagepick.model.ImagesHelper.java
com.luffyjet.universalimagepick.model.Thumbnail.java
com.luffyjet.universalimagepick.ui.BaseActivity.java
com.luffyjet.universalimagepick.ui.GalleryActivity.java
com.luffyjet.universalimagepick.ui.PickActivity.java
com.luffyjet.universalimagepick.utils.LogUtil.java
com.luffyjet.universalimagepick.widget.CropImageView.java
com.luffyjet.universalimagepick.widget.CustomGridView.java
com.luffyjet.universalimagepick.widget.MulitPointTouchListener.java
com.luffyjet.universalimagepick.widget.ViewfinderView.java