reworked contact details
This commit is contained in:
parent
79ec8b2e81
commit
78312d71dd
|
@ -46,9 +46,13 @@
|
|||
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="eu.siacs.conversations.ui.MucOptionsActivity"
|
||||
android:name="eu.siacs.conversations.ui.MucDetailsActivity"
|
||||
android:label="Conference Details"
|
||||
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity"
|
||||
android:windowSoftInputMode="stateHidden">
|
||||
</activity>
|
||||
<activity
|
||||
android:name="eu.siacs.conversations.ui.ContactDetailsActivity"
|
||||
android:label="Contact Details"
|
||||
android:windowSoftInputMode="stateHidden">
|
||||
</activity>
|
||||
<activity
|
||||
|
|
|
@ -36,116 +36,123 @@ public final class R {
|
|||
public static final int ic_action_cancel_launchersize=0x7f020007;
|
||||
public static final int ic_action_cancel_launchersize_light=0x7f020008;
|
||||
public static final int ic_action_delete=0x7f020009;
|
||||
public static final int ic_action_edit=0x7f02000a;
|
||||
public static final int ic_action_group=0x7f02000b;
|
||||
public static final int ic_action_person=0x7f02000c;
|
||||
public static final int ic_action_refresh=0x7f02000d;
|
||||
public static final int ic_action_secure=0x7f02000e;
|
||||
public static final int ic_action_send=0x7f02000f;
|
||||
public static final int ic_action_send_now=0x7f020010;
|
||||
public static final int ic_action_unsecure=0x7f020011;
|
||||
public static final int ic_launcher=0x7f020012;
|
||||
public static final int ic_profile=0x7f020013;
|
||||
public static final int message_border=0x7f020014;
|
||||
public static final int notification=0x7f020015;
|
||||
public static final int red=0x7f020016;
|
||||
public static final int redbackground=0x7f020017;
|
||||
public static final int section_header=0x7f020018;
|
||||
public static final int ic_action_discard=0x7f02000a;
|
||||
public static final int ic_action_edit=0x7f02000b;
|
||||
public static final int ic_action_group=0x7f02000c;
|
||||
public static final int ic_action_person=0x7f02000d;
|
||||
public static final int ic_action_refresh=0x7f02000e;
|
||||
public static final int ic_action_secure=0x7f02000f;
|
||||
public static final int ic_action_send=0x7f020010;
|
||||
public static final int ic_action_send_now=0x7f020011;
|
||||
public static final int ic_action_unsecure=0x7f020012;
|
||||
public static final int ic_launcher=0x7f020013;
|
||||
public static final int ic_profile=0x7f020014;
|
||||
public static final int message_border=0x7f020015;
|
||||
public static final int notification=0x7f020016;
|
||||
public static final int red=0x7f020017;
|
||||
public static final int redbackground=0x7f020018;
|
||||
public static final int section_header=0x7f020019;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int account_confirm_password_desc=0x7f0a001c;
|
||||
public static final int account_delete=0x7f0a0041;
|
||||
public static final int account_disable=0x7f0a0042;
|
||||
public static final int account_enable=0x7f0a0043;
|
||||
public static final int account_confirm_password_desc=0x7f0a0023;
|
||||
public static final int account_delete=0x7f0a0044;
|
||||
public static final int account_disable=0x7f0a0045;
|
||||
public static final int account_enable=0x7f0a0046;
|
||||
public static final int account_jid=0x7f0a0000;
|
||||
public static final int account_list=0x7f0a002b;
|
||||
public static final int account_password=0x7f0a0019;
|
||||
public static final int account_password_confirm2=0x7f0a001d;
|
||||
public static final int account_list=0x7f0a0033;
|
||||
public static final int account_password=0x7f0a0020;
|
||||
public static final int account_password_confirm2=0x7f0a0024;
|
||||
public static final int account_status=0x7f0a0002;
|
||||
public static final int account_usetls=0x7f0a001a;
|
||||
public static final int action_accounts=0x7f0a003b;
|
||||
public static final int action_add=0x7f0a0036;
|
||||
public static final int action_add_account=0x7f0a0040;
|
||||
public static final int action_archive=0x7f0a003a;
|
||||
public static final int action_contact_details=0x7f0a0038;
|
||||
public static final int action_muc_details=0x7f0a0039;
|
||||
public static final int action_refresh_contacts=0x7f0a0045;
|
||||
public static final int action_security=0x7f0a0037;
|
||||
public static final int action_settings=0x7f0a003c;
|
||||
public static final int announce_pgp=0x7f0a0044;
|
||||
public static final int contactList=0x7f0a0006;
|
||||
public static final int contact_display_name=0x7f0a0008;
|
||||
public static final int contact_jid=0x7f0a0009;
|
||||
public static final int contact_photo=0x7f0a0007;
|
||||
public static final int contacts_header=0x7f0a0005;
|
||||
public static final int conversation_image=0x7f0a000a;
|
||||
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=0x7f0a0012;
|
||||
public static final int details_contact_badge=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=0x7f0a001b;
|
||||
public static final int encryption_choice_none=0x7f0a003d;
|
||||
public static final int encryption_choice_otr=0x7f0a003e;
|
||||
public static final int encryption_choice_pgp=0x7f0a003f;
|
||||
public static final int info_box=0x7f0a0022;
|
||||
public static final int list=0x7f0a0029;
|
||||
public static final int message_body=0x7f0a002d;
|
||||
public static final int message_photo=0x7f0a002c;
|
||||
public static final int message_time=0x7f0a002e;
|
||||
public static final int messages_view=0x7f0a0021;
|
||||
public static final int muc_edit_nick=0x7f0a0030;
|
||||
public static final int muc_error=0x7f0a0023;
|
||||
public static final int muc_error_msg=0x7f0a0024;
|
||||
public static final int muc_jabberid=0x7f0a0031;
|
||||
public static final int muc_members=0x7f0a0035;
|
||||
public static final int muc_more_details=0x7f0a0032;
|
||||
public static final int muc_participants_header=0x7f0a0034;
|
||||
public static final int muc_role=0x7f0a0033;
|
||||
public static final int muc_your_nick=0x7f0a002f;
|
||||
public static final int new_conversation_search=0x7f0a0004;
|
||||
public static final int new_fingerprint=0x7f0a0025;
|
||||
public static final int otr_fingerprint=0x7f0a0026;
|
||||
public static final int pgp_keyentry=0x7f0a0027;
|
||||
public static final int progressBar1=0x7f0a0003;
|
||||
public static final int selected_conversation=0x7f0a002a;
|
||||
public static final int slidingpanelayout=0x7f0a0028;
|
||||
public static final int textSendButton=0x7f0a0020;
|
||||
public static final int textView1=0x7f0a0018;
|
||||
public static final int account_usetls=0x7f0a0021;
|
||||
public static final int action_accounts=0x7f0a0039;
|
||||
public static final int action_add=0x7f0a003b;
|
||||
public static final int action_add_account=0x7f0a0043;
|
||||
public static final int action_archive=0x7f0a003f;
|
||||
public static final int action_contact_details=0x7f0a003d;
|
||||
public static final int action_delete_contact=0x7f0a0038;
|
||||
public static final int action_edit_contact=0x7f0a0037;
|
||||
public static final int action_muc_details=0x7f0a003e;
|
||||
public static final int action_refresh_contacts=0x7f0a0048;
|
||||
public static final int action_security=0x7f0a003c;
|
||||
public static final int action_settings=0x7f0a003a;
|
||||
public static final int announce_pgp=0x7f0a0047;
|
||||
public static final int contactList=0x7f0a0014;
|
||||
public static final int contact_display_name=0x7f0a0016;
|
||||
public static final int contact_jid=0x7f0a0017;
|
||||
public static final int contact_photo=0x7f0a0015;
|
||||
public static final int contacts_header=0x7f0a0013;
|
||||
public static final int conversation_image=0x7f0a0018;
|
||||
public static final int conversation_lastmsg=0x7f0a001a;
|
||||
public static final int conversation_lastupdate=0x7f0a001b;
|
||||
public static final int conversation_name=0x7f0a0019;
|
||||
public static final int details_account=0x7f0a0007;
|
||||
public static final int details_contact_badge=0x7f0a0003;
|
||||
public static final int details_contactjid=0x7f0a0005;
|
||||
public static final int details_contactstatus=0x7f0a0006;
|
||||
public static final int details_jidbox=0x7f0a0004;
|
||||
public static final int details_receive_presence=0x7f0a0009;
|
||||
public static final int details_send_presence=0x7f0a0008;
|
||||
public static final int editText1=0x7f0a0025;
|
||||
public static final int edit_account_register_new=0x7f0a0022;
|
||||
public static final int encryption_choice_none=0x7f0a0040;
|
||||
public static final int encryption_choice_otr=0x7f0a0041;
|
||||
public static final int encryption_choice_pgp=0x7f0a0042;
|
||||
public static final int info_box=0x7f0a002a;
|
||||
public static final int list=0x7f0a0031;
|
||||
public static final int message_body=0x7f0a0035;
|
||||
public static final int message_photo=0x7f0a0034;
|
||||
public static final int message_time=0x7f0a0036;
|
||||
public static final int messages_view=0x7f0a0029;
|
||||
public static final int muc_edit_nick=0x7f0a000b;
|
||||
public static final int muc_error=0x7f0a002b;
|
||||
public static final int muc_error_msg=0x7f0a002c;
|
||||
public static final int muc_jabberid=0x7f0a000c;
|
||||
public static final int muc_members=0x7f0a0010;
|
||||
public static final int muc_more_details=0x7f0a000d;
|
||||
public static final int muc_participants_header=0x7f0a000f;
|
||||
public static final int muc_role=0x7f0a000e;
|
||||
public static final int muc_your_nick=0x7f0a000a;
|
||||
public static final int new_conversation_search=0x7f0a0012;
|
||||
public static final int new_fingerprint=0x7f0a002d;
|
||||
public static final int otr_fingerprint=0x7f0a002e;
|
||||
public static final int pgp_keyentry=0x7f0a002f;
|
||||
public static final int progressBar1=0x7f0a0011;
|
||||
public static final int selected_conversation=0x7f0a0032;
|
||||
public static final int slidingpanelayout=0x7f0a0030;
|
||||
public static final int textSendButton=0x7f0a0028;
|
||||
public static final int textView1=0x7f0a001f;
|
||||
public static final int textView2=0x7f0a0001;
|
||||
public static final int textinput=0x7f0a001f;
|
||||
public static final int textsend=0x7f0a001e;
|
||||
public static final int verify_otr_fingerprint=0x7f0a0016;
|
||||
public static final int verify_otr_jid=0x7f0a0015;
|
||||
public static final int verify_otr_yourprint=0x7f0a0017;
|
||||
public static final int textinput=0x7f0a0027;
|
||||
public static final int textsend=0x7f0a0026;
|
||||
public static final int verify_otr_fingerprint=0x7f0a001d;
|
||||
public static final int verify_otr_jid=0x7f0a001c;
|
||||
public static final int verify_otr_yourprint=0x7f0a001e;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int account_row=0x7f030000;
|
||||
public static final int activity_new_conversation=0x7f030001;
|
||||
public static final int contact=0x7f030002;
|
||||
public static final int conversation_list_row=0x7f030003;
|
||||
public static final int dialog_contact_details=0x7f030004;
|
||||
public static final int dialog_verify_otr=0x7f030005;
|
||||
public static final int edit_account_dialog=0x7f030006;
|
||||
public static final int fragment_conversation=0x7f030007;
|
||||
public static final int fragment_conversations_overview=0x7f030008;
|
||||
public static final int manage_accounts=0x7f030009;
|
||||
public static final int message_error=0x7f03000a;
|
||||
public static final int message_recieved=0x7f03000b;
|
||||
public static final int message_sent=0x7f03000c;
|
||||
public static final int muc_options=0x7f03000d;
|
||||
public static final int activity_contact_details=0x7f030001;
|
||||
public static final int activity_muc_details=0x7f030002;
|
||||
public static final int activity_new_conversation=0x7f030003;
|
||||
public static final int contact=0x7f030004;
|
||||
public static final int conversation_list_row=0x7f030005;
|
||||
public static final int dialog_verify_otr=0x7f030006;
|
||||
public static final int edit_account_dialog=0x7f030007;
|
||||
public static final int edit_contact_name=0x7f030008;
|
||||
public static final int fragment_conversation=0x7f030009;
|
||||
public static final int fragment_conversations_overview=0x7f03000a;
|
||||
public static final int manage_accounts=0x7f03000b;
|
||||
public static final int message_error=0x7f03000c;
|
||||
public static final int message_recieved=0x7f03000d;
|
||||
public static final int message_sent=0x7f03000e;
|
||||
}
|
||||
public static final class menu {
|
||||
public static final int conversations=0x7f090000;
|
||||
public static final int encryption_choices=0x7f090001;
|
||||
public static final int manageaccounts=0x7f090002;
|
||||
public static final int manageaccounts_context=0x7f090003;
|
||||
public static final int newconversation=0x7f090004;
|
||||
public static final int contact_details=0x7f090000;
|
||||
public static final int conversations=0x7f090001;
|
||||
public static final int encryption_choices=0x7f090002;
|
||||
public static final int manageaccounts=0x7f090003;
|
||||
public static final int manageaccounts_context=0x7f090004;
|
||||
public static final int muc_details=0x7f090005;
|
||||
public static final int newconversation=0x7f090006;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int action_accounts=0x7f050005;
|
||||
|
@ -160,12 +167,14 @@ public final class R {
|
|||
public static final int app_name=0x7f050002;
|
||||
public static final int conference_details=0x7f050010;
|
||||
public static final int encrypted_message=0x7f05000f;
|
||||
public static final int enter_new_name=0x7f050015;
|
||||
public static final int just_now=0x7f05000c;
|
||||
public static final int moderator=0x7f050012;
|
||||
public static final int nick_in_use=0x7f050011;
|
||||
public static final int openpgp_install_openkeychain_via=0x7f050001;
|
||||
public static final int openpgp_list_preference_none=0x7f050000;
|
||||
public static final int participant=0x7f050013;
|
||||
public static final int remove_contact_text=0x7f050016;
|
||||
public static final int sending=0x7f05000d;
|
||||
public static final int title_activity_new_conversation=0x7f05000b;
|
||||
public static final int visitor=0x7f050014;
|
||||
|
|
BIN
res/drawable-hdpi/ic_action_discard.png
Normal file
BIN
res/drawable-hdpi/ic_action_discard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 454 B |
BIN
res/drawable-mdpi/ic_action_discard.png
Normal file
BIN
res/drawable-mdpi/ic_action_discard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 333 B |
BIN
res/drawable-xhdpi/ic_action_discard.png
Normal file
BIN
res/drawable-xhdpi/ic_action_discard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 552 B |
BIN
res/drawable-xxhdpi/ic_action_discard.png
Normal file
BIN
res/drawable-xxhdpi/ic_action_discard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 781 B |
|
@ -3,12 +3,18 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp" >
|
||||
android:background="#e5e5e5">
|
||||
|
||||
<TextView
|
||||
style="@style/sectionHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:text="Contact Details" />
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:padding="0dp">
|
||||
android:layout_height="88dp"
|
||||
android:padding="8dp">
|
||||
|
||||
<QuickContactBadge
|
||||
android:id="@+id/details_contact_badge"
|
||||
|
@ -21,78 +27,69 @@
|
|||
android:id="@+id/details_jidbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/details_contact_badge"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingLeft="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Jabber ID"
|
||||
android:textColor="#33B5E5"
|
||||
android:textSize="20sp" />
|
||||
android:paddingLeft="8dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/details_contactjid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="something@jabber.example.com"
|
||||
android:paddingLeft="8dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="14sp"
|
||||
android:paddingLeft="8dp"/>
|
||||
android:text="something@jabber.example.com"
|
||||
android:textColor="#5b5b5b"
|
||||
android:textSize="18sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
<TextView
|
||||
android:id="@+id/details_contactstatus"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="online"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_below="@+id/details_jidbox"
|
||||
android:layout_toRightOf="@id/details_contact_badge"
|
||||
android:paddingLeft="16dp"/>
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
|
||||
<TextView
|
||||
style="@style/sectionHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:text="Your account"
|
||||
android:textColor="#33B5E5"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
android:padding="8dp"
|
||||
android:text="Your account" />
|
||||
<TextView
|
||||
android:id="@+id/details_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="8dp"
|
||||
android:text="julia@jabber.example.com"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:textSize="18sp"
|
||||
android:textColor="#5b5b5b" />
|
||||
<TextView
|
||||
style="@style/sectionHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:text="Subscription"
|
||||
android:textColor="#33B5E5"
|
||||
android:textSize="20sp" />
|
||||
android:padding="8dp"
|
||||
android:text="Subscription" />
|
||||
|
||||
<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" />
|
||||
android:textSize="18sp"
|
||||
android:textColor="#5b5b5b" />
|
||||
|
||||
<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" />
|
||||
android:textSize="18sp"
|
||||
android:textColor="#5b5b5b" />
|
||||
|
||||
</LinearLayout>
|
28
res/layout/edit_contact_name.xml
Normal file
28
res/layout/edit_contact_name.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/enter_new_name"
|
||||
android:textColor="#5b5b5b"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<EditText
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:id="@+id/editText1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="textPersonName" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
</LinearLayout>
|
27
res/menu/contact_details.xml
Normal file
27
res/menu/contact_details.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item
|
||||
android:id="@+id/action_edit_contact"
|
||||
android:orderInCategory="10"
|
||||
android:showAsAction="always"
|
||||
android:icon="@drawable/ic_action_edit"
|
||||
android:title="Edit name" />
|
||||
<item
|
||||
android:id="@+id/action_delete_contact"
|
||||
android:orderInCategory="10"
|
||||
android:showAsAction="always"
|
||||
android:icon="@drawable/ic_action_discard"
|
||||
android:title="Delete from roster" />
|
||||
<item
|
||||
android:id="@+id/action_accounts"
|
||||
android:orderInCategory="90"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_accounts"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
</menu>
|
15
res/menu/muc_details.xml
Normal file
15
res/menu/muc_details.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item
|
||||
android:id="@+id/action_accounts"
|
||||
android:orderInCategory="90"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_accounts"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
</menu>
|
|
@ -20,4 +20,6 @@
|
|||
<string name="moderator">Moderator</string>
|
||||
<string name="participant">Participant</string>
|
||||
<string name="visitor">Visitor</string>
|
||||
<string name="enter_new_name">Enter a new name:</string>
|
||||
<string name="remove_contact_text">Do you want to delete %s from your roster. The conversation assoziated with this account will not be removed.</string>
|
||||
</resources>
|
||||
|
|
|
@ -293,4 +293,8 @@ public class Contact extends AbstractEntity implements Serializable {
|
|||
public boolean isInRoster() {
|
||||
return this.inRoster;
|
||||
}
|
||||
|
||||
public String getAccountUuid() {
|
||||
return this.accountUuid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public List<Contact> getContacts(Account account) {
|
||||
public List<Contact> getContactsByAccount(Account account) {
|
||||
List<Contact> list = new ArrayList<Contact>();
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
Cursor cursor;
|
||||
|
@ -246,7 +246,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
return list;
|
||||
}
|
||||
|
||||
public List<Contact> getContats(String where) {
|
||||
public List<Contact> getContacts(String where) {
|
||||
List<Contact> list = new ArrayList<Contact>();
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
Cursor cursor = db.query(Contact.TABLENAME, null, where, null, null, null, null);
|
||||
|
@ -280,5 +280,15 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||
db.delete(Contact.TABLENAME, Contact.UUID + "=?", args);
|
||||
}
|
||||
|
||||
public Contact getContact(String uuid) {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
String[] args = { uuid };
|
||||
Cursor cursor = db.query(Contact.TABLENAME, null, Contact.UUID + "=?", args, null, null, null);
|
||||
if (cursor.getCount() == 0)
|
||||
return null;
|
||||
cursor.moveToFirst();
|
||||
return Contact.fromCursor(cursor);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -535,7 +535,7 @@ public class XmppConnectionService extends Service {
|
|||
|
||||
public void getRoster(Account account,
|
||||
final OnRosterFetchedListener listener) {
|
||||
List<Contact> contacts = databaseBackend.getContacts(account);
|
||||
List<Contact> contacts = databaseBackend.getContactsByAccount(account);
|
||||
for (int i = 0; i < contacts.size(); ++i) {
|
||||
contacts.get(i).setAccount(account);
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ public class XmppConnectionService extends Service {
|
|||
mWhere.append(account.getUuid());
|
||||
mWhere.append("\"");
|
||||
List<Contact> contactsToDelete = databaseBackend
|
||||
.getContats(mWhere.toString());
|
||||
.getContacts(mWhere.toString());
|
||||
for (Contact contact : contactsToDelete) {
|
||||
databaseBackend.deleteContact(contact);
|
||||
replaceContactInConversation(contact.getJid(),
|
||||
|
@ -604,7 +604,7 @@ public class XmppConnectionService extends Service {
|
|||
public void onPhoneContactsLoaded(
|
||||
Hashtable<String, Bundle> phoneContacts) {
|
||||
List<Contact> contacts = databaseBackend
|
||||
.getContacts(null);
|
||||
.getContactsByAccount(null);
|
||||
for (int i = 0; i < contacts.size(); ++i) {
|
||||
Contact contact = contacts.get(i);
|
||||
if (phoneContacts.containsKey(contact.getJid())) {
|
||||
|
@ -938,6 +938,7 @@ public class XmppConnectionService extends Service {
|
|||
|
||||
public void updateContact(Contact contact) {
|
||||
databaseBackend.updateContact(contact);
|
||||
replaceContactInConversation(contact.getJid(), contact);
|
||||
}
|
||||
|
||||
public void updateMessage(Message message) {
|
||||
|
@ -1035,4 +1036,14 @@ public class XmppConnectionService extends Service {
|
|||
public void updateConversation(Conversation conversation) {
|
||||
this.databaseBackend.updateConversation(conversation);
|
||||
}
|
||||
|
||||
public Contact findContact(String uuid) {
|
||||
Contact contact = this.databaseBackend.getContact(uuid);
|
||||
for(Account account : getAccounts()) {
|
||||
if (contact.getAccountUuid().equals(account.getUuid())) {
|
||||
contact.setAccount(account);
|
||||
}
|
||||
}
|
||||
return contact;
|
||||
}
|
||||
}
|
226
src/eu/siacs/conversations/ui/ContactDetailsActivity.java
Normal file
226
src/eu/siacs/conversations/ui/ContactDetailsActivity.java
Normal file
|
@ -0,0 +1,226 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract.CommonDataKinds;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.provider.ContactsContract.Intents;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.QuickContactBadge;
|
||||
import android.widget.TextView;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Presences;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
|
||||
public class ContactDetailsActivity extends XmppActivity {
|
||||
public static final String ACTION_VIEW_CONTACT = "view_contact";
|
||||
|
||||
protected ContactDetailsActivity activity = this;
|
||||
|
||||
private String uuid;
|
||||
private Contact contact;
|
||||
|
||||
private EditText name;
|
||||
private TextView contactJid;
|
||||
private TextView accountJid;
|
||||
private TextView status;
|
||||
private CheckBox send;
|
||||
private CheckBox receive;
|
||||
private QuickContactBadge badge;
|
||||
|
||||
private DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
activity.xmppConnectionService.deleteContact(contact);
|
||||
activity.finish();
|
||||
}
|
||||
};
|
||||
|
||||
private DialogInterface.OnClickListener editContactNameListener = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
contact.setDisplayName(name.getText().toString());
|
||||
activity.xmppConnectionService.updateContact(contact);
|
||||
populateView();
|
||||
}
|
||||
};
|
||||
|
||||
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
|
||||
intent.setType(Contacts.CONTENT_ITEM_TYPE);
|
||||
intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid());
|
||||
intent.putExtra(Intents.Insert.IM_PROTOCOL,
|
||||
CommonDataKinds.Im.PROTOCOL_JABBER);
|
||||
intent.putExtra("finishActivityOnSaveCompleted", true);
|
||||
activity.startActivityForResult(intent, 0);
|
||||
}
|
||||
};
|
||||
private OnClickListener onBadgeClick = new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle("Add to phone book");
|
||||
builder.setMessage("Do you want to add " + contact.getJid()
|
||||
+ " to your phones contact list?");
|
||||
builder.setNegativeButton("Cancel", null);
|
||||
builder.setPositiveButton("Add", addToPhonebook);
|
||||
builder.create().show();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getIntent().getAction().equals(ACTION_VIEW_CONTACT)) {
|
||||
this.uuid = getIntent().getExtras().getString("uuid");
|
||||
}
|
||||
setContentView(R.layout.activity_contact_details);
|
||||
|
||||
contactJid = (TextView) findViewById(R.id.details_contactjid);
|
||||
accountJid = (TextView) findViewById(R.id.details_account);
|
||||
status = (TextView) findViewById(R.id.details_contactstatus);
|
||||
send = (CheckBox) findViewById(R.id.details_send_presence);
|
||||
receive = (CheckBox) findViewById(R.id.details_receive_presence);
|
||||
badge = (QuickContactBadge) findViewById(R.id.details_contact_badge);
|
||||
|
||||
getActionBar().setHomeButtonEnabled(true);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setNegativeButton("Cancel", null);
|
||||
switch (menuItem.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
break;
|
||||
case R.id.action_delete_contact:
|
||||
builder.setTitle("Delete from roster")
|
||||
.setMessage(getString(R.string.remove_contact_text, contact.getJid()))
|
||||
.setPositiveButton("Delete", removeFromRoster).create()
|
||||
.show();
|
||||
break;
|
||||
case R.id.action_edit_contact:
|
||||
if (contact.getSystemAccount() == null) {
|
||||
|
||||
View view = (View) getLayoutInflater().inflate(R.layout.edit_contact_name, null);
|
||||
name = (EditText) view.findViewById(R.id.editText1);
|
||||
name.setText(contact.getDisplayName());
|
||||
builder.setView(view)
|
||||
.setTitle(contact.getJid())
|
||||
.setPositiveButton("Edit", editContactNameListener)
|
||||
.create().show();
|
||||
|
||||
} else {
|
||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
||||
String[] systemAccount = contact.getSystemAccount().split("#");
|
||||
long id = Long.parseLong(systemAccount[0]);
|
||||
Uri uri = Contacts.getLookupUri(id, systemAccount[1]);
|
||||
intent.setDataAndType(uri,Contacts.CONTENT_ITEM_TYPE);
|
||||
intent.putExtra("finishActivityOnSaveCompleted", true);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(menuItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.contact_details, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void populateView() {
|
||||
setTitle(contact.getDisplayName());
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.FROM)) {
|
||||
send.setChecked(true);
|
||||
} else {
|
||||
send.setText("Preemptively grant subscription request");
|
||||
if (contact
|
||||
.getSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT)) {
|
||||
send.setChecked(true);
|
||||
} else {
|
||||
send.setChecked(false);
|
||||
}
|
||||
}
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.TO)) {
|
||||
receive.setChecked(true);
|
||||
} else {
|
||||
receive.setText("Request presence updates");
|
||||
if (contact
|
||||
.getSubscriptionOption(Contact.Subscription.ASKING)) {
|
||||
receive.setChecked(true);
|
||||
} else {
|
||||
receive.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
contactJid.setText(contact.getJid());
|
||||
accountJid.setText(contact.getAccount().getJid());
|
||||
|
||||
UIHelper.prepareContactBadge(this, badge, contact);
|
||||
|
||||
if (contact.getSystemAccount() == null) {
|
||||
badge.setOnClickListener(onBadgeClick);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackendConnected() {
|
||||
if (uuid != null) {
|
||||
this.contact = xmppConnectionService.findContact(uuid);
|
||||
if (this.contact != null) {
|
||||
populateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -162,9 +162,9 @@ public class ConversationActivity extends XmppActivity {
|
|||
}
|
||||
|
||||
((TextView) view.findViewById(R.id.conversation_lastupdate))
|
||||
.setText(UIHelper.readableTimeDifference(getItem(position).getLatestMessage().getTimeSent()));
|
||||
.setText(UIHelper.readableTimeDifference(conv.getLatestMessage().getTimeSent()));
|
||||
|
||||
Uri profilePhoto = getItem(position).getProfilePhotoUri();
|
||||
Uri profilePhoto = conv.getProfilePhotoUri();
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.conversation_image);
|
||||
if (profilePhoto!=null) {
|
||||
imageView.setImageURI(profilePhoto);
|
||||
|
@ -272,12 +272,6 @@ public class ConversationActivity extends XmppActivity {
|
|||
case android.R.id.home:
|
||||
spl.openPane();
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.action_accounts:
|
||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
||||
break;
|
||||
case R.id.action_add:
|
||||
startActivity(new Intent(this, NewConversationActivity.class));
|
||||
break;
|
||||
|
@ -290,12 +284,12 @@ public class ConversationActivity extends XmppActivity {
|
|||
selectedConversation = conversationList.get(0);
|
||||
break;
|
||||
case R.id.action_contact_details:
|
||||
DialogContactDetails details = new DialogContactDetails();
|
||||
Contact contact = this.getSelectedConversation().getContact();
|
||||
if (contact != null) {
|
||||
contact.setAccount(this.selectedConversation.getAccount());
|
||||
details.setContact(contact);
|
||||
details.show(getFragmentManager(), "details");
|
||||
Intent intent = new Intent(this,ContactDetailsActivity.class);
|
||||
intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT);
|
||||
intent.putExtra("uuid", contact.getUuid());
|
||||
startActivity(intent);
|
||||
} else {
|
||||
String jid = getSelectedConversation().getContactJid();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
|
@ -307,8 +301,8 @@ public class ConversationActivity extends XmppActivity {
|
|||
}
|
||||
break;
|
||||
case R.id.action_muc_details:
|
||||
Intent intent = new Intent(this,MucOptionsActivity.class);
|
||||
intent.setAction(MucOptionsActivity.ACTION_VIEW_MUC);
|
||||
Intent intent = new Intent(this,MucDetailsActivity.class);
|
||||
intent.setAction(MucDetailsActivity.ACTION_VIEW_MUC);
|
||||
intent.putExtra("uuid", getSelectedConversation().getUuid());
|
||||
startActivity(intent);
|
||||
break;
|
||||
|
|
|
@ -109,8 +109,8 @@ public class ConversationFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(),MucOptionsActivity.class);
|
||||
intent.setAction(MucOptionsActivity.ACTION_VIEW_MUC);
|
||||
Intent intent = new Intent(getActivity(),MucDetailsActivity.class);
|
||||
intent.setAction(MucDetailsActivity.ACTION_VIEW_MUC);
|
||||
intent.putExtra("uuid", conversation.getUuid());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
|
|
@ -1,218 +0,0 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Presences;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract.CommonDataKinds;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.provider.ContactsContract.Intents;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.QuickContactBadge;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class DialogContactDetails extends DialogFragment {
|
||||
|
||||
private Contact contact = null;
|
||||
boolean displayingInRoster = false;
|
||||
|
||||
private DialogContactDetails mDetailsDialog = this;
|
||||
private XmppActivity activity;
|
||||
|
||||
private CheckBox send;
|
||||
private CheckBox receive;
|
||||
|
||||
private DialogInterface.OnClickListener askRemoveFromRoster = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle("Delete from roster");
|
||||
builder.setMessage("Do you want to delete "+contact.getJid()+" from your roster. The conversation assoziated with this account will not be removed.");
|
||||
builder.setNegativeButton("Cancel", null);
|
||||
builder.setPositiveButton("Delete",removeFromRoster);
|
||||
builder.create().show();
|
||||
}
|
||||
};
|
||||
|
||||
private DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
activity.xmppConnectionService.deleteContact(contact);
|
||||
mDetailsDialog.dismiss();
|
||||
}
|
||||
};
|
||||
|
||||
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
|
||||
intent.setType(Contacts.CONTENT_ITEM_TYPE);
|
||||
intent.putExtra(Intents.Insert.IM_HANDLE,contact.getJid());
|
||||
intent.putExtra(Intents.Insert.IM_PROTOCOL,CommonDataKinds.Im.PROTOCOL_JABBER);
|
||||
intent.putExtra("finishActivityOnSaveCompleted", true);
|
||||
getActivity().startActivityForResult(intent,0);
|
||||
mDetailsDialog.dismiss();
|
||||
}
|
||||
};
|
||||
|
||||
private DialogInterface.OnClickListener updateSubscriptions = new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
boolean needsUpdating = false;
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.FROM)) {
|
||||
if (!send.isChecked()) {
|
||||
contact.resetSubscriptionOption(Contact.Subscription.FROM);
|
||||
contact.resetSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT);
|
||||
activity.xmppConnectionService.stopPresenceUpdatesTo(contact);
|
||||
needsUpdating=true;
|
||||
}
|
||||
} else {
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT)) {
|
||||
if (!send.isChecked()) {
|
||||
contact.resetSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT);
|
||||
needsUpdating=true;
|
||||
}
|
||||
} else {
|
||||
if (send.isChecked()) {
|
||||
contact.setSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT);
|
||||
needsUpdating=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.TO)) {
|
||||
if (!receive.isChecked()) {
|
||||
contact.resetSubscriptionOption(Contact.Subscription.TO);
|
||||
activity.xmppConnectionService.stopPresenceUpdatesFrom(contact);
|
||||
needsUpdating=true;
|
||||
}
|
||||
} else {
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.ASKING)) {
|
||||
if (!receive.isChecked()) {
|
||||
contact.resetSubscriptionOption(Contact.Subscription.ASKING);
|
||||
activity.xmppConnectionService.stopPresenceUpdatesFrom(contact);
|
||||
needsUpdating=true;
|
||||
}
|
||||
} else {
|
||||
if (receive.isChecked()) {
|
||||
contact.setSubscriptionOption(Contact.Subscription.ASKING);
|
||||
activity.xmppConnectionService.requestPresenceUpdatesFrom(contact);
|
||||
needsUpdating=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needsUpdating) {
|
||||
activity.xmppConnectionService.updateContact(contact);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
this.activity = (XmppActivity) getActivity();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this.activity);
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.dialog_contact_details, null);
|
||||
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_contactstatus);
|
||||
send = (CheckBox) view.findViewById(R.id.details_send_presence);
|
||||
receive = (CheckBox) view.findViewById(R.id.details_receive_presence);
|
||||
//ImageView contactPhoto = (ImageView) view.findViewById(R.id.details_contact_picture);
|
||||
QuickContactBadge badge = (QuickContactBadge) view.findViewById(R.id.details_contact_badge);
|
||||
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.FROM)) {
|
||||
send.setChecked(true);
|
||||
} else {
|
||||
send.setText("Preemptively grant subscription request");
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT)) {
|
||||
send.setChecked(true);
|
||||
} else {
|
||||
send.setChecked(false);
|
||||
}
|
||||
}
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.TO)) {
|
||||
receive.setChecked(true);
|
||||
} else {
|
||||
receive.setText("Request presence updates");
|
||||
if (contact.getSubscriptionOption(Contact.Subscription.ASKING)) {
|
||||
receive.setChecked(true);
|
||||
} else {
|
||||
receive.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
contactJid.setText(contact.getJid());
|
||||
accountJid.setText(contact.getAccount().getJid());
|
||||
|
||||
UIHelper.prepareContactBadge(getActivity(), badge, contact);
|
||||
|
||||
if (contact.getSystemAccount()==null) {
|
||||
badge.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle("Add to phone book");
|
||||
builder.setMessage("Do you want to add "+contact.getJid()+" to your phones contact list?");
|
||||
builder.setNegativeButton("Cancel", null);
|
||||
builder.setPositiveButton("Add",addToPhonebook);
|
||||
builder.create().show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
builder.setView(view);
|
||||
builder.setTitle(contact.getDisplayName());
|
||||
|
||||
builder.setNeutralButton("Done", this.updateSubscriptions);
|
||||
builder.setPositiveButton("Remove from roster", this.askRemoveFromRoster);
|
||||
return builder.create();
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ import android.content.Context;
|
|||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -22,15 +24,13 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MucOptionsActivity extends XmppActivity {
|
||||
public class MucDetailsActivity extends XmppActivity {
|
||||
public static final String ACTION_VIEW_MUC = "view_muc";
|
||||
private XmppActivity activity = this;
|
||||
private Conversation conversation;
|
||||
private EditText mYourNick;
|
||||
private TextView mRoleAffiliaton;
|
||||
private TextView mFullJid;
|
||||
private LinearLayout membersView;
|
||||
private TextView mTextParticipantsHead;
|
||||
private LinearLayout mMoreDetails;
|
||||
private String uuid = null;
|
||||
private ArrayAdapter<User> contactsAdapter;
|
||||
|
@ -56,9 +56,8 @@ public class MucOptionsActivity extends XmppActivity {
|
|||
if (getIntent().getAction().equals(ACTION_VIEW_MUC)) {
|
||||
this.uuid = getIntent().getExtras().getString("uuid");
|
||||
}
|
||||
setContentView(R.layout.muc_options);
|
||||
setContentView(R.layout.activity_muc_details);
|
||||
mYourNick = (EditText) findViewById(R.id.muc_your_nick);
|
||||
mTextParticipantsHead = (TextView) findViewById(R.id.muc_participants_header);
|
||||
mFullJid = (TextView) findViewById(R.id.muc_jabberid);
|
||||
ImageButton imageButton = (ImageButton) findViewById(R.id.muc_edit_nick);
|
||||
imageButton.setOnClickListener(this.changeNickListener);
|
||||
|
@ -86,10 +85,18 @@ public class MucOptionsActivity extends XmppActivity {
|
|||
return view;
|
||||
}
|
||||
};
|
||||
getActionBar().setHomeButtonEnabled(true);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
public void setConversation(Conversation conversation) {
|
||||
this.conversation = conversation;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
}
|
||||
return super.onOptionsItemSelected(menuItem);
|
||||
}
|
||||
|
||||
public String getReadableRole(int role) {
|
||||
|
@ -104,6 +111,12 @@ public class MucOptionsActivity extends XmppActivity {
|
|||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.muc_details, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
void onBackendConnected() {
|
||||
|
@ -114,6 +127,7 @@ public class MucOptionsActivity extends XmppActivity {
|
|||
}
|
||||
}
|
||||
if (this.conversation != null) {
|
||||
setTitle(conversation.getName());
|
||||
mFullJid.setText(conversation.getContactJid().split("/")[0]);
|
||||
mYourNick.setText(conversation.getMucOptions().getNick());
|
||||
mRoleAffiliaton = (TextView) findViewById(R.id.muc_role);
|
||||
|
@ -139,6 +153,7 @@ public class MucOptionsActivity extends XmppActivity {
|
|||
this.users.addAll(conversation.getMucOptions().getUsers());
|
||||
contactsAdapter.notifyDataSetChanged();
|
||||
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
membersView.removeAllViews();
|
||||
for(User contact : conversation.getMucOptions().getUsers()) {
|
||||
View view = (View) inflater.inflate(R.layout.contact, null);
|
||||
|
|
@ -39,7 +39,6 @@ import android.content.Intent;
|
|||
|
||||
public class NewConversationActivity extends XmppActivity {
|
||||
|
||||
protected List<Contact> phoneContacts = new ArrayList<Contact>();
|
||||
protected List<Contact> rosterContacts = new ArrayList<Contact>();
|
||||
protected List<Contact> aggregatedContacts = new ArrayList<Contact>();
|
||||
protected ListView contactsView;
|
||||
|
@ -188,10 +187,10 @@ public class NewConversationActivity extends XmppActivity {
|
|||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
|
||||
int pos, long arg3) {
|
||||
Contact clickedContact = aggregatedContacts.get(pos);
|
||||
DialogContactDetails dialog = new DialogContactDetails();
|
||||
dialog.setContact(clickedContact);
|
||||
dialog.show(getFragmentManager(), "details");
|
||||
Intent intent = new Intent(activity,ContactDetailsActivity.class);
|
||||
intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT);
|
||||
intent.putExtra("uuid", aggregatedContacts.get(pos).getUuid());
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -278,12 +277,6 @@ public class NewConversationActivity extends XmppActivity {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_settings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.action_accounts:
|
||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
||||
break;
|
||||
case R.id.action_refresh_contacts:
|
||||
refreshContacts();
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.siacs.conversations.ui;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinder;
|
||||
import android.app.Activity;
|
||||
|
@ -10,6 +11,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
|
@ -79,4 +81,16 @@ public abstract class XmppActivity extends Activity {
|
|||
}
|
||||
|
||||
abstract void onBackendConnected();
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_settings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.action_accounts:
|
||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue