author | Da Risk <darisk972@gmail.com> |
Mon, 06 Apr 2009 18:20:57 +0200 | |
changeset 73 | 4d9067c5e08e |
parent 72 | cdedc3a25d39 |
child 76 | 144e837ee4a6 |
permissions | -rw-r--r-- |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
1 |
/** |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
2 |
* |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
3 |
*/ |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
4 |
package com.beem.project.beem; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
5 |
|
46 | 6 |
import java.util.LinkedList; |
7 |
import java.util.List; |
|
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
8 |
|
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
9 |
import android.app.Activity; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
10 |
import android.app.Application; |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
11 |
import android.app.ProgressDialog; |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
12 |
import android.content.ComponentName; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
13 |
import android.content.Context; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
14 |
import android.content.Intent; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
15 |
import android.content.ServiceConnection; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
16 |
import android.content.res.Configuration; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
17 |
import android.content.res.Resources; |
46 | 18 |
import android.os.Handler; |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
19 |
import android.os.IBinder; |
46 | 20 |
import android.os.Message; |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
21 |
import android.os.RemoteException; |
46 | 22 |
|
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
23 |
import com.beem.project.beem.service.aidl.IBeemConnectionListener; |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
24 |
import com.beem.project.beem.service.aidl.IXmppConnection; |
67
8c3870db8e31
Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents:
55
diff
changeset
|
25 |
import com.beem.project.beem.service.aidl.IXmppFacade; |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
26 |
|
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
27 |
/** |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
28 |
* The Beem application. This class has some methods utiliy needs by the activities. |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
29 |
* @author darisk |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
30 |
*/ |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
31 |
public class BeemApplication extends Application { |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
32 |
|
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
33 |
private static BeemApplication mBeemApp; |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
34 |
private static final Intent SERVICE_INTENT = new Intent(); |
67
8c3870db8e31
Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents:
55
diff
changeset
|
35 |
private IXmppFacade mFacade; |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
36 |
private Context mApplicationContext; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
37 |
private Resources mPrivateResources; |
46 | 38 |
private List<Message> mQueue = new LinkedList<Message>(); |
47 | 39 |
private boolean mIsConnected; |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
40 |
private IXmppConnection mConnection; |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
41 |
private ProgressDialog mProgressDialog; |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
42 |
private ConnectionListener mConnectionListener = new ConnectionListener(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
43 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
44 |
static { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
45 |
SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService")); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
46 |
} |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
47 |
|
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
48 |
private ServiceConnection mServConn = new ServiceConnection() { |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
49 |
|
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
50 |
@Override |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
51 |
public void onServiceDisconnected(ComponentName name) { |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
52 |
mFacade = null; |
47 | 53 |
mIsConnected = false; |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
54 |
} |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
55 |
|
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
56 |
@Override |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
57 |
public void onServiceConnected(ComponentName name, IBinder service) { |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
58 |
mIsConnected = true; |
67
8c3870db8e31
Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents:
55
diff
changeset
|
59 |
mFacade = IXmppFacade.Stub.asInterface(service); |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
60 |
try { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
61 |
mConnection = mFacade.createConnection(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
62 |
if (!mConnection.isAuthentificated()) { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
63 |
mProgressDialog.show(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
64 |
mConnection.addConnectionListener(mConnectionListener); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
65 |
mApplicationContext.startService(BeemApplication.SERVICE_INTENT); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
66 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
67 |
} catch (RemoteException e) { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
68 |
// TODO Auto-generated catch block |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
69 |
e.printStackTrace(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
70 |
} |
46 | 71 |
synchronized (mQueue) { |
72 |
for (Message msg : mQueue) { |
|
73 |
msg.sendToTarget(); |
|
74 |
} |
|
75 |
mQueue.clear(); |
|
76 |
} |
|
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
77 |
} |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
78 |
}; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
79 |
|
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
80 |
/** |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
81 |
* Constructor. |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
82 |
*/ |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
83 |
public BeemApplication() { |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
84 |
// TODO Auto-generated constructor stub |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
85 |
} |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
86 |
|
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
87 |
/** |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
88 |
* Get the Beem application for an activity. |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
89 |
* @param activity the activity which want the Beem application |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
90 |
* @return the Beem application |
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
91 |
*/ |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
92 |
public static BeemApplication getApplication(Activity activity) { |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
93 |
if (mBeemApp == null) { |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
94 |
mBeemApp = new BeemApplication(); |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
95 |
} |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
96 |
mBeemApp.mProgressDialog = new ProgressDialog(activity); |
73
4d9067c5e08e
Add some thing for the progress dialog
Da Risk <darisk972@gmail.com>
parents:
72
diff
changeset
|
97 |
mBeemApp.mProgressDialog.setTitle("Beem"); |
4d9067c5e08e
Add some thing for the progress dialog
Da Risk <darisk972@gmail.com>
parents:
72
diff
changeset
|
98 |
mBeemApp.mProgressDialog.setIcon(R.drawable.logo); |
4d9067c5e08e
Add some thing for the progress dialog
Da Risk <darisk972@gmail.com>
parents:
72
diff
changeset
|
99 |
mBeemApp.mProgressDialog.setMessage("Connexion en cours"); |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
100 |
mBeemApp.mApplicationContext = activity.getApplication(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
101 |
mBeemApp.mPrivateResources = activity.getResources(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
102 |
mBeemApp.onCreate(); |
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
103 |
return mBeemApp; |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
104 |
} |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
105 |
|
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
106 |
/** |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
107 |
* Start the beem service. |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
108 |
*/ |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
109 |
public synchronized void startBeemService() { |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
110 |
if (!mIsConnected) { |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
111 |
// the connection will be made on service connect |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
112 |
mApplicationContext.bindService(BeemApplication.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); |
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
113 |
} |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
114 |
} |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
115 |
|
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
116 |
/** |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
117 |
* Stop the Beem service. |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
118 |
*/ |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
119 |
public synchronized void stopBeemService() { |
52 | 120 |
if (mIsConnected) { |
121 |
Intent intent = new Intent(); |
|
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
122 |
intent.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService")); |
52 | 123 |
mApplicationContext.unbindService(mServConn); |
124 |
mApplicationContext.stopService(intent); |
|
125 |
mIsConnected = false; |
|
126 |
} |
|
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
127 |
} |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
128 |
|
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
129 |
/** |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
130 |
* Get the facade to use to access the Beem service. |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
131 |
* @return the facade or null if the application is not connected to the beem service. |
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
132 |
*/ |
67
8c3870db8e31
Rename some XMPP* classes in Xmpp*
Da Risk <darisk972@gmail.com>
parents:
55
diff
changeset
|
133 |
public IXmppFacade getXmppFacade() { |
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
134 |
return mFacade; |
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
135 |
} |
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
136 |
|
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
137 |
/** |
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
138 |
* Add a methode to execute when the application is connected to the Beem service. |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
139 |
* @param target the handler which will execute the callback |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
140 |
* @param callback the callback to execute |
55
66732dd2cb77
Add an interface for sending im message.
Da Risk <darisk972@gmail.com>
parents:
47
diff
changeset
|
141 |
*/ |
46 | 142 |
public void callWhenServiceConnected(Handler target, Runnable callback) { |
143 |
Message msg = Message.obtain(target, callback); |
|
47 | 144 |
if (!mIsConnected) { |
46 | 145 |
msg.sendToTarget(); |
146 |
} else { |
|
147 |
startBeemService(); |
|
148 |
synchronized (mQueue) { |
|
149 |
mQueue.add(msg); |
|
150 |
} |
|
151 |
} |
|
152 |
} |
|
52 | 153 |
|
154 |
/** |
|
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
155 |
* Tell if we are connected with the Beem Service. |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
156 |
* @return true if connected false otherwise |
52 | 157 |
*/ |
158 |
public boolean isConnected() { |
|
159 |
return mIsConnected; |
|
160 |
} |
|
161 |
||
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
162 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
163 |
* Connection listener use to hide the progress dialog. |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
164 |
* @author darisk |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
165 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
166 |
private class ConnectionListener extends IBeemConnectionListener.Stub { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
167 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
168 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
169 |
* Constructor. |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
170 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
171 |
public ConnectionListener() { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
172 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
173 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
174 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
175 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
176 |
* {@inheritDoc} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
177 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
178 |
@Override |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
179 |
public void connectionClosed() throws RemoteException { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
180 |
// TODO Auto-generated method stub |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
181 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
182 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
183 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
184 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
185 |
* {@inheritDoc} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
186 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
187 |
@Override |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
188 |
public void connectionClosedOnError() throws RemoteException { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
189 |
// TODO Auto-generated method stub |
73
4d9067c5e08e
Add some thing for the progress dialog
Da Risk <darisk972@gmail.com>
parents:
72
diff
changeset
|
190 |
// afficher une notification et reafficher le progress dialog |
72
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
191 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
192 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
193 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
194 |
* {@inheritDoc} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
195 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
196 |
@Override |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
197 |
public void onConnect() throws RemoteException { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
198 |
// TODO Auto-generated method stub |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
199 |
mProgressDialog.dismiss(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
200 |
mFacade.changeStatus(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
201 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
202 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
203 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
204 |
* {@inheritDoc} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
205 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
206 |
@Override |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
207 |
public void reconnectingIn(int seconds) throws RemoteException { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
208 |
// TODO Auto-generated method stub |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
209 |
mProgressDialog.show(); |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
210 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
211 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
212 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
213 |
* {@inheritDoc} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
214 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
215 |
@Override |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
216 |
public void reconnectionFailed() throws RemoteException { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
217 |
// TODO Auto-generated method stub |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
218 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
219 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
220 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
221 |
/** |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
222 |
* {@inheritDoc} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
223 |
*/ |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
224 |
@Override |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
225 |
public void reconnectionSuccessful() throws RemoteException { |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
226 |
// TODO Auto-generated method stub |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
227 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
228 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
229 |
|
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
230 |
} |
cdedc3a25d39
Show a progress dialog during connection with the server
Da Risk <darisk972@gmail.com>
parents:
68
diff
changeset
|
231 |
|
45
ae035477b6aa
Utilisation d'une application qui gere les informations globales.
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
232 |
} |