summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-16 04:34:14 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-16 04:34:14 -0500
commit08992185ecfe359ae7607a779b984fc6c3b8b22b (patch)
tree2c993f3eb3f790a8282bb2a911e25c1b42e4d4dd /app/src
parente95b41e48b7f335c08833a2e9bab0902d1ce98f8 (diff)
SettingsActivity: Implement primary config setting
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/SettingsActivity.java17
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/preferences.xml7
3 files changed, 26 insertions, 0 deletions
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 @@
<string name="listen_port">Listen port</string>
<string name="mtu">MTU</string>
<string name="placeholder_text">No configuration selected</string>
+ <string name="primary_config">Primary 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="save">Save</string>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <com.wireguard.android.ConfigListPreference
+ android:key="primary_config"
+ android:summary="@string/primary_config_summary"
+ android:title="@string/primary_config" />
+</PreferenceScreen>