Improved custom dns server layout

This commit is contained in:
PeratX 2017-05-02 21:40:01 +08:00
parent 476504a366
commit 5947152550
3 changed files with 22 additions and 12 deletions

View File

@ -15,6 +15,7 @@ import org.itxtech.daedalus.Daedalus;
import org.itxtech.daedalus.R;
import org.itxtech.daedalus.activity.DnsServerConfigActivity;
import org.itxtech.daedalus.util.CustomDnsServer;
import org.itxtech.daedalus.util.DnsServer;
/**
* Daedalus Project
@ -93,7 +94,9 @@ public class DnsServerConfigFragment extends PreferenceFragment implements Toolb
} else {
serverName.setText("");
serverAddress.setText("");
serverPort.setText("");
String port = String.valueOf(DnsServer.DNS_SERVER_DEFAULT_PORT);
serverPort.setText(port);
serverPort.setSummary(port);
}
return view;
}

View File

@ -13,6 +13,9 @@ import android.content.Context;
* the Free Software Foundation, version 3.
*/
public class DnsServer {
public static int DNS_SERVER_DEFAULT_PORT = 53;
private static int totalId = 0;
private String id;
@ -28,7 +31,7 @@ public class DnsServer {
}
public DnsServer(String address, int description) {
this(address, description, 53);
this(address, description, DNS_SERVER_DEFAULT_PORT);
}
public int getPort() {

View File

@ -12,24 +12,28 @@
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView_custom_dns_name"
android:layout_marginTop="30dp"
android:id="@+id/textView_custom_dns_address"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:id="@+id/textView_custom_dns_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView_custom_dns_name"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:id="@+id/textView_custom_dns_address"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
</RelativeLayout>
</android.support.v7.widget.CardView>