Fixed a small behavior issue in account settigns

This commit is contained in:
Sylvain Berfini 2019-04-05 17:14:14 +02:00
parent 08a6375a65
commit af764b785c
2 changed files with 8 additions and 5 deletions

View file

@ -184,7 +184,8 @@ public class AccountSettingsFragment extends Fragment {
mReplacePlusBy00 = mRootView.findViewById(R.id.pref_escape_plus); mReplacePlusBy00 = mRootView.findViewById(R.id.pref_escape_plus);
mPush = mRootView.findViewById(R.id.pref_push_notification); mPush = mRootView.findViewById(R.id.pref_push_notification);
mPush.setVisibility(PushNotificationUtils.isAvailable(getActivity()) ? View.VISIBLE : View.GONE); mPush.setVisibility(
PushNotificationUtils.isAvailable(getActivity()) ? View.VISIBLE : View.GONE);
mChangePassword = mRootView.findViewById(R.id.pref_change_password); mChangePassword = mRootView.findViewById(R.id.pref_change_password);
mChangePassword.setVisibility(View.GONE); // TODO mChangePassword.setVisibility(View.GONE); // TODO
@ -407,12 +408,12 @@ public class AccountSettingsFragment extends Fragment {
@Override @Override
public void onBoolValueChanged(boolean newValue) { public void onBoolValueChanged(boolean newValue) {
if (mProxyConfig != null) { if (mProxyConfig != null) {
mProxyConfig.edit();
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (core != null) { if (core != null && newValue) {
core.setDefaultProxyConfig(mProxyConfig); core.setDefaultProxyConfig(mProxyConfig);
mUseAsDefault.setEnabled(false);
} }
mProxyConfig.done(); LinphoneActivity.instance().refreshAccounts();
} else { } else {
Log.e("[Account Settings] No proxy config !"); Log.e("[Account Settings] No proxy config !");
} }
@ -617,6 +618,7 @@ public class AccountSettingsFragment extends Fragment {
mUseAsDefault.setChecked( mUseAsDefault.setChecked(
core != null && mProxyConfig.equals(core.getDefaultProxyConfig())); core != null && mProxyConfig.equals(core.getDefaultProxyConfig()));
mUseAsDefault.setEnabled(!mUseAsDefault.isChecked());
mOutboundProxy.setChecked(mProxyConfig.getRoute() != null); mOutboundProxy.setChecked(mProxyConfig.getRoute() != null);

View file

@ -78,7 +78,8 @@ public class NetworkSettingsFragment extends Fragment {
mIpv6 = mRootView.findViewById(R.id.pref_ipv6); mIpv6 = mRootView.findViewById(R.id.pref_ipv6);
mPush = mRootView.findViewById(R.id.pref_push_notification); mPush = mRootView.findViewById(R.id.pref_push_notification);
mPush.setVisibility(PushNotificationUtils.isAvailable(getActivity()) ? View.VISIBLE : View.GONE); mPush.setVisibility(
PushNotificationUtils.isAvailable(getActivity()) ? View.VISIBLE : View.GONE);
mRandomPorts = mRootView.findViewById(R.id.pref_transport_use_random_ports); mRandomPorts = mRootView.findViewById(R.id.pref_transport_use_random_ports);