Perform echo canceller calibration for every option of the wizard.
Also perform the calibration only on first start of the application, not when the wizard is run manually.
This commit is contained in:
parent
e597f769e5
commit
d65785b28f
2 changed files with 33 additions and 21 deletions
|
@ -48,6 +48,7 @@ import android.view.ViewGroup;
|
|||
*/
|
||||
public class EchoCancellerCalibrationFragment extends Fragment implements EcCalibrationListener {
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean mSendEcCalibrationResult = false;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -73,7 +74,15 @@ public class EchoCancellerCalibrationFragment extends Fragment implements EcCali
|
|||
editor.putBoolean(getString(R.string.pref_echo_cancellation_key), true);
|
||||
}
|
||||
editor.commit();
|
||||
sendEcCalibrationResult(status, delayMs);
|
||||
if (mSendEcCalibrationResult) {
|
||||
sendEcCalibrationResult(status, delayMs);
|
||||
} else {
|
||||
SetupActivity.instance().isEchoCalibrationFinished();
|
||||
}
|
||||
}
|
||||
|
||||
public void enableEcCalibrationResultSending(boolean enabled) {
|
||||
mSendEcCalibrationResult = enabled;
|
||||
}
|
||||
|
||||
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
|
||||
|
|
|
@ -138,7 +138,22 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void logIn(String username, String password, String domain) {
|
||||
private void launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
|
||||
if (!Hacks.hasBuiltInEchoCanceller() && !mPref.getBoolean(getString(R.string.first_launch_suceeded_once_key), false)) {
|
||||
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
|
||||
fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
|
||||
changeFragment(fragment);
|
||||
currentFragment = SetupFragments.ECHO_CANCELLER_CALIBRATION;
|
||||
back.setVisibility(View.VISIBLE);
|
||||
next.setVisibility(View.GONE);
|
||||
next.setEnabled(false);
|
||||
cancel.setEnabled(false);
|
||||
} else {
|
||||
success();
|
||||
}
|
||||
}
|
||||
|
||||
private void logIn(String username, String password, String domain, boolean sendEcCalibrationResult) {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null && getCurrentFocus() != null) {
|
||||
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
|
||||
|
@ -153,30 +168,18 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
|||
Log.e(e, "Error while initializing from config in first login activity");
|
||||
Toast.makeText(this, getString(R.string.error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
launchEchoCancellerCalibration(sendEcCalibrationResult);
|
||||
}
|
||||
}
|
||||
|
||||
public void linphoneLogIn(String username, String password) {
|
||||
logIn(username, password, getString(R.string.default_domain));
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
if (!Hacks.hasBuiltInEchoCanceller()) {
|
||||
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
|
||||
changeFragment(fragment);
|
||||
currentFragment = SetupFragments.ECHO_CANCELLER_CALIBRATION;
|
||||
back.setVisibility(View.VISIBLE);
|
||||
next.setVisibility(View.GONE);
|
||||
next.setEnabled(false);
|
||||
cancel.setEnabled(false);
|
||||
} else {
|
||||
success();
|
||||
}
|
||||
}
|
||||
logIn(username, password, getString(R.string.default_domain), true);
|
||||
}
|
||||
|
||||
public void genericLogIn(String username, String password, String domain) {
|
||||
logIn(username, password, domain);
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
success();
|
||||
}
|
||||
logIn(username, password, domain, false);
|
||||
}
|
||||
|
||||
private void writePreference(int key, String value) {
|
||||
|
@ -269,7 +272,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
|||
Toast.makeText(this, getString(R.string.error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
success();
|
||||
launchEchoCancellerCalibration(true);
|
||||
}
|
||||
|
||||
public void isEchoCalibrationFinished() {
|
||||
|
|
Loading…
Reference in a new issue