diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-05 21:06:10 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-06 15:28:19 +0200 |
commit | 9fc7a1b980863955a139193ded0fef5edfbad296 (patch) | |
tree | 0784b7afce2872633acd7890c1d4f97f189e7741 /src/eu/siacs/conversations/ui | |
parent | 77491039097734ce746b5b46791464bd236d4703 (diff) |
added button to open images
Diffstat (limited to 'src/eu/siacs/conversations/ui')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationActivity.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 41ee6336..82b33499 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -1,5 +1,8 @@ package eu.siacs.conversations.ui; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; @@ -8,8 +11,11 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.utils.ExceptionHelper; +import eu.siacs.conversations.utils.PhoneHelper; import eu.siacs.conversations.utils.UIHelper; +import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.app.AlertDialog; @@ -18,6 +24,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Typeface; import android.support.v4.widget.SlidingPaneLayout; @@ -46,6 +53,7 @@ public class ConversationActivity extends XmppActivity { public static final int REQUEST_SEND_MESSAGE = 0x75441; public static final int REQUEST_DECRYPT_PGP = 0x76783; + private static final int ATTACH_FILE = 0x48502; protected SlidingPaneLayout spl; @@ -272,6 +280,13 @@ public class ConversationActivity extends XmppActivity { case android.R.id.home: spl.openPane(); break; + case R.id.action_attach_file: + Intent attachFileIntent = new Intent(); + attachFileIntent.setType("image/*"); + attachFileIntent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(attachFileIntent, + "Attach File"), ATTACH_FILE); + break; case R.id.action_add: startActivity(new Intent(this, ContactsActivity.class)); break; @@ -478,6 +493,11 @@ public class ConversationActivity extends XmppActivity { if (selectedFragment!=null) { selectedFragment.hidePgpPassphraseBox(); } + } else if (requestCode == ATTACH_FILE) { + FileBackend backend = xmppConnectionService.getFileBackend(); + File file = backend.copyImageToPrivateStorage(getSelectedConversation(), data.getData()); + Log.d(LOGTAG,"new file"+file.getAbsolutePath()); + } } } |