From a7fc5090f3853e0e0ed43b47a1df1d96e76f437e Mon Sep 17 00:00:00 2001
From: str4d <str4d@mail.i2p>
Date: Mon, 5 Aug 2013 14:41:08 +0000
Subject: [PATCH] Simplified settings layout, pulled strings into resource file

---
 res/values/strings.xml |  32 +++++-
 res/xml/settings1.xml  | 252 ++++++++++++++++++++++++-----------------
 2 files changed, 182 insertions(+), 102 deletions(-)

diff --git a/res/values/strings.xml b/res/values/strings.xml
index fa16c9bc5..1034f9faf 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4,7 +4,37 @@
     <string name="app_name">I2P</string>
     <string name="welcome_new_install">Welcome to I2P! This app is ALPHA software and it does not provide strong anonymity. Please read the release notes and license information.</string>
     <string name="welcome_new_version">New version installed. Please read the release notes. Version:</string>
-    <string name="settings_label_subscriptions">I2P Addressbook Settings</string>
+
     <string name="menu_settings">Settings</string>
+    <string name="settings_enable">Enable</string>
+    <string name="settings_label_subscriptions">I2P Addressbook</string>
+    <string name="settings_desc_subscriptions">Subscription URLs</string>
+    <string name="settings_label_bandwidth">Bandwidth and network</string>
+    <string name="settings_label_bw_inbound">Inbound speed</string>
+    <string name="settings_desc_bw_inbound">Maximum inbound speed</string>
+    <string name="settings_label_bw_outbound">Outbound speed</string>
+    <string name="settings_desc_bw_outbound">Maximum outbound speed</string>
+    <string name="settings_label_hiddenMode">Participation</string>
+    <string name="settings_desc_hiddenMode">Turn off hidden mode</string>
+    <string name="settings_label_maxPartTunnels">Max participating tunnels</string>
+    <string name="settings_label_sharePercent">Share percentage</string>
+    <string name="settings_desc_upnp">Open firewall ports automatically</string>
+    <string name="settings_label_advanced">Advanced</string>
+    <string name="settings_label_transports">Transports</string>
+    <string name="settings_label_maxConns">Max connections</string>
+    <string name="settings_label_i2cp">I2CP interface</string>
+    <string name="settings_desc_i2cp">Listen on port 7654</string>
+    <string name="settings_label_exploratory_pool">Exploratory pool</string>
+    <string name="settings_desc_exploratory_pool">Tunnel parameters</string>
+    <string name="settings_label_expl_inbound">Inbound tunnels</string>
+    <string name="settings_label_expl_outbound">Outbound tunnels</string>
+    <string name="settings_label_expl_length">Length</string>
+    <string name="settings_desc_expl_length">How many hops to use</string>
+    <string name="settings_label_expl_lengthVariance">Hop variance</string>
+    <string name="settings_desc_expl_lengthVariance">How many hops to randomly add</string>
+    <string name="settings_label_expl_quantity">Quantity</string>
+    <string name="settings_desc_expl_quantity">How many tunnels</string>
+    <string name="settings_label_expl_backupQuantity">Backup quantity</string>
+    <string name="settings_desc_expl_backupQuantity">How many tunnel backups</string>
 
 </resources>
\ No newline at end of file
diff --git a/res/xml/settings1.xml b/res/xml/settings1.xml
index 24a4ab065..1cf6e3f32 100644
--- a/res/xml/settings1.xml
+++ b/res/xml/settings1.xml
@@ -1,9 +1,10 @@
-    <PreferenceScreen
+<PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:key="settings1">
 
     <Preference
         android:title="@string/settings_label_subscriptions"
+        android:summary="@string/settings_desc_subscriptions"
         android:key="addressbook_preferences">
 
         <intent android:targetPackage="net.i2p.android.router" android:targetClass="net.i2p.android.router.activity.AddressbookSettingsActivity" />
@@ -12,13 +13,11 @@
 
     <!--
     Keys and the default values from current installation:
-    i2cp.disableInterface=true
     -->
-    <CheckBoxPreference
-        android:key="i2cp.disableInterface"
-        android:defaultValue="false"
-        android:title="Disable i2cp interface"
-        />
+
+    <PreferenceCategory
+        android:key="settings_bandwidth"
+        android:title="@string/settings_label_bandwidth">
     <!--
     i2np.bandwidth.inboundKBytesPerSecond=100
     -->
@@ -26,9 +25,9 @@
         android:key="i2np.bandwidth.inboundKBytesPerSecond"
         android:defaultValue="100"
         android:max="1000"
-        android:title="Inbound speed"
-        android:summary="Maximum inbound speed"
-        android:dialogMessage="Maximum inbound speed"
+        android:title="@string/settings_label_bw_inbound"
+        android:summary="@string/settings_desc_bw_inbound"
+        android:dialogMessage="@string/settings_desc_bw_inbound"
         android:text=" KBytes/sec"
         />
     <!--
@@ -38,29 +37,74 @@
         android:key="i2np.bandwidth.outboundKBytesPerSecond"
         android:defaultValue="100"
         android:max="1000"
-        android:title="Outbound speed"
-        android:summary="Maximum outbound speed"
-        android:dialogMessage="Maximum outbound speed"
+        android:title="@string/settings_label_bw_outbound"
+        android:summary="@string/settings_desc_bw_outbound"
+        android:dialogMessage="@string/settings_desc_bw_outbound"
         android:text=" KBytes/sec"
         />
-
     <CheckBoxPreference
-        android:key="i2np.ntcp.enable"
-        android:defaultValue="true"
-        android:title="Enable NTCP"
+        android:key="router.hiddenMode"
+        android:defaultValue="false"
+        android:title="@string/settings_label_hiddenMode"
+        android:summary="@string/settings_desc_hiddenMode"
+        />
+    <!--
+    router.maxParticipatingTunnels=0
+    -->
+    <com.hlidskialf.android.preference.SeekBarPreference
+        android:key="router.maxParticipatingTunnels"
+        android:defaultValue="20"
+        android:max="500"
+        android:title="@string/settings_label_maxPartTunnels"
+        android:summary="Maximum tunnels to participate in (default=20)"
+        android:dialogMessage="Maximum tunnels to participate in"
+        android:text=" Tunnels"
+        android:dependency="router.hiddenMode"
+        />
+    <!--
+    router.sharePercentage=10
+    -->
+    <com.hlidskialf.android.preference.SeekBarPreference
+        android:key="router.sharePercentage"
+        android:defaultValue="80"
+        android:max="100"
+        android:title="@string/settings_label_sharePercent"
+        android:summary="Percentage of bandwith to share (default=80)"
+        android:dialogMessage="Percentage of bandwidth to share"
+        android:text="%"
+        android:dependency="router.hiddenMode"
+        android:shouldDisableView="true"
         />
 
     <!--
-    i2np.udp.enable=false
-    I might hide this one...
+    i2np.upnp.enable=false
     -->
     <CheckBoxPreference
-        android:key="i2np.udp.enable"
+        android:key="i2np.upnp.enable"
         android:defaultValue="true"
-        android:title="Enable UDP"
-        android:summary="DO NOT DISABLE THIS"
+        android:title="UPnP"
+        android:summary="@string/settings_desc_upnp"
         />
+    </PreferenceCategory>
+
 
+
+    <PreferenceCategory
+        android:key="settings_advanced"
+        android:title="@string/settings_label_advanced">
+
+    <PreferenceScreen
+        android:key="settings_transports"
+        android:title="@string/settings_label_transports">
+
+    <PreferenceCategory
+        android:key="settings_ntcp"
+        android:title="NTCP">
+    <CheckBoxPreference
+        android:key="i2np.ntcp.enable"
+        android:defaultValue="true"
+        android:title="@string/settings_enable"
+        />
     <!--
     i2np.ntcp.maxConnections=24
     -->
@@ -68,13 +112,29 @@
         android:key="i2np.ntcp.maxConnections"
         android:defaultValue="32"
         android:max="250"
-        android:title="Max NTCP connections"
+        android:title="@string/settings_label_maxConns"
         android:summary="Maximum NTCP connections allowed (default=32)"
         android:dialogMessage="Maximum NTCP connections"
         android:text=" connections"
         android:dependency="i2np.ntcp.enable"
         android:shouldDisableView="true"
         />
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:key="settings_udp"
+        android:title="UDP">
+    <!--
+    i2np.udp.enable=false
+    I might hide this one...
+    -->
+    <CheckBoxPreference
+        android:key="i2np.udp.enable"
+        android:defaultValue="true"
+        android:title="@string/settings_enable"
+        android:summary="DO NOT DISABLE THIS"
+        />
+
     <!--
     i2np.udp.maxConnections=12
     -->
@@ -82,147 +142,137 @@
         android:key="i2np.udp.maxConnections"
         android:defaultValue="32"
         android:max="500"
-        android:title="Max UDP connections"
+        android:title="@string/settings_label_maxConns"
         android:summary="Maximum UDP connections allowed"
         android:dialogMessage="Maximum UDP connections"
         android:text=" connections"
         android:dependency="i2np.udp.enable"
         android:shouldDisableView="true"
         />
+    </PreferenceCategory>
+    </PreferenceScreen>
+
     <!--
-    i2np.upnp.enable=false
+    i2cp.disableInterface=true
     -->
     <CheckBoxPreference
-        android:key="i2np.upnp.enable"
-        android:defaultValue="true"
-        android:title="Enable UPNP"
-        />
-
-
-
-    <CheckBoxPreference
-        android:key="router.hiddenMode"
+        android:key="i2cp.disableInterface"
         android:defaultValue="false"
-        android:title="Enable Participation"
-        android:summary="Enabling this option turns off hidden mode"
+        android:title="@string/settings_label_i2cp"
+        android:summary="@string/settings_desc_i2cp"
         />
-    <!--
 
-    router.maxParticipatingTunnels=0
-    -->
-    <com.hlidskialf.android.preference.SeekBarPreference
-        android:key="router.maxParticipatingTunnels"
-        android:defaultValue="20"
-        android:max="500"
-        android:title="Max Participating Tunnels"
-        android:summary="Maximum tunnels to participate in (default=20)"
-        android:dialogMessage="Maximum tunnels to participate in"
-        android:text=" Tunnels"
-        android:dependency="router.hiddenMode"
-        />
-    <!--
-    router.sharePercentage=10
-    -->
-    <com.hlidskialf.android.preference.SeekBarPreference
-        android:key="router.sharePercentage"
-        android:defaultValue="80"
-        android:max="100"
-        android:title="Share Percentage"
-        android:summary="Percentage of bandwith to share (default=80)"
-        android:dialogMessage="Percentage of bandwith to share"
-        android:text="%"
-        android:dependency="router.hiddenMode"
-        android:shouldDisableView="true"
-        />
+    <PreferenceScreen
+        android:key="settings_exploratory_pool"
+        android:title="@string/settings_label_exploratory_pool"
+        android:summary="@string/settings_desc_exploratory_pool">
 
+    <PreferenceCategory
+        android:key="settings_expl_inbound"
+        android:title="@string/settings_label_expl_inbound">
     <!--
     router.inboundPool.length=1
-    router.outboundPool.length=1
     -->
     <ListPreference
         android:key="router.inboundPool.length"
         android:entries="@array/setting0to3"
         android:entryValues="@array/setting0to3"
-        android:title="inbound length"
-        android:summary="How many hops for inbound tunnel"
-        android:defaultValue="2"
-    />
-
-    <ListPreference
-        android:key="router.outboundPool.length"
-        android:entries="@array/setting0to3"
-        android:entryValues="@array/setting0to3"
-        android:title="outbound length"
-        android:summary="How many hops for outbound tunnel"
+        android:title="@string/settings_label_expl_length"
+        android:summary="@string/settings_desc_expl_length"
         android:defaultValue="2"
     />
 
     <!--
     router.inboundPool.lengthVariance=1
-    router.outboundPool.lengthVariance=1
     -->
     <ListPreference
         android:key="router.inboundPool.lengthVariance"
         android:entries="@array/setting2to2"
         android:entryValues="@array/setting2to2"
-        android:title="inbound hop variance"
-        android:summary="How many hops to randomly add to inbound tunnels"
-        android:defaultValue="0"
-    />
-
-    <ListPreference
-        android:key="router.outboundPool.lengthVariance"
-        android:entries="@array/setting2to2"
-        android:entryValues="@array/setting2to2"
-        android:title="outbound hop variance"
-        android:summary="How many hops to randomly add to outbound tunnels"
+        android:title="@string/settings_label_expl_lengthVariance"
+        android:summary="@string/settings_desc_expl_lengthVariance"
         android:defaultValue="0"
     />
 
 
     <!--
     router.inboundPool.quantity=2
-    router.outboundPool.quantity=2
     -->
     <ListPreference
         android:key="router.inboundPool.quantity"
         android:entries="@array/setting0to3"
         android:entryValues="@array/setting0to3"
-        android:title="inbound quantity"
-        android:summary="How many inbound tunnels"
+        android:title="@string/settings_label_expl_quantity"
+        android:summary="@string/settings_desc_expl_quantity"
         android:defaultValue="2"
     />
 
+    <!--
+    router.inboundPool.backupQuantity=0
+    -->
     <ListPreference
-        android:key="router.outboundPool.quantity"
+        android:key="router.inboundPool.backupQuantity"
         android:entries="@array/setting0to3"
         android:entryValues="@array/setting0to3"
-        android:title="outbound quantity"
-        android:summary="How many outbound tunnels"
-        android:defaultValue="2"
+        android:title="@string/settings_label_expl_backupQuantity"
+        android:summary="@string/settings_desc_expl_backupQuantity"
+        android:defaultValue="0"
     />
+    </PreferenceCategory>
 
+    <PreferenceCategory
+        android:key="settings_expl_outbound"
+        android:title="@string/settings_label_expl_outbound">
     <!--
-    router.inboundPool.backupQuantity=0
-    router.outboundPool.backupQuantity=0
+    router.outboundPool.length=1
     -->
     <ListPreference
-        android:key="router.inboundPool.backupQuantity"
+        android:key="router.outboundPool.length"
         android:entries="@array/setting0to3"
         android:entryValues="@array/setting0to3"
-        android:title="inbound backup quantity"
-        android:summary="How many inbound tunnel backups"
+        android:title="@string/settings_label_expl_length"
+        android:summary="@string/settings_desc_expl_length"
+        android:defaultValue="2"
+    />
+
+    <!--
+    router.outboundPool.lengthVariance=1
+    -->
+    <ListPreference
+        android:key="router.outboundPool.lengthVariance"
+        android:entries="@array/setting2to2"
+        android:entryValues="@array/setting2to2"
+        android:title="@string/settings_label_expl_lengthVariance"
+        android:summary="@string/settings_desc_expl_lengthVariance"
         android:defaultValue="0"
     />
 
+    <!--
+    router.outboundPool.quantity=2
+    -->
+    <ListPreference
+        android:key="router.outboundPool.quantity"
+        android:entries="@array/setting0to3"
+        android:entryValues="@array/setting0to3"
+        android:title="@string/settings_label_expl_quantity"
+        android:summary="@string/settings_desc_expl_quantity"
+        android:defaultValue="2"
+    />
+
+    <!--
+    router.outboundPool.backupQuantity=0
+    -->
     <ListPreference
         android:key="router.outboundPool.backupQuantity"
         android:entries="@array/setting0to3"
         android:entryValues="@array/setting0to3"
-        android:title="outbound backup quantity"
-        android:summary="How many outbound tunnel backups"
+        android:title="@string/settings_label_expl_backupQuantity"
+        android:summary="@string/settings_desc_expl_backupQuantity"
         android:defaultValue="0"
     />
+    </PreferenceCategory>
+    </PreferenceScreen>
+    </PreferenceCategory>
 
 
     <!--
-- 
GitLab