aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/eu/siacs/conversations/services/ImageProvider.java8
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java22
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java10
3 files changed, 22 insertions, 18 deletions
diff --git a/src/eu/siacs/conversations/services/ImageProvider.java b/src/eu/siacs/conversations/services/ImageProvider.java
index c1bae661..7ca57032 100644
--- a/src/eu/siacs/conversations/services/ImageProvider.java
+++ b/src/eu/siacs/conversations/services/ImageProvider.java
@@ -93,5 +93,13 @@ public class ImageProvider extends ContentProvider {
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
return 0;
}
+
+ public static Uri getContentUri(Message message) {
+ return Uri
+ .parse("content://eu.siacs.conversations.images/"
+ + message.getConversationUuid()
+ + "/"
+ + message.getUuid());
+ }
}
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index 88728245..c650240f 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -6,8 +6,6 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import org.openintents.openpgp.OpenPgpError;
-
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
@@ -120,6 +118,10 @@ public class ConversationActivity extends XmppActivity {
public Conversation getSelectedConversation() {
return this.selectedConversation;
}
+
+ public void setSelectedConversation(Conversation conversation) {
+ this.selectedConversation = conversation;
+ }
public ListView getConversationListView() {
return this.listView;
@@ -235,8 +237,8 @@ public class ConversationActivity extends XmppActivity {
public void onItemClick(AdapterView<?> arg0, View clickedView,
int position, long arg3) {
paneShouldBeOpen = false;
- if (selectedConversation != conversationList.get(position)) {
- selectedConversation = conversationList.get(position);
+ if (getSelectedConversation() != conversationList.get(position)) {
+ setSelectedConversation(conversationList.get(position));
swapConversationFragment(); // .onBackendConnected(conversationList.get(position));
} else {
spl.closePane();
@@ -367,7 +369,7 @@ public class ConversationActivity extends XmppActivity {
@Override
public void error(int error) {
- // TODO Auto-generated method stub
+ displayErrorDialog(error);
}
});
@@ -452,7 +454,7 @@ public class ConversationActivity extends XmppActivity {
Intent inviteIntent = new Intent(getApplicationContext(),
ContactsActivity.class);
inviteIntent.setAction("invite");
- inviteIntent.putExtra("uuid", selectedConversation.getUuid());
+ inviteIntent.putExtra("uuid", getSelectedConversation().getUuid());
startActivity(inviteIntent);
break;
case R.id.action_security:
@@ -531,9 +533,9 @@ public class ConversationActivity extends XmppActivity {
spl.openPane();
xmppConnectionService.archiveConversation(conversation);
if (conversationList.size() > 0) {
- selectedConversation = conversationList.get(0);
+ setSelectedConversation(conversationList.get(0));
} else {
- selectedConversation = null;
+ setSelectedConversation(null);
}
}
@@ -619,7 +621,7 @@ public class ConversationActivity extends XmppActivity {
for (int i = 0; i < conversationList.size(); ++i) {
if (conversationList.get(i).getUuid().equals(convToView)) {
- selectedConversation = conversationList.get(i);
+ setSelectedConversation(conversationList.get(i));
}
}
paneShouldBeOpen = false;
@@ -642,7 +644,7 @@ public class ConversationActivity extends XmppActivity {
if (selectedFragment != null) {
selectedFragment.onBackendConnected();
} else {
- selectedConversation = conversationList.get(0);
+ setSelectedConversation(conversationList.get(0));
swapConversationFragment();
}
ExceptionHelper.checkForCrash(this, this.xmppConnectionService);
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 91a39ecc..8d29ce8b 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -16,6 +16,7 @@ import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
+import eu.siacs.conversations.services.ImageProvider;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.jingle.JingleConnection;
@@ -329,15 +330,8 @@ public class ConversationFragment extends Fragment {
@Override
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.setDataAndType(uri, "image/*");
+ intent.setDataAndType(ImageProvider.getContentUri(message), "image/*");
startActivity(intent);
}
});