made contact details a little bit more pretty. more colors

This commit is contained in:
Daniel Gultsch 2014-02-09 02:05:46 +01:00
parent 4a963d6f50
commit 3eb73c4b9f
3 changed files with 125 additions and 90 deletions

View File

@ -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;

View File

@ -3,75 +3,91 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:padding="8dp" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="96dp" >
<ImageView
android:id="@+id/details_contact_picture"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_centerVertical="true"
android:paddingRight="8dp" />
<LinearLayout
android:id="@+id/details_jidbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/details_contact_picture"
android:orientation="vertical"
android:layout_alignParentTop="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jabber ID"
android:textColor="#33B5E5"
android:textSize="20sp" />
<TextView
android:id="@+id/details_contactjid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="something@jabber.example.com"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/details_contactstatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:text="online"
android:textSize="24sp"
android:textStyle="bold"
android:layout_below="@+id/details_jidbox"
android:layout_toRightOf="@id/details_contact_picture"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jabber ID"
android:textColor="#636363"
android:textSize="20sp"/>
<TextView
android:id="@+id/details_contact_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="something@jabber.example.com"
android:paddingLeft="8dp"
android:textSize="14sp"/>
<TextView
android:paddingTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Status"
android:textColor="#636363"
android:textSize="20sp"/>
<TextView
android:paddingLeft="8dp"
android:id="@+id/details_contact_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="online"
android:textSize="14sp"/>
<TextView
android:paddingTop="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your account"
android:textColor="#636363"
android:textSize="20sp"/>
android:textColor="#33B5E5"
android:textSize="20sp"/>
<TextView
android:paddingLeft="8dp"
android:id="@+id/details_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="julia@jabber.example.com" />
<TextView
android:paddingTop="8dp"
android:paddingLeft="8dp"
android:text="julia@jabber.example.com"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="Subscription"
android:textColor="#636363"
android:textSize="20sp"/>
android:textColor="#33B5E5"
android:textSize="20sp" />
<CheckBox
android:id="@+id/details_send_presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send presence updates"
android:textSize="14sp"/>
<CheckBox
android:id="@+id/details_send_presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send presence updates"
android:textSize="14sp" />
<CheckBox
android:id="@+id/details_receive_presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Receive presence updates"
android:textSize="14sp"/>
<CheckBox
android:id="@+id/details_receive_presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Receive presence updates"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>

View File

@ -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());