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/ConversationFragment.java | |
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 '')
-rw-r--r-- | src/de/gultsch/chat/ui/ConversationFragment.java | 27 |
1 files changed, 19 insertions, 8 deletions
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(); |