2018-01-01 09:06:37 +01:00
|
|
|
package com.wireguard.android.activity;
|
2017-08-09 14:34:28 +02:00
|
|
|
|
|
|
|
import android.app.Activity;
|
2017-08-16 11:34:14 +02:00
|
|
|
import android.os.Bundle;
|
2018-02-07 19:19:20 +01:00
|
|
|
import android.preference.Preference;
|
2017-08-16 11:34:14 +02:00
|
|
|
import android.preference.PreferenceFragment;
|
2017-08-09 14:34:28 +02:00
|
|
|
|
2018-02-07 19:19:20 +01:00
|
|
|
import com.wireguard.android.Application;
|
2018-01-01 09:06:37 +01:00
|
|
|
import com.wireguard.android.R;
|
2018-02-07 19:19:20 +01:00
|
|
|
import com.wireguard.android.backend.WgQuickBackend;
|
2018-01-01 09:06:37 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for changing application-global persistent settings.
|
|
|
|
*/
|
2017-12-19 02:42:00 +01:00
|
|
|
|
2017-08-09 14:34:28 +02:00
|
|
|
public class SettingsActivity extends Activity {
|
2017-08-16 11:34:14 +02:00
|
|
|
@Override
|
|
|
|
protected void onCreate(final Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
2018-01-01 09:06:37 +01:00
|
|
|
if (getFragmentManager().findFragmentById(android.R.id.content) == null) {
|
|
|
|
getFragmentManager().beginTransaction()
|
2018-01-08 04:45:11 +01:00
|
|
|
.add(android.R.id.content, new SettingsFragment())
|
2018-01-01 09:06:37 +01:00
|
|
|
.commit();
|
|
|
|
}
|
2017-08-16 11:34:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static class SettingsFragment extends PreferenceFragment {
|
|
|
|
@Override
|
|
|
|
public void onCreate(final Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
addPreferencesFromResource(R.xml.preferences);
|
2018-02-07 19:19:20 +01:00
|
|
|
if (Application.getComponent().getBackendType() != WgQuickBackend.class) {
|
|
|
|
final Preference toolsInstaller =
|
|
|
|
getPreferenceManager().findPreference("tools_installer");
|
|
|
|
getPreferenceScreen().removePreference(toolsInstaller);
|
|
|
|
}
|
2017-08-16 11:34:14 +02:00
|
|
|
}
|
|
|
|
}
|
2017-08-09 14:34:28 +02:00
|
|
|
}
|