From 38b2aafce8f5fcaeadd3a7e970f41345243a2b56 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 7 Jan 2018 21:45:11 -0600 Subject: [PATCH] Remove primary configuration preference It is no longer used. Signed-off-by: Samuel Holland --- .../android/activity/SettingsActivity.java | 10 +---- .../preference/TunnelListPreference.java | 45 ------------------- app/src/main/res/values/strings.xml | 2 - app/src/main/res/xml/preferences.xml | 4 -- 4 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 app/src/main/java/com/wireguard/android/preference/TunnelListPreference.java diff --git a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java index c6c69789..06d40ad5 100644 --- a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java @@ -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(); } } diff --git a/app/src/main/java/com/wireguard/android/preference/TunnelListPreference.java b/app/src/main/java/com/wireguard/android/preference/TunnelListPreference.java deleted file mode 100644 index eefd9912..00000000 --- a/app/src/main/java/com/wireguard/android/preference/TunnelListPreference.java +++ /dev/null @@ -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); - } -} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 52b7de60..c897e345 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -52,8 +52,6 @@ Persistent keepalive No configuration selected Pre-shared key - Quick tile configuration - This configuration will be controlled by the quick settings tile Private key Public key Public key copied to clipboard diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 1693839b..e02572dd 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,9 +1,5 @@ -