Fix issue with status bar
This commit is contained in:
parent
d38965b693
commit
bde8fdff1a
3 changed files with 15 additions and 13 deletions
|
@ -106,7 +106,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
initButtons();
|
initButtons();
|
||||||
|
|
||||||
if (LinphoneManager.isInstanciated()) {
|
if (LinphoneManager.isInstanciated()) {
|
||||||
LinphoneManager.addListener(this);
|
LinphoneManager.addListener(this);
|
||||||
|
@ -353,10 +353,15 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
|
|
||||||
public void updateStatusFragment(StatusFragment fragment) {
|
public void updateStatusFragment(StatusFragment fragment) {
|
||||||
statusFragment = fragment;
|
statusFragment = fragment;
|
||||||
|
|
||||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||||
statusFragment.registrationStateChanged(LinphoneManager.getLc().getDefaultProxyConfig().getState());
|
statusFragment.registrationStateChanged(LinphoneManager.getLc().getDefaultProxyConfig().getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StatusFragment getStatusFragment() {
|
||||||
|
return statusFragment;
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<String> getChatList() {
|
public ArrayList<String> getChatList() {
|
||||||
if (chatStorage != null) {
|
if (chatStorage != null) {
|
||||||
|
@ -470,8 +475,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
changeCurrentFragment(FragmentsAvailable.DIALER, null);
|
changeCurrentFragment(FragmentsAvailable.DIALER, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRegistrationStateChanged(RegistrationState state,
|
public void onRegistrationStateChanged(RegistrationState state, String message) {
|
||||||
String message) {
|
|
||||||
if (statusFragment != null) {
|
if (statusFragment != null) {
|
||||||
statusFragment.registrationStateChanged(state);
|
statusFragment.registrationStateChanged(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,14 +471,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
||||||
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
|
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == RegistrationState.RegistrationOk || state == RegistrationState.RegistrationFailed) {
|
mHandler.post(new Runnable() {
|
||||||
mHandler.post(new Runnable() {
|
public void run() {
|
||||||
public void run() {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
if (LinphoneActivity.isInstanciated())
|
LinphoneActivity.instance().onRegistrationStateChanged(state, message);
|
||||||
LinphoneActivity.instance().onRegistrationStateChanged(state, message);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivityToLaunchOnIncomingReceived(Class<? extends Activity> activity) {
|
public void setActivityToLaunchOnIncomingReceived(Class<? extends Activity> activity) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class StatusFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
|
isAttached = true;
|
||||||
|
|
||||||
if (activity instanceof LinphoneActivity) {
|
if (activity instanceof LinphoneActivity) {
|
||||||
((LinphoneActivity) activity).updateStatusFragment(this);
|
((LinphoneActivity) activity).updateStatusFragment(this);
|
||||||
|
@ -75,8 +76,6 @@ public class StatusFragment extends Fragment {
|
||||||
((InCallActivity) activity).updateStatusFragment(this);
|
((InCallActivity) activity).updateStatusFragment(this);
|
||||||
isInCall = true;
|
isInCall = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
isAttached = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,7 +92,7 @@ public class StatusFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (state == RegistrationState.RegistrationOk) {
|
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) {
|
||||||
statusLed.setImageResource(R.drawable.connected_led);
|
statusLed.setImageResource(R.drawable.connected_led);
|
||||||
statusText.setText(getString(R.string.status_connected));
|
statusText.setText(getString(R.string.status_connected));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue