Browse Source

add minimal preferences layout

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/44/head
R4SAS 3 years ago
parent
commit
c62429513f
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 4
      app/src/main/java/org/purplei2p/i2pd/SettingsActivity.java
  2. 17
      app/src/main/res/values/preferences_i2pd_options.xml
  3. 193
      app/src/main/res/xml/preferences_i2pd.xml

4
app/src/main/java/org/purplei2p/i2pd/SettingsActivity.java

@ -28,7 +28,7 @@ public class SettingsActivity extends Activity {
public static String onBootFileName="/onBoot"; // just file, empty, if exist the do autostart, if not then no. public static String onBootFileName="/onBoot"; // just file, empty, if exist the do autostart, if not then no.
//https://gist.github.com/chandruark/3165a5ee3452f2b9ec7736cf1b4c5ea6 //https://gist.github.com/chandruark/3165a5ee3452f2b9ec7736cf1b4c5ea6
private void addAutoStartupswitch() { private void addAutoStartupSwitch() {
try { try {
Intent intent = new Intent(); Intent intent = new Intent();
@ -97,7 +97,7 @@ public class SettingsActivity extends Activity {
if (isChecked) { if (isChecked) {
if (!onBoot.exists()) { if (!onBoot.exists()) {
requestPermission(); requestPermission();
addAutoStartupswitch(); addAutoStartupSwitch();
try { try {
if (!onBoot.createNewFile()) if (!onBoot.createNewFile())
Log.d(TAG, "Cant create new wile on: "+onBoot.getAbsolutePath()); Log.d(TAG, "Cant create new wile on: "+onBoot.getAbsolutePath());

17
app/src/main/res/values/preferences_i2pd_options.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_bandwidth_limit_flags">
<item>L</item>
<item>O</item>
<item>P</item>
<item>X</item>
</string-array>
<string-array name="pref_loglevel">
<item>none</item>
<item>error</item>
<item>warn</item>
<item>info</item>
<item>debug</item>
</string-array>
</resources>

193
app/src/main/res/xml/preferences_i2pd.xml

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Main">
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="Log" />
<ListPreference
android:defaultValue="1"
android:entries="@array/pref_loglevel"
android:entryValues="@array/pref_loglevel"
android:key="list_preference_1"
android:summary="Logging level to file. Use 'none' to reduce memory usage"
android:title="Log level" />
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="IPv4" />
<CheckBoxPreference
android:defaultValue="false"
android:key="check_box_preference_1"
android:title="IPv6" />
<EditTextPreference
android:defaultValue="Default value"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Port" />
<ListPreference
android:entries="@array/pref_bandwidth_limit_flags"
android:entryValues="@array/pref_bandwidth_limit_flags"
android:key="list_preference_1"
android:summary="Bandwidth limit for transit traffic"
android:title="Bandwidth" />
<CheckBoxPreference
android:defaultValue="false"
android:key="check_box_preference_1"
android:summary="Disable transit"
android:title="No transit" />
<CheckBoxPreference
android:defaultValue="false"
android:key="check_box_preference_1"
android:summary="Uses more battery"
android:title="Floodfill" />
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="SSU" />
</PreferenceCategory>
<PreferenceCategory android:title="NTCP2">
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="Enable" />
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:summary="Disable to make unable to connect to your device"
android:title="Publish" />
</PreferenceCategory>
<PreferenceCategory android:title="Web Console">
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="Enable" />
<EditTextPreference
android:defaultValue="127.0.0.1"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Address" />
<EditTextPreference
android:defaultValue="7070"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Port" />
<CheckBoxPreference
android:defaultValue="false"
android:key="check_box_preference_1"
android:summary="Use HTTP authorization to access Web Console"
android:title="Autorization" />
<EditTextPreference
android:defaultValue="Default value"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="User" />
<EditTextPreference
android:defaultValue="Default value"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Password" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/services_http_proxy">
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="Enable" />
<EditTextPreference
android:defaultValue="127.0.0.1"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Address" />
<EditTextPreference
android:defaultValue="4444"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Port" />
<EditTextPreference
android:defaultValue="proxy-keys.dat"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Keys" />
</PreferenceCategory>
<PreferenceCategory android:title="SOCKS Proxy">
<CheckBoxPreference
android:defaultValue="false"
android:key="check_box_preference_1"
android:title="Enable" />
<EditTextPreference
android:defaultValue="127.0.0.1"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Address" />
<EditTextPreference
android:defaultValue="4447"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Port" />
<EditTextPreference
android:defaultValue="proxy-keys.dat"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Keys" />
</PreferenceCategory>
<PreferenceCategory android:title="SAM">
<CheckBoxPreference
android:defaultValue="false"
android:key="check_box_preference_1"
android:title="Enable" />
<EditTextPreference
android:defaultValue="127.0.0.1"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Address" />
<EditTextPreference
android:defaultValue="7656"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Port" />
</PreferenceCategory>
<PreferenceCategory android:title="UPnP">
<CheckBoxPreference
android:defaultValue="true"
android:key="check_box_preference_1"
android:title="Enable" />
<EditTextPreference
android:defaultValue="I2Pd"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Forwarding name" />
</PreferenceCategory>
<PreferenceCategory android:title="Limits">
<EditTextPreference
android:defaultValue="50"
android:key="edit_text_preference_1"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="Limit possible built transit tunnels"
android:title="Transit tunnels" />
</PreferenceCategory>
</PreferenceScreen>
Loading…
Cancel
Save