Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:nRike/GDG-Hackup-AndroidTitlan
- Loading branch information
Showing
8 changed files
with
100 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.source=1.6 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules/ | ||
uploads/ | ||
log.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
html | ||
body | ||
h1 Hello | ||
form(method='post',action='/newreport') | ||
input(type='file') | ||
form(method='post', action='/newreport', enctype="multipart/form-data") | ||
input(name='image', type='file') | ||
input(name='location', type='hidden') | ||
input(name='time', type='hidden') | ||
input(name='type', type='hidden') | ||
input(type='submit') Subir |
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 |
---|---|---|
@@ -1,22 +1,86 @@ | ||
package mx.androidtitlan.GDGHackup; | ||
|
||
import android.os.Bundle; | ||
import android.app.Activity; | ||
import android.app.AlertDialog; | ||
import android.content.DialogInterface; | ||
import android.content.Intent; | ||
import android.graphics.Bitmap; | ||
import android.os.Bundle; | ||
import android.provider.MediaStore; | ||
import android.util.Log; | ||
import android.view.Menu; | ||
import android.view.View; | ||
import android.view.View.OnClickListener; | ||
import android.widget.Button; | ||
import android.widget.ImageView; | ||
|
||
public class HomeActivity extends Activity { | ||
|
||
private Button button; | ||
private final int flag = 1; | ||
private ImageView imageView; | ||
private Bitmap imagenCapturada; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_home); | ||
|
||
this.button = (Button) findViewById(R.id.tomar_foto); | ||
imageView = (ImageView) findViewById(R.id.imagen_capturada); | ||
|
||
button.setOnClickListener(new OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View arg0) { | ||
tomarFoto(flag); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
getMenuInflater().inflate(R.menu.activity_home, menu); | ||
return true; | ||
} | ||
|
||
private void tomarFoto(int flag) { | ||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | ||
startActivityForResult(intent, flag); | ||
} | ||
|
||
@Override | ||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
|
||
AlertDialog dialog; | ||
|
||
if (resultCode == RESULT_CANCELED) { | ||
|
||
dialog = crearDialogo("FOTO", "Fallo al tomar la foto", "OK"); | ||
|
||
} else { | ||
imagenCapturada = (Bitmap) data.getExtras().get("data"); | ||
dialog = crearDialogo("FOTO", "Éxito al tomar la foto", "OK"); | ||
|
||
} | ||
dialog.show(); | ||
} | ||
|
||
private AlertDialog crearDialogo(String title, String msg, String buttonText) { | ||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); | ||
AlertDialog msgDialog = dialogBuilder.create(); | ||
msgDialog.setTitle(title); | ||
msgDialog.setMessage(msg); | ||
msgDialog.setButton(buttonText, new DialogInterface.OnClickListener() { | ||
@Override | ||
public void onClick(DialogInterface dialog, int idx) { | ||
dialog.dismiss(); | ||
imageView.setImageBitmap(imagenCapturada); | ||
|
||
} | ||
}); | ||
|
||
return msgDialog; | ||
} | ||
|
||
} |