Advertisement
Guest User

How to make this on AlertDialog with SharedPreference

a guest
Jun 25th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.62 KB | None | 0 0
  1. private void do_connect(String epki_alias) {
  2.         String app_name = "net.openvpn.connect.android";
  3.         String proxy_name = null;
  4.         String server = null;
  5.         String username = null;
  6.         String password = null;
  7.         String pk_password = null;
  8.         String response = null;
  9.         boolean is_auth_pwd_save = RETAIN_AUTH;
  10.         String profile_name = selected_profile_name();
  11.         if (this.proxy_group.getVisibility() == 0) {
  12.             ProxyList proxy_list = get_proxy_list();
  13.             if (proxy_list != null) {
  14.                 proxy_name = proxy_list.get_enabled(RETAIN_AUTH);
  15.             }
  16.         }
  17.         if (this.server_group.getVisibility() == 0) {
  18.             server = SpinUtil.get_spinner_selected_item(this.server_spin);
  19.         }
  20.         if (this.username_group.getVisibility() == 0) {
  21.             username = this.username_edit.getText().toString();
  22.             if (username.length() > 0) {
  23.                 this.prefs.set_string_by_profile(profile_name, "username", username);
  24.             }
  25.         }
  26.         if (this.pk_password_group.getVisibility() == 0) {
  27.             pk_password = this.pk_password_edit.getText().toString();
  28.             boolean is_pk_pwd_save = this.pk_password_save_checkbox.isChecked();
  29.             this.prefs.set_boolean_by_profile(profile_name, "pk_password_save", is_pk_pwd_save);
  30.             if (is_pk_pwd_save) {
  31.                 this.pwds.set("pk", profile_name, pk_password);
  32.             } else {
  33.                 this.pwds.remove("pk", profile_name);
  34.             }
  35.         }
  36.         if (this.password_group.getVisibility() == 0) {
  37.             password = this.password_edit.getText().toString();
  38.             is_auth_pwd_save = this.password_save_checkbox.isChecked();
  39.             this.prefs.set_boolean_by_profile(profile_name, "auth_password_save", is_auth_pwd_save);
  40.             if (is_auth_pwd_save) {
  41.                 this.pwds.set("auth", profile_name, password);
  42.             } else {
  43.                 this.pwds.remove("auth", profile_name);
  44.             }
  45.         }
  46.         if (this.cr_group.getVisibility() == 0) {
  47.             response = this.response_edit.getText().toString();
  48.         }
  49.  
  50.         String vpn_proto = this.prefs.get_string("vpn_proto");
  51.         String conn_timeout = this.prefs.get_string("conn_timeout");
  52.         String compression_mode = this.prefs.get_string("compression_mode");
  53.         clear_stats();
  54.         submitConnectIntent(profile_name, server, vpn_proto, conn_timeout, username, password, is_auth_pwd_save, pk_password, response, epki_alias, compression_mode, proxy_name, null, null, true, get_gui_version(app_name));
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement