SettingsActivity: Implement primary config setting
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e95b41e48b
commit
08992185ec
@ -1,6 +1,23 @@
|
|||||||
package com.wireguard.android;
|
package com.wireguard.android;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceFragment;
|
||||||
|
|
||||||
public class SettingsActivity extends Activity {
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
<string name="listen_port">Listen port</string>
|
<string name="listen_port">Listen port</string>
|
||||||
<string name="mtu">MTU</string>
|
<string name="mtu">MTU</string>
|
||||||
<string name="placeholder_text">No configuration selected</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="private_key">Private key</string>
|
||||||
<string name="public_key">Public key</string>
|
<string name="public_key">Public key</string>
|
||||||
<string name="save">Save</string>
|
<string name="save">Save</string>
|
||||||
|
7
app/src/main/res/xml/preferences.xml
Normal file
7
app/src/main/res/xml/preferences.xml
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user