Few fixes
This commit is contained in:
parent
59cebf7dfc
commit
fcb4ebc5dd
3 changed files with 30 additions and 25 deletions
|
@ -190,10 +190,6 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
|
mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
mR = c.getResources();
|
mR = c.getResources();
|
||||||
|
|
||||||
if (mR.getBoolean(R.bool.enable_log_collect)) {
|
|
||||||
LinphoneUtils.clearLogs();
|
|
||||||
}
|
|
||||||
|
|
||||||
chatStorage = new ChatStorage(mServiceContext);
|
chatStorage = new ChatStorage(mServiceContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +211,6 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
private void routeAudioToSpeakerHelper(boolean speakerOn) {
|
||||||
isUsingBluetoothAudioRoute = false;
|
isUsingBluetoothAudioRoute = false;
|
||||||
if (mAudioManager != null) {
|
if (mAudioManager != null) {
|
||||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
|
||||||
mAudioManager.stopBluetoothSco();
|
mAudioManager.stopBluetoothSco();
|
||||||
mAudioManager.setBluetoothScoOn(false);
|
mAudioManager.setBluetoothScoOn(false);
|
||||||
}
|
}
|
||||||
|
@ -1214,6 +1209,10 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state == LinphoneCall.State.Connected) {
|
||||||
|
Log.d("Audio focus requested: " + mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN));
|
||||||
|
}
|
||||||
|
|
||||||
if (state == IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
|
if (state == IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
|
||||||
// Brighten screen for at least 10 seconds
|
// Brighten screen for at least 10 seconds
|
||||||
|
@ -1228,6 +1227,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == CallEnd || state == Error) {
|
if (state == CallEnd || state == Error) {
|
||||||
|
Log.d("Audio focus released: " + mAudioManager.abandonAudioFocus(null));
|
||||||
Context activity = getContext();
|
Context activity = getContext();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
|
|
@ -42,9 +42,10 @@ import android.widget.Toast;
|
||||||
public class SetupActivity extends FragmentActivity implements OnClickListener {
|
public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
private static SetupActivity instance;
|
private static SetupActivity instance;
|
||||||
private RelativeLayout back, next, cancel;
|
private RelativeLayout back, next, cancel;
|
||||||
private SetupFragment currentFragment;
|
private SetupFragmentsEnum currentFragment;
|
||||||
private SharedPreferences mPref;
|
private SharedPreferences mPref;
|
||||||
private SetupFragment firstFragment;
|
private SetupFragmentsEnum firstFragment;
|
||||||
|
private boolean accountCreated = false;
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -55,12 +56,12 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
|
|
||||||
setContentView(R.layout.setup);
|
setContentView(R.layout.setup);
|
||||||
firstFragment = getResources().getBoolean(R.bool.setup_use_linphone_as_first_fragment) ?
|
firstFragment = getResources().getBoolean(R.bool.setup_use_linphone_as_first_fragment) ?
|
||||||
SetupFragment.LINPHONE_LOGIN : SetupFragment.WELCOME;
|
SetupFragmentsEnum.LINPHONE_LOGIN : SetupFragmentsEnum.WELCOME;
|
||||||
if (findViewById(R.id.fragmentContainer) != null) {
|
if (findViewById(R.id.fragmentContainer) != null) {
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
display(firstFragment);
|
display(firstFragment);
|
||||||
} else {
|
} else {
|
||||||
currentFragment = (SetupFragment) savedInstanceState.getSerializable("CurrentFragment");
|
currentFragment = (SetupFragmentsEnum) savedInstanceState.getSerializable("CurrentFragment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,14 +110,14 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} else if (id == R.id.setup_next) {
|
} else if (id == R.id.setup_next) {
|
||||||
if (currentFragment == SetupFragment.WELCOME) {
|
if (currentFragment == SetupFragmentsEnum.WELCOME) {
|
||||||
MenuFragment fragment = new MenuFragment();
|
MenuFragment fragment = new MenuFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.MENU;
|
currentFragment = SetupFragmentsEnum.MENU;
|
||||||
|
|
||||||
next.setVisibility(View.GONE);
|
next.setVisibility(View.GONE);
|
||||||
back.setVisibility(View.VISIBLE);
|
back.setVisibility(View.VISIBLE);
|
||||||
} else if (currentFragment == SetupFragment.WIZARD_CONFIRM) {
|
} else if (currentFragment == SetupFragmentsEnum.WIZARD_CONFIRM) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} else if (id == R.id.setup_back) {
|
} else if (id == R.id.setup_back) {
|
||||||
|
@ -133,18 +134,18 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentFragment == SetupFragment.MENU) {
|
if (currentFragment == SetupFragmentsEnum.MENU) {
|
||||||
WelcomeFragment fragment = new WelcomeFragment();
|
WelcomeFragment fragment = new WelcomeFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.WELCOME;
|
currentFragment = SetupFragmentsEnum.WELCOME;
|
||||||
|
|
||||||
next.setVisibility(View.VISIBLE);
|
next.setVisibility(View.VISIBLE);
|
||||||
back.setVisibility(View.GONE);
|
back.setVisibility(View.GONE);
|
||||||
} else if (currentFragment == SetupFragment.GENERIC_LOGIN || currentFragment == SetupFragment.LINPHONE_LOGIN || currentFragment == SetupFragment.WIZARD) {
|
} else if (currentFragment == SetupFragmentsEnum.GENERIC_LOGIN || currentFragment == SetupFragmentsEnum.LINPHONE_LOGIN || currentFragment == SetupFragmentsEnum.WIZARD) {
|
||||||
MenuFragment fragment = new MenuFragment();
|
MenuFragment fragment = new MenuFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.MENU;
|
currentFragment = SetupFragmentsEnum.MENU;
|
||||||
} else if (currentFragment == SetupFragment.WELCOME) {
|
} else if (currentFragment == SetupFragmentsEnum.WELCOME) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +155,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
|
EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
|
||||||
fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
|
fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.ECHO_CANCELLER_CALIBRATION;
|
currentFragment = SetupFragmentsEnum.ECHO_CANCELLER_CALIBRATION;
|
||||||
back.setVisibility(View.VISIBLE);
|
back.setVisibility(View.VISIBLE);
|
||||||
next.setVisibility(View.GONE);
|
next.setVisibility(View.GONE);
|
||||||
next.setEnabled(false);
|
next.setEnabled(false);
|
||||||
|
@ -209,7 +210,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
mPref.edit().putBoolean(getString(key), value).commit();
|
mPref.edit().putBoolean(getString(key), value).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(SetupFragment fragment) {
|
private void display(SetupFragmentsEnum fragment) {
|
||||||
switch (fragment) {
|
switch (fragment) {
|
||||||
case WELCOME:
|
case WELCOME:
|
||||||
displayWelcome();
|
displayWelcome();
|
||||||
|
@ -224,28 +225,31 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
|
|
||||||
public void displayWelcome() {
|
public void displayWelcome() {
|
||||||
changeFragment(new WelcomeFragment());
|
changeFragment(new WelcomeFragment());
|
||||||
currentFragment = SetupFragment.WELCOME;
|
currentFragment = SetupFragmentsEnum.WELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayLoginGeneric() {
|
public void displayLoginGeneric() {
|
||||||
GenericLoginFragment fragment = new GenericLoginFragment();
|
GenericLoginFragment fragment = new GenericLoginFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.GENERIC_LOGIN;
|
currentFragment = SetupFragmentsEnum.GENERIC_LOGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayLoginLinphone() {
|
public void displayLoginLinphone() {
|
||||||
LinphoneLoginFragment fragment = new LinphoneLoginFragment();
|
LinphoneLoginFragment fragment = new LinphoneLoginFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.LINPHONE_LOGIN;
|
currentFragment = SetupFragmentsEnum.LINPHONE_LOGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayWizard() {
|
public void displayWizard() {
|
||||||
WizardFragment fragment = new WizardFragment();
|
WizardFragment fragment = new WizardFragment();
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = SetupFragment.WIZARD;
|
currentFragment = SetupFragmentsEnum.WIZARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveCreatedAccount(String username, String password, String domain) {
|
public void saveCreatedAccount(String username, String password, String domain) {
|
||||||
|
if (accountCreated)
|
||||||
|
return;
|
||||||
|
|
||||||
int newAccountId = mPref.getInt(getString(R.string.pref_extra_accounts), 0);
|
int newAccountId = mPref.getInt(getString(R.string.pref_extra_accounts), 0);
|
||||||
if (newAccountId == -1)
|
if (newAccountId == -1)
|
||||||
newAccountId = 0;
|
newAccountId = 0;
|
||||||
|
@ -283,6 +287,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
writePreference(R.string.pref_enable_outbound_proxy_key, true);
|
writePreference(R.string.pref_enable_outbound_proxy_key, true);
|
||||||
writePreference(R.string.pref_proxy_key, forcedProxy);
|
writePreference(R.string.pref_proxy_key, forcedProxy);
|
||||||
}
|
}
|
||||||
|
accountCreated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayWizardConfirm(String username) {
|
public void displayWizardConfirm(String username) {
|
||||||
|
@ -293,7 +298,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
|
||||||
fragment.setArguments(extras);
|
fragment.setArguments(extras);
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
|
|
||||||
currentFragment = SetupFragment.WIZARD_CONFIRM;
|
currentFragment = SetupFragmentsEnum.WIZARD_CONFIRM;
|
||||||
|
|
||||||
next.setVisibility(View.VISIBLE);
|
next.setVisibility(View.VISIBLE);
|
||||||
next.setEnabled(false);
|
next.setEnabled(false);
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
/**
|
/**
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
public enum SetupFragment {
|
public enum SetupFragmentsEnum {
|
||||||
WELCOME,
|
WELCOME,
|
||||||
MENU,
|
MENU,
|
||||||
WIZARD,
|
WIZARD,
|
Loading…
Reference in a new issue