Added I2CP host/port settings
This commit is contained in:
@@ -38,4 +38,6 @@
|
||||
<string name="pref_summ_minDelay">%s minutes</string>
|
||||
<string name="pref_title_maxDelay">Maximum delay per hop</string>
|
||||
<string name="pref_summ_maxDelay">%s minutes</string>
|
||||
<string name="pref_title_i2cp_host">I2CP host</string>
|
||||
<string name="pref_title_i2cp_port">I2CP port</string>
|
||||
</resources>
|
||||
|
||||
@@ -54,5 +54,17 @@
|
||||
android:summary="@string/pref_summ_maxDelay"
|
||||
android:title="@string/pref_title_maxDelay" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="I2P" >
|
||||
<i2p.bote.util.SummaryEditTextPreference
|
||||
android:defaultValue="127.0.0.1"
|
||||
android:key="i2pbote.i2cp.tcp.host"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_i2cp_host" />
|
||||
<i2p.bote.util.SummaryEditTextPreference
|
||||
android:defaultValue="7654"
|
||||
android:key="i2pbote.i2cp.tcp.port"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_i2cp_port" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -1,7 +1,9 @@
|
||||
package i2p.bote;
|
||||
|
||||
import net.i2p.client.I2PClient;
|
||||
import i2p.bote.folder.EmailFolder;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -202,6 +204,11 @@ public class MailListActivity extends ActionBarActivity implements
|
||||
System.setProperty("i2p.dir.base", myDir);
|
||||
System.setProperty("i2p.dir.config", myDir);
|
||||
System.setProperty("wrapper.logfile", myDir + "/wrapper.log");
|
||||
|
||||
// Set the I2CP host/port
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||
System.setProperty(I2PClient.PROP_TCP_HOST, prefs.getString("i2pbote.i2cp.tcp.host", "127.0.0.1"));
|
||||
System.setProperty(I2PClient.PROP_TCP_PORT, prefs.getString("i2pbote.i2cp.tcp.port", "7654"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
while (iterator.hasNext()) {
|
||||
String x = iterator.next();
|
||||
android.util.Log.i("I2P-Bote", "Looking at setting " + x);
|
||||
if (x.startsWith("i2pbote.")) // Skip over UI-related settings
|
||||
if (x.startsWith("i2pbote.")) // Skip over Android-specific settings
|
||||
continue;
|
||||
else if ("autoMailCheckEnabled".equals(x))
|
||||
config.setAutoMailCheckEnabled(prefs.getBoolean(x, true));
|
||||
|
||||
25
src/i2p/bote/util/SummaryEditTextPreference.java
Normal file
25
src/i2p/bote/util/SummaryEditTextPreference.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package i2p.bote.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class SummaryEditTextPreference extends EditTextPreference {
|
||||
|
||||
public SummaryEditTextPreference(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SummaryEditTextPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SummaryEditTextPreference(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
return String.format((String) super.getSummary(), getText());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user