Android Open Source - UniversalImagePick Main Activity






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. ja v  a 2 s  . co  m
import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;

import com.luffyjet.universalimagepick.widget.CropImageView;

public class MainActivity extends Activity {

  Button cutBtn;
  CropImageView maskView;
  public static Bitmap mBitmap;
  private String path = "/mnt/sdcard/";
  protected int i;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // ?????
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // ?????
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
    cutBtn = (Button) findViewById(R.id.cut_btn);
    maskView = (CropImageView) findViewById(R.id.maskview);

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.a402645);

    maskView.setImageBitmap(bitmap);

    cutBtn.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        i++;
        File file = new File(path+"crop_"+i+".jpg");
        Uri uri = maskView.saveCropBitmap(file);
        Intent intent = new Intent(MainActivity.this, Test.class);
        intent.putExtra("uri", uri);
        startActivity(intent);
      }
    });
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
  }
}




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