diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-10 15:24:34 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-10 15:24:34 +0100 |
commit | cfc74e7c8e912c7a194ad674ec5f98ab6950640f (patch) | |
tree | 95aae079591ae9462697499a965ec89b13a83113 /src/de/gultsch/chat/ui | |
parent | 2d0c0e6a4081955b68669c82071a5099e2e1a96e (diff) |
fixed a bug where account options where toggled instead of set off. fixed null pointer for missing selfi. made sefli optional
Diffstat (limited to 'src/de/gultsch/chat/ui')
-rw-r--r-- | src/de/gultsch/chat/ui/ConversationActivity.java | 11 | ||||
-rw-r--r-- | src/de/gultsch/chat/ui/ConversationFragment.java | 27 | ||||
-rw-r--r-- | src/de/gultsch/chat/ui/NewConversationActivity.java | 2 |
3 files changed, 28 insertions, 12 deletions
diff --git a/src/de/gultsch/chat/ui/ConversationActivity.java b/src/de/gultsch/chat/ui/ConversationActivity.java index c5c03b12..ed328c46 100644 --- a/src/de/gultsch/chat/ui/ConversationActivity.java +++ b/src/de/gultsch/chat/ui/ConversationActivity.java @@ -265,9 +265,14 @@ public class ConversationActivity extends XmppActivity { break; case R.id.action_details: DialogContactDetails details = new DialogContactDetails(); - Contact contact = xmppConnectionService.findOrCreateContact(this.getSelectedConversation().getAccount(),this.getSelectedConversation().getContactJid()); - details.setContact(contact); - details.show(getFragmentManager(), "details"); + Contact contact = this.getSelectedConversation().getContact(); + if (contact != null) { + contact.setAccount(this.selectedConversation.getAccount()); + details.setContact(contact); + details.show(getFragmentManager(), "details"); + } else { + Log.d("xmppService","contact was null - means not in roster"); + } break; default: break; diff --git a/src/de/gultsch/chat/ui/ConversationFragment.java b/src/de/gultsch/chat/ui/ConversationFragment.java index 20451869..e6cb9196 100644 --- a/src/de/gultsch/chat/ui/ConversationFragment.java +++ b/src/de/gultsch/chat/ui/ConversationFragment.java @@ -7,12 +7,16 @@ import de.gultsch.chat.R; import de.gultsch.chat.entities.Contact; import de.gultsch.chat.entities.Conversation; import de.gultsch.chat.entities.Message; +import de.gultsch.chat.utils.PhoneHelper; import de.gultsch.chat.utils.UIHelper; import android.app.Fragment; +import android.content.SharedPreferences; import android.database.Cursor; +import android.graphics.Bitmap; import android.graphics.Typeface; import android.net.Uri; import android.os.Bundle; +import android.preference.PreferenceManager; import android.provider.ContactsContract.Profile; import android.util.Log; import android.view.LayoutInflater; @@ -72,13 +76,16 @@ public class ConversationFragment extends Fragment { messagesView = (ListView) view.findViewById(R.id.messages_view); - String[] mProjection = new String[] { Profile._ID, - Profile.PHOTO_THUMBNAIL_URI }; - Cursor mProfileCursor = getActivity().getContentResolver().query( - Profile.CONTENT_URI, mProjection, null, null, null); - - mProfileCursor.moveToFirst(); - final Uri profilePicture = Uri.parse(mProfileCursor.getString(1)); + SharedPreferences sharedPref = PreferenceManager + .getDefaultSharedPreferences(getActivity().getApplicationContext()); + boolean showPhoneSelfContactPicture = sharedPref.getBoolean("show_phone_selfcontact_picture",true); + + final Uri selfiUri; + if (showPhoneSelfContactPicture) { + selfiUri = PhoneHelper.getSefliUri(getActivity()); + } else { + selfiUri = null; + } messageListAdapter = new ArrayAdapter<Message>(this.getActivity() .getApplicationContext(), R.layout.message_sent, this.messageList) { @@ -133,7 +140,11 @@ public class ConversationFragment extends Fragment { } } } else { - imageView.setImageURI(profilePicture); + if (selfiUri!=null) { + imageView.setImageURI(selfiUri); + } else { + imageView.setImageBitmap(UIHelper.getUnknownContactPicture(conversation.getAccount().getJid(),200)); + } } TextView messageBody = (TextView) view.findViewById(R.id.message_body); String body = item.getBody(); diff --git a/src/de/gultsch/chat/ui/NewConversationActivity.java b/src/de/gultsch/chat/ui/NewConversationActivity.java index 2fb14008..d8680841 100644 --- a/src/de/gultsch/chat/ui/NewConversationActivity.java +++ b/src/de/gultsch/chat/ui/NewConversationActivity.java @@ -230,7 +230,7 @@ public class NewConversationActivity extends XmppActivity { public void startConversation(Contact contact, Account account, boolean muc) { Log.d("xmppService","starting conversation for account:"+account.getJid()+" and contact:"+contact.getJid()); Conversation conversation = xmppConnectionService - .findOrCreateConversation(account, contact, muc); + .findOrCreateConversation(account, contact.getJid(), muc); Intent viewConversationIntent = new Intent(this, ConversationActivity.class); |