Skip to content

Commit

Permalink
Add 'click to view' and a couple of minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
victorssilva committed Aug 15, 2012
1 parent b626a86 commit c744361
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 4 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion simplecv-android-app/res/layout/display.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<ImageView
android:id="@+id/modifiedimage"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
android:layout_height="fill_parent"
android:clickable="true"
android:onClick="clickImage" />

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ public void onCreate(Bundle savedInstanceState) {
modifiedImage = (ImageView) findViewById(R.id.modifiedimage);
new displayImageTask().execute(modifiedImageUri);
}

public void clickImage(View view){
Intent viewImageIntent = new Intent(Intent.ACTION_VIEW);
viewImageIntent.setDataAndType(modifiedImageUri,"image/*");
startActivity(viewImageIntent);
}


public void deletePicture(View view){
File picture = new File(modifiedImageUri.getPath());
Expand Down Expand Up @@ -60,8 +67,8 @@ public Bitmap decodeFile(File f){
fis.close();

int scale = 1;
if (o.outHeight > 350 || o.outWidth > 350) { //Max size = ?
scale = (int)Math.pow(2, (int) Math.round(Math.log(300 / (double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5)));
if (o.outHeight > 350 || o.outWidth > 350) {
scale = (int)Math.pow(2, (int) Math.round(Math.log(350 / (double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5)));
}

BitmapFactory.Options o2 = new BitmapFactory.Options();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void onCreate(Bundle savedInstanceState) {
}

public File getNewPictureFile(){
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "SimpleCV"); //WHERETO? Context.DIRECTORY_PICTURES?
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "SimpleCV");
if (!mediaStorageDir.exists()){
if (!mediaStorageDir.mkdirs()){
Log.i("SimpleCV", "Failed to create directory");
Expand Down

0 comments on commit c744361

Please sign in to comment.