Added back dual tunnel mode settings
This commit is contained in:
parent
d3282648c3
commit
c67f4ee335
4 changed files with 115 additions and 1 deletions
|
@ -900,6 +900,53 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTunnelHost2() {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if (config != null) {
|
||||||
|
return config.getHost2();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTunnelHost2(String host) {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if (config != null) {
|
||||||
|
config.setHost2(host);
|
||||||
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTunnelPort2() {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if (config != null) {
|
||||||
|
return config.getPort2();
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTunnelPort2(int port) {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if (config != null) {
|
||||||
|
config.setPort2(port);
|
||||||
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableTunnelDualMode(boolean enable) {
|
||||||
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
|
getLc().getTunnel().enableDualMode(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTunnelDualModeEnabled() {
|
||||||
|
Tunnel tunnel = getLc().getTunnel();
|
||||||
|
if (tunnel != null) {
|
||||||
|
return tunnel.dualModeEnabled();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTunnelMode() {
|
public String getTunnelMode() {
|
||||||
return getConfig().getString("app", "tunnel", null);
|
return getConfig().getString("app", "tunnel", null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,15 @@ import org.linphone.R;
|
||||||
import org.linphone.core.tools.Log;
|
import org.linphone.core.tools.Log;
|
||||||
import org.linphone.settings.widget.ListSetting;
|
import org.linphone.settings.widget.ListSetting;
|
||||||
import org.linphone.settings.widget.SettingListenerBase;
|
import org.linphone.settings.widget.SettingListenerBase;
|
||||||
|
import org.linphone.settings.widget.SwitchSetting;
|
||||||
import org.linphone.settings.widget.TextSetting;
|
import org.linphone.settings.widget.TextSetting;
|
||||||
|
|
||||||
public class TunnelSettingsFragment extends SettingsFragment {
|
public class TunnelSettingsFragment extends SettingsFragment {
|
||||||
private View mRootView;
|
private View mRootView;
|
||||||
private LinphonePreferences mPrefs;
|
private LinphonePreferences mPrefs;
|
||||||
|
|
||||||
private TextSetting mHost, mPort;
|
private TextSetting mHost, mPort, mHost2, mPort2;
|
||||||
|
private SwitchSetting mDualMode;
|
||||||
private ListSetting mMode;
|
private ListSetting mMode;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -64,7 +66,14 @@ public class TunnelSettingsFragment extends SettingsFragment {
|
||||||
mPort = mRootView.findViewById(R.id.pref_tunnel_port);
|
mPort = mRootView.findViewById(R.id.pref_tunnel_port);
|
||||||
mPort.setInputType(InputType.TYPE_CLASS_NUMBER);
|
mPort.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
|
||||||
|
mHost2 = mRootView.findViewById(R.id.pref_tunnel_host_2);
|
||||||
|
|
||||||
|
mPort2 = mRootView.findViewById(R.id.pref_tunnel_port_2);
|
||||||
|
mPort2.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
|
||||||
mMode = mRootView.findViewById(R.id.pref_tunnel_mode);
|
mMode = mRootView.findViewById(R.id.pref_tunnel_mode);
|
||||||
|
|
||||||
|
mDualMode = mRootView.findViewById(R.id.pref_tunnel_dual_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListeners() {
|
private void setListeners() {
|
||||||
|
@ -88,6 +97,26 @@ public class TunnelSettingsFragment extends SettingsFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mHost2.setListener(
|
||||||
|
new SettingListenerBase() {
|
||||||
|
@Override
|
||||||
|
public void onTextValueChanged(String newValue) {
|
||||||
|
mPrefs.setTunnelHost2(newValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mPort2.setListener(
|
||||||
|
new SettingListenerBase() {
|
||||||
|
@Override
|
||||||
|
public void onTextValueChanged(String newValue) {
|
||||||
|
try {
|
||||||
|
mPrefs.setTunnelPort2(Integer.valueOf(newValue));
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
Log.e(nfe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mMode.setListener(
|
mMode.setListener(
|
||||||
new SettingListenerBase() {
|
new SettingListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,6 +124,14 @@ public class TunnelSettingsFragment extends SettingsFragment {
|
||||||
mPrefs.setTunnelMode(newValue);
|
mPrefs.setTunnelMode(newValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mDualMode.setListener(
|
||||||
|
new SettingListenerBase() {
|
||||||
|
@Override
|
||||||
|
public void onBoolValueChanged(boolean newValue) {
|
||||||
|
mPrefs.enableTunnelDualMode(newValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateValues() {
|
private void updateValues() {
|
||||||
|
@ -102,8 +139,14 @@ public class TunnelSettingsFragment extends SettingsFragment {
|
||||||
|
|
||||||
mPort.setValue(mPrefs.getTunnelPort());
|
mPort.setValue(mPrefs.getTunnelPort());
|
||||||
|
|
||||||
|
mHost2.setValue(mPrefs.getTunnelHost2());
|
||||||
|
|
||||||
|
mPort2.setValue(mPrefs.getTunnelPort2());
|
||||||
|
|
||||||
mMode.setValue(mPrefs.getTunnelMode());
|
mMode.setValue(mPrefs.getTunnelMode());
|
||||||
|
|
||||||
|
mDualMode.setChecked(mPrefs.isTunnelDualModeEnabled());
|
||||||
|
|
||||||
setListeners();
|
setListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,27 @@
|
||||||
linphone:hint="@string/pref_tunnel_port"
|
linphone:hint="@string/pref_tunnel_port"
|
||||||
linphone:title="@string/pref_tunnel_port" />
|
linphone:title="@string/pref_tunnel_port" />
|
||||||
|
|
||||||
|
<org.linphone.settings.widget.SwitchSetting
|
||||||
|
android:id="@+id/pref_tunnel_dual_mode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
linphone:hint="@string/pref_tunnel_dual_mode"
|
||||||
|
linphone:title="@string/pref_tunnel_dual_mode" />
|
||||||
|
|
||||||
|
<org.linphone.settings.widget.TextSetting
|
||||||
|
android:id="@+id/pref_tunnel_host_2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
linphone:hint="@string/pref_tunnel_host_2"
|
||||||
|
linphone:title="@string/pref_tunnel_host_2" />
|
||||||
|
|
||||||
|
<org.linphone.settings.widget.TextSetting
|
||||||
|
android:id="@+id/pref_tunnel_port_2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
linphone:hint="@string/pref_tunnel_port_2"
|
||||||
|
linphone:title="@string/pref_tunnel_port_2" />
|
||||||
|
|
||||||
<org.linphone.settings.widget.ListSetting
|
<org.linphone.settings.widget.ListSetting
|
||||||
android:id="@+id/pref_tunnel_mode"
|
android:id="@+id/pref_tunnel_mode"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -386,6 +386,9 @@
|
||||||
<string name="pref_tunnel_title">Tunnel</string>
|
<string name="pref_tunnel_title">Tunnel</string>
|
||||||
<string name="pref_tunnel_host">Hostname</string>
|
<string name="pref_tunnel_host">Hostname</string>
|
||||||
<string name="pref_tunnel_port">Port</string>
|
<string name="pref_tunnel_port">Port</string>
|
||||||
|
<string name="pref_tunnel_dual_mode">Enable dual mode</string>
|
||||||
|
<string name="pref_tunnel_host_2">Hostname (2nd server for dual mode)</string>
|
||||||
|
<string name="pref_tunnel_port_2">Port (2nd server for dual mode)</string>
|
||||||
<string name="pref_tunnel_mode">Mode</string>
|
<string name="pref_tunnel_mode">Mode</string>
|
||||||
<!--do not change order without changing corresponding entry_values in non_localizable_strings.xml-->
|
<!--do not change order without changing corresponding entry_values in non_localizable_strings.xml-->
|
||||||
<string-array name="tunnel_mode_entries">
|
<string-array name="tunnel_mode_entries">
|
||||||
|
|
Loading…
Reference in a new issue