Skip to content

Commit

Permalink
Add custom DHT Node to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
markwinter committed Jun 10, 2014
1 parent 4ff777e commit 3d0cbf1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
3 changes: 0 additions & 3 deletions app/src/main/java/im/tox/antox/tox/ToxSingleton.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,13 @@ public void initTox(Context ctx) {
while (DhtNode.connected == false && networkInfo.isConnected()) {
try {
if (DhtNode.ipv4.size() > 0) {

try {
jTox.bootstrap(DhtNode.ipv4.get(DhtNode.counter),
Integer.parseInt(DhtNode.port.get(DhtNode.counter)), DhtNode.key.get(DhtNode.counter));
} catch (ToxException e) {

}

DhtNode.connected = true;

Log.d(TAG, "Connected to node: " + DhtNode.owner.get(DhtNode.counter));
DhtNode.connected = true;
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings_activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@

<!-- Menu strings -->
<string name="copy_tox_id">Copy Tox ID</string>

<!-- Dht strings -->
<string name="dht">DHT Node</string>
<string name="dht_ip">IP Address</string>
<string name="dht_port">Port</string>
<string name="dht_key">Key</string>

</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/xml/pref_headers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<!-- These settings headers are only used on tablets. -->

<header
android:fragment="im.tox.antox.fragments.SettingsFragment$GeneralPreferenceFragment"
android:fragment="im.tox.antox.fragments.SettingsFragment"
android:title="@string/pref_header_profile" />

<header
android:fragment="im.tox.antox.fragments.SettingsFragment$NotificationPreferenceFragment"
android:fragment="im.tox.antox.fragments.SettingsFragment"
android:title="@string/pref_header_notifications" />

<header
android:fragment="im.tox.antox.fragments.SettingsFragment$DataSyncPreferenceFragment"
android:fragment="im.tox.antox.fragments.SettingsFragment"
android:title="@string/pref_header_other" />

</preference-headers>
32 changes: 32 additions & 0 deletions app/src/main/res/xml/pref_other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,36 @@
android:negativeButtonText="@null"
android:positiveButtonText="@null" />

<PreferenceScreen android:title="@string/dht" >
<EditTextPreference
android:key="dht_ip"
android:title="@string/dht_ip"
android:defaultValue=""
android:selectAllOnFocus="true"
android:inputType="text"
android:capitalize="characters"
android:singleLine="true"
android:maxLines="1" />

<EditTextPreference
android:key="dht_port"
android:title="@string/dht_port"
android:defaultValue=""
android:selectAllOnFocus="true"
android:inputType="text"
android:capitalize="characters"
android:singleLine="true"
android:maxLines="1" />

<EditTextPreference
android:key="dht_key"
android:title="@string/dht_key"
android:defaultValue=""
android:selectAllOnFocus="true"
android:inputType="text"
android:capitalize="characters"
android:singleLine="true"
android:maxLines="1" />
</PreferenceScreen>

</PreferenceScreen>

0 comments on commit 3d0cbf1

Please sign in to comment.