Added delete confirm dialog
This commit is contained in:
parent
184fe5c5bd
commit
62791ed5f9
@ -1,5 +1,7 @@
|
||||
package org.itxtech.daedalus.fragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
@ -130,9 +132,21 @@ public class DnsServerConfigFragment extends PreferenceFragment implements Toolb
|
||||
break;
|
||||
case R.id.action_delete:
|
||||
if (index != DnsServerConfigActivity.CUSTOM_DNS_SERVER_ID_NONE) {
|
||||
Daedalus.configurations.getCustomDnsServers().remove(index);
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.notice_delete_confirm_prompt)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Daedalus.configurations.getCustomDnsServers().remove(index);
|
||||
getActivity().finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.create()
|
||||
.show();
|
||||
} else {
|
||||
getActivity().finish();
|
||||
}
|
||||
getActivity().finish();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -68,4 +68,7 @@
|
||||
<string name="settings_use_dnsmasq">使用 DNSMasq 替代 Hosts</string>
|
||||
<string name="button_text_download_dnsmasq">下载 DNSMasq 配置文件</string>
|
||||
<string name="dnsmasq_path">本地 DNSMasq 配置路径:</string>
|
||||
<string name="notice_delete_confirm_prompt">您确定要删除此 DNS 服务器?</string>
|
||||
<string name="yes">是</string>
|
||||
<string name="no">否</string>
|
||||
</resources>
|
@ -68,4 +68,7 @@
|
||||
<string name="settings_use_dnsmasq">Use DNSMasq instead of Hosts</string>
|
||||
<string name="button_text_download_dnsmasq">Download DNSMasq configuration</string>
|
||||
<string name="dnsmasq_path">Local DNSMasq configurations path:</string>
|
||||
<string name="notice_delete_confirm_prompt">Are you sure you want to remove this DNS server?</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user