Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 12 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
4 up666/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.qless.up666"
- android:versionCode="9"
- android:versionName="0.2"
+ android:versionCode="11"
+ android:versionName="0.2.2"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="4"></uses-sdk>
View
11 up666/res/values-de/strings.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
-
<string name="app_name">666up!</string>
<string name="mimeType">Kein mime Type</string>
<string name="filePath">Keine Datei</string>
@@ -21,24 +20,24 @@
<string name="errorTitleBadURL">Unverständliche Antwort</string>
<string name="errorMessageBadURL">Die Antwort von 666kb.com enthielt keine Bilder-URL. Möglicherweise ist das Bild nicht in Ordnung (666kb.com unterstützt nur: png, jpeg und gif) oder die Webseite wurde verändert. Falls dieser Fehler wiederholt bei mehreren Dateien auftritt kannst du hier einen Fehlerbericht senden.\n\nFehlerbericht jetzt senden?</string>
<string name="errorTitleBadIntent">Falscher Aufruf</string>
- <string name="errorMessageBadIntent">Die Anwendung konnte den Aurfur nicht verstehen.</string>
+ <string name="errorMessageBadIntent">Die Anwendung konnte den Aufruf nicht verstehen.</string>
<string name="errorTitle">Unerwarteter Fehler</string>
<string name="errorMessage">Irgendetwas lief schief. Wenn der Fehler weiterhin besteht kannst du helfen den Fehler zu beheben, indem du einen Fehlerbericht sendest.\n\nFehlerbericht jetzt senden?</string>
<string name="errorSendAction">Fehlerbericht senden…</string>
<string name="errorSubject">Fehlerbericht</string>
- <string name="no_uploads">Keine hochgeladenen Bilder gespeichert</string>
+ <string name="no_uploads">Willkommen!\n\nNoch keine hochgeladenen Bilder gespeichert.\n\nUm ein Bild hoch zu laden drücke die Menütaste und wähle \"Kamera\" um ein neues Bild auf zu nehmen oder \"Galerie\" um ein Bild aus der Galerie aus zu wählen.\n\nDanach wird das Bild bei 666kb.com hoch geladen und kann als Link weitergegeben werden.\n\nPraktisch für SMS oder Google Talk</string>
<string name="menu_camera">Kamera</string>
+ <string name="menu_gallery">Galerie</string>
<string name="menu_about">Über</string>
<string name="menu_preferences">Einstellungen</string>
<string name="hint_comment">Beschreibung…</string>
<string name="noPhotoToast">Kein Bild aufgenommen</string>
+ <string name="noGalleryToast">Kein Bild aufsgewählt</string>
<string name="descThumbnail">Vorschau</string>
<string name="now">Jetzt gerade</string>
<string name="buttonSave">Fertig</string>
<string name="menu_edit">Edit</string>
<string name="menu_see_original">Original anzeigen</string>
<string name="menu_delete">Entfernen</string>
- <string name="contextTitle">Link Eintrag</string>
-
-
+ <string name="contextTitle">Link Eintrag</string>
</resources>
View
7 up666/res/values/strings.xml
@@ -40,9 +40,10 @@
<string name="errorSendAction">Send error report…</string>
<string name="errorSubject">Error Report</string>
- <string name="no_uploads">There are no uploads stored in the database</string>
+ <string name="no_uploads">Welcome!\n\nThere are no uploads stored in the database yet.\n\nTo upload and share a picture press the menu button and select \"Camera\" to take a new photo or \"Gallery\" to pick a picture from your gallery.\n\nAfter that, the image is uploaded to 666kb.com and you can share it as a link.\n\nUseful for texting or Google Talk</string>
<string name="menu_camera">Camera</string>
+ <string name="menu_gallery">Gallery</string>
<string name="menu_about">About</string>
<string name="menu_preferences">Preferences</string>
<string name="menu_edit">Edit</string>
@@ -53,11 +54,9 @@
<string name="copyToast">URL copied</string>
<string name="noPhotoToast">Picture was not taken</string>
+ <string name="noGalleryToast">No picture was selected</string>
<string name="descThumbnail">Thumbnail</string>
<string name="contextTitle">Link entry</string>
-
-
-
</resources>
View
106 up666/src/org/qless/up666/UploadsListActivity.java
@@ -51,6 +51,7 @@
*/
public class UploadsListActivity extends ListActivity {
public static final int MENU_CAMERA_ID = Menu.FIRST;
+ public static final int MENU_GALLERY_ID = Menu.FIRST + 7;
public static final int MENU_PREFERENCES_ID = Menu.FIRST + 1;
public static final int MENU_ABOUT_ID = Menu.FIRST + 2;
public static final int MENU_EDIT_ID = Menu.FIRST + 3;
@@ -59,7 +60,12 @@
public static final int MENU_SHARE_ID = Menu.FIRST + 6;
private static final int ACTIVITY_CAPTURE_IMAGE = 0;
+ private static final int ACTIVITY_PICK_IMAGE = 2;
private static final int ACTIVITY_EDIT = 1;
+
+ private static final int SOURCE_CAMERA = 0;
+ private static final int SOURCE_GALLERY = 1;
+
private Uri imageUri;
private UploadsDbAdapter mDbHelper;
@@ -90,10 +96,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, MENU_CAMERA_ID, 1, R.string.menu_camera).setIcon(
android.R.drawable.ic_menu_camera);
- menu.add(0, MENU_ABOUT_ID, 2, R.string.menu_about).setIcon(
+ menu.add(0, MENU_GALLERY_ID, 2, R.string.menu_gallery).setIcon(
+ android.R.drawable.ic_menu_gallery);
+ menu.add(0, MENU_ABOUT_ID, 3, R.string.menu_about).setIcon(
android.R.drawable.ic_menu_info_details);
- //menu.add(0, MENU_PREFERENCES_ID, 3, R.string.menu_preferences).setIcon(
- // android.R.drawable.ic_menu_preferences);
+ // menu.add(0, MENU_PREFERENCES_ID, 3, R.string.menu_preferences).setIcon(
+ // android.R.drawable.ic_menu_preferences);
return result;
}
@@ -107,7 +115,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_CAMERA_ID:
- startCameraIntent();
+ startGetImageIntent(SOURCE_CAMERA);
+ return true;
+ case MENU_GALLERY_ID:
+ startGetImageIntent(SOURCE_GALLERY);
return true;
case MENU_ABOUT_ID:
showAbout();
@@ -256,23 +267,34 @@ public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
/**
* launch the camera to take a picture for immediate upload
*/
- private void startCameraIntent() {
- // define the file-name to save photo taken by Camera activity
- String fileName = "new-photo-name.jpg";
- // create parameters for Intent with filename
- ContentValues values = new ContentValues();
- values.put(MediaStore.Images.Media.TITLE, fileName);
- values.put(MediaStore.Images.Media.DESCRIPTION, "Image capture by camera");
- // imageUri is the current activity attribute, define and save it for
- // later usage (also in onSaveInstanceState)
- imageUri = getContentResolver()
- .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
- // create new Intent
- Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
- intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
- intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
-
- startActivityForResult(intent, ACTIVITY_CAPTURE_IMAGE);
+ private void startGetImageIntent(int source) {
+ switch (source) {
+ case SOURCE_CAMERA: {
+ // define the file-name to save photo taken by Camera activity
+ String fileName = "new-photo-name.jpg";
+ // create parameters for Intent with filename
+ ContentValues values = new ContentValues();
+ values.put(MediaStore.Images.Media.TITLE, fileName);
+ values.put(MediaStore.Images.Media.DESCRIPTION, "Image capture by camera");
+ // imageUri is the current activity attribute, define and save it for
+ // later usage (also in onSaveInstanceState)
+ imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+ values);
+ // create new Intent
+ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
+ intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
+
+ startActivityForResult(intent, ACTIVITY_CAPTURE_IMAGE);
+ break;
+ }
+ case SOURCE_GALLERY: {
+ Intent intent = new Intent(Intent.ACTION_PICK);
+ intent.setType("image/*");
+ startActivityForResult(intent, ACTIVITY_PICK_IMAGE);
+ break;
+ }
+ }
}
/*
@@ -283,27 +305,35 @@ private void startCameraIntent() {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
+ case ACTIVITY_PICK_IMAGE: {
+ if (resultCode == RESULT_OK) {
+ imageUri = data.getData(); // TODO: errorhandling like below..
+ if (imageUri == null) {
+ Log.d("imageUri", "null!");
+
+ } else {
+ upload();
+ }
+ } else if (resultCode == RESULT_CANCELED) {
+ Toast.makeText(this, getString(R.string.noGalleryToast), Toast.LENGTH_LONG).show();
+ } else {
+ Toast.makeText(this, getString(R.string.noGalleryToast), Toast.LENGTH_LONG).show();
+ }
+ return;
+ }
case ACTIVITY_CAPTURE_IMAGE:
if (resultCode == RESULT_OK) {
-
if (imageUri == null) {
Log.d("imageUri", "null!");
} else {
-
- // use imageUri here to access the image
- Bundle b = new Bundle();
- b.putParcelable(Intent.EXTRA_STREAM, imageUri);
- Intent i = new Intent(this, UploadActivity.class);
- i.putExtras(b);
- i.setAction(Intent.ACTION_SEND);
- startActivity(i);
+ upload();
}
} else if (resultCode == RESULT_CANCELED) {
- Toast.makeText(this, getString(R.string.noPhotoToast), Toast.LENGTH_SHORT);
+ Toast.makeText(this, getString(R.string.noPhotoToast), Toast.LENGTH_LONG).show();
} else {
- Toast.makeText(this, getString(R.string.noPhotoToast), Toast.LENGTH_SHORT);
+ Toast.makeText(this, getString(R.string.noPhotoToast), Toast.LENGTH_LONG).show();
}
return;
case ACTIVITY_EDIT:
@@ -325,4 +355,16 @@ private void showAbout() {
b.show();
}
+ /**
+ * uploads an image specified in the field imageUri
+ */
+ private void upload() {
+ Bundle b = new Bundle();
+ b.putParcelable(Intent.EXTRA_STREAM, imageUri);
+ Intent i = new Intent(this, UploadActivity.class);
+ i.putExtras(b);
+ i.setAction(Intent.ACTION_SEND);
+ startActivity(i);
+ }
+
}

No commit comments for this range

Something went wrong with that request. Please try again.