diff --git a/app/src/main/java/org/itxtech/daedalus/util/Configurations.java b/app/src/main/java/org/itxtech/daedalus/util/Configurations.java index 1896294..3460092 100644 --- a/app/src/main/java/org/itxtech/daedalus/util/Configurations.java +++ b/app/src/main/java/org/itxtech/daedalus/util/Configurations.java @@ -21,10 +21,21 @@ import java.util.ArrayList; * the Free Software Foundation, version 3. */ public class Configurations { + private static final int CUSTOM_DNS_ID_START = 32; + private static File file; private ArrayList customDnsServers; + private int totalId; + + public int getNextId() { + if (totalId < CUSTOM_DNS_ID_START) { + totalId = CUSTOM_DNS_ID_START; + } + return totalId++; + } + public ArrayList getCustomDnsServers() { if (customDnsServers == null) { customDnsServers = new ArrayList<>(); diff --git a/app/src/main/java/org/itxtech/daedalus/util/CustomDnsServer.java b/app/src/main/java/org/itxtech/daedalus/util/CustomDnsServer.java index d3929c0..2be822c 100644 --- a/app/src/main/java/org/itxtech/daedalus/util/CustomDnsServer.java +++ b/app/src/main/java/org/itxtech/daedalus/util/CustomDnsServer.java @@ -1,5 +1,7 @@ package org.itxtech.daedalus.util; +import org.itxtech.daedalus.Daedalus; + /** * Daedalus Project * @@ -20,7 +22,7 @@ public class CustomDnsServer { this.name = name; this.address = address; this.port = port; - this.id = String.valueOf(DnsServer.totalId++); + this.id = String.valueOf(Daedalus.configurations.getNextId()); } public String getId() { diff --git a/app/src/main/java/org/itxtech/daedalus/util/DnsServer.java b/app/src/main/java/org/itxtech/daedalus/util/DnsServer.java index c965780..42d3be5 100644 --- a/app/src/main/java/org/itxtech/daedalus/util/DnsServer.java +++ b/app/src/main/java/org/itxtech/daedalus/util/DnsServer.java @@ -13,7 +13,7 @@ import android.content.Context; * the Free Software Foundation, version 3. */ public class DnsServer { - public static int totalId = 0; + private static int totalId = 0; private String id; private String address;