Improved custom server id
This commit is contained in:
parent
820b8d53c3
commit
476504a366
@ -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<CustomDnsServer> customDnsServers;
|
||||
|
||||
private int totalId;
|
||||
|
||||
public int getNextId() {
|
||||
if (totalId < CUSTOM_DNS_ID_START) {
|
||||
totalId = CUSTOM_DNS_ID_START;
|
||||
}
|
||||
return totalId++;
|
||||
}
|
||||
|
||||
public ArrayList<CustomDnsServer> getCustomDnsServers() {
|
||||
if (customDnsServers == null) {
|
||||
customDnsServers = new ArrayList<>();
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user