Remove primary configuration preference

It is no longer used.

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland 2018-01-07 21:45:11 -06:00
parent 16c0b5b15a
commit 38b2aafce8
4 changed files with 1 additions and 60 deletions

View File

@ -1,7 +1,6 @@
package com.wireguard.android.activity;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
@ -9,7 +8,6 @@ import android.preference.Preference;
import android.preference.PreferenceFragment;
import com.wireguard.android.R;
import com.wireguard.android.preference.TunnelListPreference;
import com.wireguard.android.util.RootShell;
/**
@ -17,16 +15,12 @@ import com.wireguard.android.util.RootShell;
*/
public class SettingsActivity extends Activity {
public static final String KEY_SHOW_QUICK_TILE_SETTINGS = "show_quick_tile_settings";
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getFragmentManager().findFragmentById(android.R.id.content) == null) {
final Fragment fragment = new SettingsFragment();
fragment.setArguments(getIntent().getExtras());
getFragmentManager().beginTransaction()
.add(android.R.id.content, fragment)
.add(android.R.id.content, new SettingsFragment())
.commit();
}
}
@ -41,8 +35,6 @@ public class SettingsActivity extends Activity {
new ToolsInstaller(preference).execute();
return true;
});
if (getArguments() != null && getArguments().getBoolean(KEY_SHOW_QUICK_TILE_SETTINGS))
((TunnelListPreference) findPreference("primary_config")).show();
}
}

View File

@ -1,45 +0,0 @@
package com.wireguard.android.preference;
import android.content.Context;
import android.preference.ListPreference;
import android.util.AttributeSet;
import com.wireguard.android.Application;
import com.wireguard.android.model.Tunnel;
import com.wireguard.android.model.TunnelManager;
import java9.util.stream.StreamSupport;
/**
* ListPreference that is automatically filled with the list of tunnels.
*/
public class TunnelListPreference extends ListPreference {
public TunnelListPreference(final Context context, final AttributeSet attrs,
final int defStyleAttr, final int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
final TunnelManager tunnelManager = Application.getComponent().getTunnelManager();
final CharSequence[] entries = StreamSupport.stream(tunnelManager.getTunnels())
.map(Tunnel::getName)
.toArray(String[]::new);
setEntries(entries);
setEntryValues(entries);
}
public TunnelListPreference(final Context context, final AttributeSet attrs,
final int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public TunnelListPreference(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.dialogPreferenceStyle);
}
public TunnelListPreference(final Context context) {
this(context, null);
}
public void show() {
showDialog(null);
}
}

View File

@ -52,8 +52,6 @@
<string name="persistent_keepalive">Persistent keepalive</string>
<string name="placeholder_text">No configuration selected</string>
<string name="pre_shared_key">Pre-shared key</string>
<string name="primary_config">Quick tile configuration</string>
<string name="primary_config_summary">This configuration will be controlled by the quick settings tile</string>
<string name="private_key">Private key</string>
<string name="public_key">Public key</string>
<string name="public_key_copied_message">Public key copied to clipboard</string>

View File

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.wireguard.android.preference.TunnelListPreference
android:key="primary_config"
android:summary="@string/primary_config_summary"
android:title="@string/primary_config" />
<CheckBoxPreference
android:defaultValue="false"
android:key="restore_on_boot"