Display register status in preferences
This commit is contained in:
parent
7985be5a75
commit
4f373c07e7
5 changed files with 32 additions and 1 deletions
8
res/layout/preference_led_connected.xml
Normal file
8
res/layout/preference_led_connected.xml
Normal 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"
|
||||||
|
/>
|
8
res/layout/preference_led_not_connected.xml
Normal file
8
res/layout/preference_led_not_connected.xml
Normal 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"
|
||||||
|
/>
|
|
@ -331,6 +331,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
else if (id == R.id.chat) {
|
else if (id == R.id.chat) {
|
||||||
|
if (chatStorage == null) {
|
||||||
|
chatStorage = new ChatStorage(this);
|
||||||
|
}
|
||||||
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
|
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
|
||||||
chat.setSelected(true);
|
chat.setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
@ -158,6 +159,16 @@ public class PreferencesActivity extends LinphonePreferencesActivity implements
|
||||||
return false;
|
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);
|
parent.addPreference(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -372,7 +372,8 @@ public class StatusFragment extends Fragment {
|
||||||
ImageView status = (ImageView) view.findViewById(R.id.State);
|
ImageView status = (ImageView) view.findViewById(R.id.State);
|
||||||
|
|
||||||
TextView identity = (TextView) view.findViewById(R.id.Identity);
|
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);
|
CheckBox isDefault = (CheckBox) view.findViewById(R.id.Default);
|
||||||
checkboxes.add(isDefault);
|
checkboxes.add(isDefault);
|
||||||
|
|
Loading…
Reference in a new issue