author | Da Risk <darisk972@gmail.com> |
Fri, 29 May 2009 20:34:30 +0200 | |
changeset 224 | d8e2cb1eb895 |
parent 212 | bbc0b169cdf0 |
parent 222 | f72be51936d5 |
child 233 | 3e59c9dd8929 |
permissions | -rw-r--r-- |
196 | 1 |
package com.beem.project.beem.ui; |
2 |
||
207
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
3 |
import org.jivesoftware.smack.packet.Presence; |
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
4 |
|
196 | 5 |
import android.app.Activity; |
6 |
import android.app.Dialog; |
|
7 |
import android.content.Context; |
|
8 |
import android.content.Intent; |
|
207
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
9 |
import android.os.RemoteException; |
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
10 |
import android.util.Log; |
196 | 11 |
import android.view.View; |
12 |
import android.widget.Button; |
|
13 |
||
207
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
14 |
import com.beem.project.beem.BeemApplication; |
196 | 15 |
import com.beem.project.beem.R; |
16 |
import com.beem.project.beem.service.Contact; |
|
207
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
17 |
import com.beem.project.beem.service.PresenceAdapter; |
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
18 |
import com.beem.project.beem.service.aidl.IXmppFacade; |
196 | 19 |
|
20 |
public class ContactDialog extends Dialog { |
|
21 |
||
212 | 22 |
class aliasListener implements View.OnClickListener { |
23 |
||
24 |
@Override |
|
25 |
public void onClick(View v) { |
|
26 |
||
27 |
ContactDialogAliasDialog dialog = new ContactDialogAliasDialog(mContext, mContact); |
|
28 |
dialog.setOwnerActivity(ContactDialog.this.getOwnerActivity()); |
|
29 |
dialog.initService(); |
|
30 |
dialog.show(); |
|
31 |
} |
|
32 |
||
33 |
} |
|
34 |
||
35 |
class chatListener implements View.OnClickListener { |
|
36 |
||
37 |
@Override |
|
38 |
public void onClick(View v) { |
|
39 |
Activity a = ContactDialog.this.getOwnerActivity(); |
|
40 |
Intent i = new Intent(mContext, SendIM.class); |
|
41 |
i.putExtra("contact", mContact); |
|
42 |
a.startActivity(i); |
|
43 |
dismiss(); |
|
44 |
} |
|
45 |
||
46 |
} |
|
47 |
||
48 |
class groupListener implements View.OnClickListener { |
|
49 |
||
50 |
@Override |
|
51 |
public void onClick(View v) { |
|
52 |
// TODO Auto-generated method stub |
|
53 |
dismiss(); |
|
54 |
} |
|
55 |
||
56 |
} |
|
57 |
||
58 |
class infosListener implements View.OnClickListener { |
|
59 |
||
60 |
@Override |
|
61 |
public void onClick(View v) { |
|
62 |
// TODO Auto-generated method stub |
|
63 |
dismiss(); |
|
64 |
} |
|
65 |
||
66 |
} |
|
67 |
||
68 |
class resendListener implements View.OnClickListener { |
|
69 |
||
70 |
@Override |
|
71 |
public void onClick(View v) { |
|
72 |
Presence presencePacket = new Presence(Presence.Type.subscribe); |
|
73 |
presencePacket.setTo(mContact.getJID()); |
|
74 |
try { |
|
75 |
mService.sendPresencePacket(new PresenceAdapter(presencePacket)); |
|
76 |
} catch (RemoteException e) { |
|
77 |
Log.e(TAG, "resend subscription error", e); |
|
78 |
} |
|
79 |
dismiss(); |
|
80 |
} |
|
81 |
||
82 |
} |
|
83 |
||
207
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
84 |
public static final String TAG = "Option Dialog"; |
212 | 85 |
|
86 |
private Contact mContact; |
|
87 |
||
88 |
private Context mContext; |
|
89 |
||
90 |
private IXmppFacade mService; |
|
196 | 91 |
|
199 | 92 |
public ContactDialog(final Context context, Contact curContact) { |
196 | 93 |
super(context); |
94 |
mContext = context; |
|
209 | 95 |
|
196 | 96 |
setContentView(R.layout.contactdialog); |
198 | 97 |
mContact = curContact; |
98 |
setTitle(curContact.getJID()); |
|
201 | 99 |
|
200 | 100 |
Button chat = (Button) findViewById(R.id.CDChat); |
201 | 101 |
chat.setOnClickListener(new chatListener()); |
209 | 102 |
Button alias = (Button) findViewById(R.id.CDAlias); |
204 | 103 |
alias.setOnClickListener(new aliasListener()); |
201 | 104 |
Button group = (Button) findViewById(R.id.CDGroup); |
204 | 105 |
group.setOnClickListener(new groupListener()); |
201 | 106 |
Button resend = (Button) findViewById(R.id.CDResend); |
204 | 107 |
resend.setOnClickListener(new resendListener()); |
201 | 108 |
Button infos = (Button) findViewById(R.id.CDInfos); |
204 | 109 |
infos.setOnClickListener(new infosListener()); |
201 | 110 |
} |
111 |
||
207
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
112 |
public void initService() { |
dbc0c467c3e6
ajout de la gestion du resend de la subscription request
nikita@nikita-lab
parents:
206
diff
changeset
|
113 |
mService = BeemApplication.getApplication(ContactDialog.this.getOwnerActivity()).getXmppFacade(); |
201 | 114 |
} |
115 |
||
196 | 116 |
} |