Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wade
DnsChanger
Commits
1d601517
Commit
1d601517
authored
Apr 11, 2018
by
Daniel Wolf
Browse files
Show the entry currently selected in the ConfigureActivity
Closes #130
parent
de387f36
Changes
1
Show whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/dnschanger/tasker/ConfigureActivity.java
View file @
1d601517
...
...
@@ -27,6 +27,7 @@ import android.widget.Toast;
import
com.frostnerd.dnschanger.LogFactory
;
import
com.frostnerd.dnschanger.R
;
import
com.frostnerd.dnschanger.database.DatabaseHelper
;
import
com.frostnerd.dnschanger.database.entities.DNSEntry
;
import
com.frostnerd.dnschanger.database.entities.IPPortPair
;
import
com.frostnerd.dnschanger.dialogs.DNSEntryListDialog
;
import
com.frostnerd.dnschanger.util.PreferencesAccessor
;
...
...
@@ -158,6 +159,7 @@ public class ConfigureActivity extends AppCompatActivity {
if
(
settingV6
)
dns1V6
=
pair
;
else
dns1
=
pair
;
}
setEditTextLabel
();
}
@Override
...
...
@@ -185,6 +187,7 @@ public class ConfigureActivity extends AppCompatActivity {
if
(
settingV6
)
dns2V6
=
pair
;
else
dns2
=
pair
;
}
setEditTextLabel
();
}
@Override
...
...
@@ -264,6 +267,7 @@ public class ConfigureActivity extends AppCompatActivity {
});
getWindow
().
setSoftInputMode
(
WindowManager
.
LayoutParams
.
SOFT_INPUT_STATE_ALWAYS_HIDDEN
);
setInputType
();
setEditTextLabel
();
}
public
void
openDefaultDNSDialog
(
View
v
){
...
...
@@ -331,6 +335,20 @@ public class ConfigureActivity extends AppCompatActivity {
ed_dns2
.
setFilters
(
new
InputFilter
[]{
filter
});
}
private
void
setEditTextLabel
(){
String
label1
=
getString
(
R
.
string
.
hint_dns1
),
label2
=
getString
(
R
.
string
.
hint_dns2
);
IPPortPair
firstPair
=
settingV6
?
dns1V6
:
dns1
;
IPPortPair
secondPair
=
settingV6
?
dns2V6
:
dns2
;
DNSEntry
entry
;
if
((
entry
=
DatabaseHelper
.
getInstance
(
this
).
findMatchingDNSEntry
(
firstPair
.
getAddress
()))
!=
null
)
label1
+=
" ("
+
entry
.
getShortName
()
+
")"
;
if
(
secondPair
!=
null
&&
secondPair
!=
IPPortPair
.
getEmptyPair
()
&&
(
entry
=
DatabaseHelper
.
getInstance
(
this
).
findMatchingDNSEntry
(
secondPair
.
getAddress
()))
!=
null
)
label2
+=
" ("
+
entry
.
getShortName
()
+
")"
;
met_dns1
.
setLabelText
(
label1
);
met_dns2
.
setLabelText
(
label2
);
}
@Override
public
void
onBackPressed
()
{
if
(
creatingShortcut
)
super
.
onBackPressed
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment