Display register status in preferences

This commit is contained in:
Sylvain Berfini 2012-07-27 17:39:36 +02:00
parent 7985be5a75
commit 4f373c07e7
5 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:src="@drawable/led_connected"
/>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:src="@drawable/led_error"
/>

View file

@ -331,6 +331,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
// }
}
else if (id == R.id.chat) {
if (chatStorage == null) {
chatStorage = new ChatStorage(this);
}
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
chat.setSelected(true);
}

View file

@ -40,6 +40,7 @@ import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.Log;
import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
@ -158,6 +159,16 @@ public class PreferencesActivity extends LinphonePreferencesActivity implements
return false;
}
});
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
if (lpc.getIdentity().contains(prefs.getString(keyUsername, "")) && lpc.getIdentity().contains(prefs.getString(keyDomain, ""))) {
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk)
me.setWidgetLayoutResource(R.layout.preference_led_connected);
else
me.setWidgetLayoutResource(R.layout.preference_led_not_connected);
}
}
parent.addPreference(me);
}

View file

@ -372,7 +372,8 @@ public class StatusFragment extends Fragment {
ImageView status = (ImageView) view.findViewById(R.id.State);
TextView identity = (TextView) view.findViewById(R.id.Identity);
identity.setText(lpc.getIdentity().split("sip:")[1]);
String sipAddress = lpc.getIdentity().startsWith("sip:") ? lpc.getIdentity().split("sip:")[1] : lpc.getIdentity();
identity.setText(sipAddress);
CheckBox isDefault = (CheckBox) view.findViewById(R.id.Default);
checkboxes.add(isDefault);