Fix preference led bad behavior
This commit is contained in:
parent
edf44abd56
commit
1a1472233e
1 changed files with 9 additions and 1 deletions
|
@ -384,13 +384,21 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
|
||||||
parent.addPreference(me);
|
parent.addPreference(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAccountLed(LedPreference me, String username, String domain) {
|
private void updateAccountLed(final LedPreference me, final String username, final String domain) {
|
||||||
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
||||||
if (lpc.getIdentity().contains(username) && lpc.getIdentity().contains(domain)) {
|
if (lpc.getIdentity().contains(username) && lpc.getIdentity().contains(domain)) {
|
||||||
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) {
|
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) {
|
||||||
me.setLed(R.drawable.led_connected);
|
me.setLed(R.drawable.led_connected);
|
||||||
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationFailed) {
|
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationFailed) {
|
||||||
me.setLed(R.drawable.led_error);
|
me.setLed(R.drawable.led_error);
|
||||||
|
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationProgress) {
|
||||||
|
me.setLed(R.drawable.led_inprogress);
|
||||||
|
mHandler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateAccountLed(me, username, domain);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
me.setLed(R.drawable.led_disconnected);
|
me.setLed(R.drawable.led_disconnected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue