From 3eb73c4b9f6b620e15ed176dc94b364e8813aa8e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 9 Feb 2014 02:05:46 +0100 Subject: [PATCH] made contact details a little bit more pretty. more colors --- gen/de/gultsch/chat/R.java | 68 +++++----- res/layout/dialog_contact_details.xml | 126 ++++++++++-------- .../gultsch/chat/ui/DialogContactDetails.java | 21 ++- 3 files changed, 125 insertions(+), 90 deletions(-) diff --git a/gen/de/gultsch/chat/R.java b/gen/de/gultsch/chat/R.java index 924200d0c..ebe4e3b3f 100644 --- a/gen/de/gultsch/chat/R.java +++ b/gen/de/gultsch/chat/R.java @@ -41,24 +41,24 @@ public final class R { public static final int section_header=0x7f02000c; } public static final class id { - public static final int account_confirm_password_desc=0x7f0a0017; - public static final int account_delete=0x7f0a002b; - public static final int account_disable=0x7f0a002c; - public static final int account_enable=0x7f0a002d; + public static final int account_confirm_password_desc=0x7f0a0019; + public static final int account_delete=0x7f0a002d; + public static final int account_disable=0x7f0a002e; + public static final int account_enable=0x7f0a002f; public static final int account_jid=0x7f0a0000; - public static final int account_list=0x7f0a0020; - public static final int account_password=0x7f0a0014; - public static final int account_password_confirm2=0x7f0a0018; + public static final int account_list=0x7f0a0022; + public static final int account_password=0x7f0a0016; + public static final int account_password_confirm2=0x7f0a001a; public static final int account_status=0x7f0a0002; - public static final int account_usetls=0x7f0a0015; - public static final int action_accounts=0x7f0a0028; - public static final int action_add=0x7f0a0024; - public static final int action_add_account=0x7f0a002a; - public static final int action_archive=0x7f0a0027; - public static final int action_details=0x7f0a0026; - public static final int action_refresh_contacts=0x7f0a002e; - public static final int action_security=0x7f0a0025; - public static final int action_settings=0x7f0a0029; + public static final int account_usetls=0x7f0a0017; + public static final int action_accounts=0x7f0a002a; + public static final int action_add=0x7f0a0026; + public static final int action_add_account=0x7f0a002c; + public static final int action_archive=0x7f0a0029; + public static final int action_details=0x7f0a0028; + public static final int action_refresh_contacts=0x7f0a0030; + public static final int action_security=0x7f0a0027; + public static final int action_settings=0x7f0a002b; public static final int contactList=0x7f0a0006; public static final int contact_display_name=0x7f0a0008; public static final int contact_jid=0x7f0a0009; @@ -68,26 +68,28 @@ public final class R { public static final int conversation_lastmsg=0x7f0a000c; public static final int conversation_lastupdate=0x7f0a000d; public static final int conversation_name=0x7f0a000b; - public static final int details_account=0x7f0a0010; - public static final int details_contact_jid=0x7f0a000e; - public static final int details_contact_status=0x7f0a000f; - public static final int details_receive_presence=0x7f0a0012; - public static final int details_send_presence=0x7f0a0011; - public static final int edit_account_register_new=0x7f0a0016; - public static final int list=0x7f0a001e; - public static final int message_body=0x7f0a0022; - public static final int message_photo=0x7f0a0021; - public static final int message_time=0x7f0a0023; - public static final int messages_view=0x7f0a001c; + public static final int details_account=0x7f0a0012; + public static final int details_contact_picture=0x7f0a000e; + public static final int details_contactjid=0x7f0a0010; + public static final int details_contactstatus=0x7f0a0011; + public static final int details_jidbox=0x7f0a000f; + public static final int details_receive_presence=0x7f0a0014; + public static final int details_send_presence=0x7f0a0013; + public static final int edit_account_register_new=0x7f0a0018; + public static final int list=0x7f0a0020; + public static final int message_body=0x7f0a0024; + public static final int message_photo=0x7f0a0023; + public static final int message_time=0x7f0a0025; + public static final int messages_view=0x7f0a001e; public static final int new_conversation_search=0x7f0a0004; public static final int progressBar1=0x7f0a0003; - public static final int selected_conversation=0x7f0a001f; - public static final int slidingpanelayout=0x7f0a001d; - public static final int textSendButton=0x7f0a001b; - public static final int textView1=0x7f0a0013; + public static final int selected_conversation=0x7f0a0021; + public static final int slidingpanelayout=0x7f0a001f; + public static final int textSendButton=0x7f0a001d; + public static final int textView1=0x7f0a0015; public static final int textView2=0x7f0a0001; - public static final int textinput=0x7f0a001a; - public static final int textsend=0x7f0a0019; + public static final int textinput=0x7f0a001c; + public static final int textsend=0x7f0a001b; } public static final class layout { public static final int account_row=0x7f030000; diff --git a/res/layout/dialog_contact_details.xml b/res/layout/dialog_contact_details.xml index 9bbe55392..b74b8155b 100644 --- a/res/layout/dialog_contact_details.xml +++ b/res/layout/dialog_contact_details.xml @@ -3,75 +3,91 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:padding="8dp"> + android:padding="8dp" > + + + + + + + + + + + + + + + - - - - - - - - + android:textColor="#33B5E5" + android:textSize="20sp"/> - - + + + android:textColor="#33B5E5" + android:textSize="20sp" /> - + - + - + \ No newline at end of file diff --git a/src/de/gultsch/chat/ui/DialogContactDetails.java b/src/de/gultsch/chat/ui/DialogContactDetails.java index 7af8db70e..51819399c 100644 --- a/src/de/gultsch/chat/ui/DialogContactDetails.java +++ b/src/de/gultsch/chat/ui/DialogContactDetails.java @@ -3,13 +3,16 @@ package de.gultsch.chat.ui; import de.gultsch.chat.R; import de.gultsch.chat.entities.Contact; import de.gultsch.chat.entities.Presences; +import de.gultsch.chat.utils.UIHelper; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; +import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.CheckBox; +import android.widget.ImageView; import android.widget.TextView; public class DialogContactDetails extends DialogFragment { @@ -26,11 +29,12 @@ public class DialogContactDetails extends DialogFragment { final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialog_contact_details, null); - TextView contactJid = (TextView) view.findViewById(R.id.details_contact_jid); + TextView contactJid = (TextView) view.findViewById(R.id.details_contactjid); TextView accountJid = (TextView) view.findViewById(R.id.details_account); - TextView status = (TextView) view.findViewById(R.id.details_contact_status); + TextView status = (TextView) view.findViewById(R.id.details_contactstatus); CheckBox send = (CheckBox) view.findViewById(R.id.details_send_presence); CheckBox receive = (CheckBox) view.findViewById(R.id.details_receive_presence); + ImageView contactPhoto = (ImageView) view.findViewById(R.id.details_contact_picture); boolean subscriptionSend = false; boolean subscriptionReceive = false; @@ -46,24 +50,31 @@ public class DialogContactDetails extends DialogFragment { switch (contact.getMostAvailableStatus()) { case Presences.CHAT: status.setText("free to chat"); + status.setTextColor(0xFF83b600); break; case Presences.ONLINE: status.setText("online"); + status.setTextColor(0xFF83b600); break; case Presences.AWAY: status.setText("away"); + status.setTextColor(0xFFffa713); break; case Presences.XA: status.setText("extended away"); + status.setTextColor(0xFFffa713); break; case Presences.DND: status.setText("do not disturb"); + status.setTextColor(0xFFe92727); break; case Presences.OFFLINE: status.setText("offline"); + status.setTextColor(0xFFe92727); break; default: status.setText("offline"); + status.setTextColor(0xFFe92727); break; } @@ -72,6 +83,12 @@ public class DialogContactDetails extends DialogFragment { contactJid.setText(contact.getJid()); accountJid.setText(contact.getAccount().getJid()); + if (contact.getProfilePhoto()!=null) { + contactPhoto.setImageURI(Uri.parse(contact.getProfilePhoto())); + } else { + contactPhoto.setImageBitmap(UIHelper.getUnknownContactPicture(contact.getDisplayName(), 300)); + } + builder.setView(view); builder.setTitle(contact.getDisplayName());