Fix UI in call view
This commit is contained in:
parent
80c5c0226f
commit
9b28d555fe
2 changed files with 28 additions and 14 deletions
|
@ -129,6 +129,12 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
}
|
||||
}
|
||||
|
||||
private void refreshCallView() {
|
||||
if (CallActivity.isInstanciated()) {
|
||||
CallActivity.instance().refreshInCallActions();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ensureInit() {
|
||||
if (mBluetoothAdapter == null) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
|
@ -257,6 +263,8 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
if (LinphoneManager.isInstanciated()) {
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
}
|
||||
|
||||
refreshCallView();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
@ -279,17 +287,22 @@ public class BluetoothManager extends BroadcastReceiver {
|
|||
String action = intent.getAction();
|
||||
if (AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED.equals(action)) {
|
||||
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
|
||||
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
||||
Log.d("[Bluetooth] SCO state: connected");
|
||||
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
||||
Log.d("[Bluetooth] SCO state: connected");
|
||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.BLUETOOTH);
|
||||
isScoConnected = true;
|
||||
} else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) {
|
||||
Log.d("[Bluetooth] SCO state: disconnected");
|
||||
} else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) {
|
||||
Log.d("[Bluetooth] SCO state: disconnected");
|
||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.SPEAKER);
|
||||
isScoConnected = false;
|
||||
} else {
|
||||
} else if (state == AudioManager.SCO_AUDIO_STATE_CONNECTING) {
|
||||
Log.d("[Bluetooth] SCO state: connecting");
|
||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.BLUETOOTH);
|
||||
isScoConnected = true;
|
||||
} else {
|
||||
Log.d("[Bluetooth] SCO state: " + state);
|
||||
}
|
||||
refreshCallView();
|
||||
}
|
||||
else if (BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
|
||||
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, BluetoothAdapter.STATE_DISCONNECTED);
|
||||
|
|
|
@ -546,18 +546,20 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
try {
|
||||
if (isSpeakerEnabled) {
|
||||
routeSpeaker.setImageResource(R.drawable.route_speaker_selected);
|
||||
routeSpeaker.setImageResource(R.drawable.route_speaker);
|
||||
if (BluetoothManager.getInstance().isUsingBluetoothAudioRoute()) {
|
||||
isSpeakerEnabled = false; // We need this if isSpeakerEnabled wasn't set correctly
|
||||
routeEarpiece.setImageResource(R.drawable.route_earpiece);
|
||||
routeBluetooth.setImageResource(R.drawable.route_bluetooth_selected);
|
||||
return;
|
||||
} else {
|
||||
routeEarpiece.setImageResource(R.drawable.route_earpiece_selected);
|
||||
routeBluetooth.setImageResource(R.drawable.route_bluetooth);
|
||||
}
|
||||
|
||||
routeSpeaker.setImageResource(R.drawable.route_speaker);
|
||||
if (BluetoothManager.getInstance().isUsingBluetoothAudioRoute()) {
|
||||
if (isSpeakerEnabled) {
|
||||
routeSpeaker.setImageResource(R.drawable.route_speaker_selected);
|
||||
routeEarpiece.setImageResource(R.drawable.route_earpiece);
|
||||
routeBluetooth.setImageResource(R.drawable.route_bluetooth_selected);
|
||||
} else {
|
||||
routeEarpiece.setImageResource(R.drawable.route_earpiece_selected);
|
||||
routeBluetooth.setImageResource(R.drawable.route_bluetooth);
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
|
@ -1008,8 +1010,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
}
|
||||
|
||||
private void hideOrDisplayAudioRoutes()
|
||||
{
|
||||
private void hideOrDisplayAudioRoutes() {
|
||||
if (routeSpeaker.getVisibility() == View.VISIBLE) {
|
||||
routeSpeaker.setVisibility(View.INVISIBLE);
|
||||
routeBluetooth.setVisibility(View.INVISIBLE);
|
||||
|
|
Loading…
Reference in a new issue