-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangqiong
committed
Apr 1, 2015
1 parent
a33f076
commit 7fb85a0
Showing
23 changed files
with
958 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
|
||
|
||
![Image text](https://github.com/wqandroid/wqgallery/blob/master/app/screenshort/wqgallert.gif) | ||
![Image text](https://github.com/wqandroid/wqgallery/blob/master/app/screenshort/wqgallert1.gif) | ||
|
||
![Image text](https://github.com/wqandroid/wqgallery/blob/master/app/screenshort/Screenshot_2015-03-31-18-35-29.png) | ||
|
||
|
@@ -14,12 +14,19 @@ | |
#####2.支持多选模式 | ||
####下面是调用选择器 | ||
|
||
Intent intent=new Intent(MainActivity.this, MediaChoseActivity.class); | ||
Intent intent=new Intent(MainActivity.this, MediaChoseActivity.class); | ||
//chose_mode选择模式 0单选 1多选 | ||
intent.putExtra("chose_mode",0); | ||
//chose_mode选择模式 0单选 1多选 | ||
intent.putExtra("max_chose_count",6); | ||
//最多支持选择多少张 | ||
startActivityForResult(intent, REQUEST_IMAGE); | ||
intent.putExtra("max_chose_count",6); | ||
//是否剪裁图片(只有单选模式才有剪裁) | ||
intent.putExtra("crop",true); | ||
//输出剪裁图片的宽度 | ||
intent.putExtra("crop_image_w",720); | ||
//输出剪裁图片的高度 | ||
intent.putExtra("crop_image_h",720); | ||
startActivityForResult(intent, REQUEST_IMAGE); | ||
|
||
####在onActivityResult中获取选择的图片路径列表 | ||
|
||
ArrayList<String>paths=data.getStringArrayListExtra("data"); | ||
|
@@ -29,24 +36,24 @@ | |
|
||
|
||
|
||
###当前版本1.0.0 | ||
###当前版本1.0.1 | ||
下个版本能够在gradle引入photogallery库 | ||
|
||
1.0.1 新增单选截图模式 | ||
|
||
##Developed By | ||
#####[email protected] | ||
##License | ||
|
||
Copyright 2013 Andreas Stuetz | ||
Copyright 2013 Andreas Stuetz | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
photogallery/src/main/java/com/wq/photo/CropImageActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.wq.photo; | ||
|
||
import android.content.Intent; | ||
import android.graphics.Bitmap; | ||
import android.graphics.drawable.Drawable; | ||
import android.net.Uri; | ||
import android.os.Environment; | ||
import android.provider.MediaStore; | ||
import android.support.v7.app.ActionBarActivity; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
|
||
import com.wq.photo.widget.CropImageView; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
|
||
|
||
public class CropImageActivity extends ActionBarActivity { | ||
private String filePath; | ||
private String outFilePath; | ||
|
||
/**上传图片大小*/ | ||
public int crop_image_w=0; | ||
public int crop_image_h=0; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_crop_image); | ||
getSupportActionBar().setTitle("裁剪图片"); | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
try { | ||
crop_image_w=getIntent().getIntExtra("crop_image_w",720); | ||
crop_image_h=getIntent().getIntExtra("crop_image_h",720); | ||
Uri uri = getIntent().getData(); | ||
if("file".equals(uri.getScheme())) { | ||
filePath = uri.getPath(); | ||
outFilePath = getIntent().getStringExtra(MediaStore.EXTRA_OUTPUT); | ||
cropImage(); | ||
} | ||
} catch (Exception e) { | ||
finish(); | ||
} | ||
} | ||
|
||
private void cropImage() | ||
{ | ||
final CropImageView mCropImage=(CropImageView)findViewById(R.id.cropImg); | ||
mCropImage.setDrawable(Drawable.createFromPath(filePath), crop_image_w, crop_image_h); | ||
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
new Thread(new Runnable(){ | ||
@Override | ||
public void run() { | ||
File f= save2Storage(mCropImage.getCropImage(),getCropFile().getAbsolutePath()); | ||
Intent intent=new Intent(); | ||
intent.putExtra("crop_path",f.getAbsolutePath()); | ||
setResult(RESULT_OK, intent); | ||
finish(); | ||
} | ||
}).start(); | ||
} | ||
}); | ||
} | ||
|
||
public static File save2Storage(Bitmap bitmap, String path) { | ||
try { | ||
File filename = new File(path); | ||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); | ||
try { | ||
FileOutputStream fos = new FileOutputStream(path); | ||
fos.write(baos.toByteArray()); | ||
fos.flush(); | ||
fos.close(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return filename; | ||
} catch (Exception e) {} | ||
return null; | ||
} | ||
public File getCropFile() { | ||
File f= new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "crop.jpg"); | ||
try { | ||
f.createNewFile(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
return f; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.