static method for providing content uri

This commit is contained in:
Daniel Gultsch 2014-05-13 15:37:11 +02:00
parent 7e66731960
commit 84e79040df
2 changed files with 10 additions and 8 deletions

View File

@ -93,5 +93,13 @@ public class ImageProvider extends ContentProvider {
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) { public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
return 0; return 0;
} }
public static Uri getContentUri(Message message) {
return Uri
.parse("content://eu.siacs.conversations.images/"
+ message.getConversationUuid()
+ "/"
+ message.getUuid());
}
} }

View File

@ -16,6 +16,7 @@ import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.MucOptions.OnRenameListener; import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
import eu.siacs.conversations.services.ImageProvider;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.jingle.JingleConnection; import eu.siacs.conversations.xmpp.jingle.JingleConnection;
@ -329,15 +330,8 @@ public class ConversationFragment extends Fragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Uri uri = Uri
.parse("content://eu.siacs.conversations.images/"
+ message.getConversationUuid()
+ "/"
+ message.getUuid());
Log.d("xmppService",
"staring intent with uri:" + uri.toString());
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "image/*"); intent.setDataAndType(ImageProvider.getContentUri(message), "image/*");
startActivity(intent); startActivity(intent);
} }
}); });