diff options
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/SettingsActivity.java | 10 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/preference/TunnelListPreference.java | 45 |
2 files changed, 1 insertions, 54 deletions
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); - } -} |