From 08992185ecfe359ae7607a779b984fc6c3b8b22b Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Wed, 16 Aug 2017 04:34:14 -0500 Subject: SettingsActivity: Implement primary config setting Signed-off-by: Jason A. Donenfeld --- .../java/com/wireguard/android/SettingsActivity.java | 17 +++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preferences.xml | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 app/src/main/res/xml/preferences.xml (limited to 'app/src/main') diff --git a/app/src/main/java/com/wireguard/android/SettingsActivity.java b/app/src/main/java/com/wireguard/android/SettingsActivity.java index 44e9b9b3..6fa3f897 100644 --- a/app/src/main/java/com/wireguard/android/SettingsActivity.java +++ b/app/src/main/java/com/wireguard/android/SettingsActivity.java @@ -1,6 +1,23 @@ package com.wireguard.android; import android.app.Activity; +import android.app.FragmentTransaction; +import android.os.Bundle; +import android.preference.PreferenceFragment; public class SettingsActivity extends Activity { + @Override + protected void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + final FragmentTransaction transaction = getFragmentManager().beginTransaction(); + transaction.replace(android.R.id.content, new SettingsFragment()).commit(); + } + + public static class SettingsFragment extends PreferenceFragment { + @Override + public void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preferences); + } + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bee8685a..20fa1e5f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -20,6 +20,8 @@ Listen port MTU No configuration selected + Primary configuration + This configuration will be controlled by the quick settings tile Private key Public key Save diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml new file mode 100644 index 00000000..09c32942 --- /dev/null +++ b/app/src/main/res/xml/preferences.xml @@ -0,0 +1,7 @@ + + + + -- cgit v1.2.3