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() {
|
private boolean ensureInit() {
|
||||||
if (mBluetoothAdapter == null) {
|
if (mBluetoothAdapter == null) {
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
@ -257,6 +263,8 @@ public class BluetoothManager extends BroadcastReceiver {
|
||||||
if (LinphoneManager.isInstanciated()) {
|
if (LinphoneManager.isInstanciated()) {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshCallView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
@ -279,17 +287,22 @@ public class BluetoothManager extends BroadcastReceiver {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED.equals(action)) {
|
if (AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED.equals(action)) {
|
||||||
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
|
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
|
||||||
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
||||||
Log.d("[Bluetooth] SCO state: connected");
|
Log.d("[Bluetooth] SCO state: connected");
|
||||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.BLUETOOTH);
|
// LinphoneManager.getInstance().audioStateChanged(AudioState.BLUETOOTH);
|
||||||
isScoConnected = true;
|
isScoConnected = true;
|
||||||
} else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) {
|
} else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) {
|
||||||
Log.d("[Bluetooth] SCO state: disconnected");
|
Log.d("[Bluetooth] SCO state: disconnected");
|
||||||
// LinphoneManager.getInstance().audioStateChanged(AudioState.SPEAKER);
|
// LinphoneManager.getInstance().audioStateChanged(AudioState.SPEAKER);
|
||||||
isScoConnected = false;
|
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);
|
Log.d("[Bluetooth] SCO state: " + state);
|
||||||
}
|
}
|
||||||
|
refreshCallView();
|
||||||
}
|
}
|
||||||
else if (BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
|
else if (BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
|
||||||
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, BluetoothAdapter.STATE_DISCONNECTED);
|
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, BluetoothAdapter.STATE_DISCONNECTED);
|
||||||
|
|
|
@ -546,18 +546,20 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isSpeakerEnabled) {
|
routeSpeaker.setImageResource(R.drawable.route_speaker);
|
||||||
routeSpeaker.setImageResource(R.drawable.route_speaker_selected);
|
if (BluetoothManager.getInstance().isUsingBluetoothAudioRoute()) {
|
||||||
|
isSpeakerEnabled = false; // We need this if isSpeakerEnabled wasn't set correctly
|
||||||
routeEarpiece.setImageResource(R.drawable.route_earpiece);
|
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);
|
routeBluetooth.setImageResource(R.drawable.route_bluetooth);
|
||||||
}
|
}
|
||||||
|
|
||||||
routeSpeaker.setImageResource(R.drawable.route_speaker);
|
if (isSpeakerEnabled) {
|
||||||
if (BluetoothManager.getInstance().isUsingBluetoothAudioRoute()) {
|
routeSpeaker.setImageResource(R.drawable.route_speaker_selected);
|
||||||
routeEarpiece.setImageResource(R.drawable.route_earpiece);
|
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);
|
routeBluetooth.setImageResource(R.drawable.route_bluetooth);
|
||||||
}
|
}
|
||||||
} catch (NullPointerException npe) {
|
} 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) {
|
if (routeSpeaker.getVisibility() == View.VISIBLE) {
|
||||||
routeSpeaker.setVisibility(View.INVISIBLE);
|
routeSpeaker.setVisibility(View.INVISIBLE);
|
||||||
routeBluetooth.setVisibility(View.INVISIBLE);
|
routeBluetooth.setVisibility(View.INVISIBLE);
|
||||||
|
|
Loading…
Reference in a new issue