コード例 #1
0
ファイル: ProxyDroid.java プロジェクト: kunal15595/proxydroid
  private void onProfileChange(String oldProfileName) {

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);

    mProfile.getProfile(settings);
    Editor ed = settings.edit();
    ed.putString(oldProfileName, mProfile.toString());
    ed.commit();

    String profileString = settings.getString(profile, "");

    if (profileString.equals("")) {
      mProfile.init();
      mProfile.setName(getProfileName(profile));
    } else {
      mProfile.decodeJson(profileString);
    }

    hostText.setText(mProfile.getHost());
    userText.setText(mProfile.getUser());
    passwordText.setText(mProfile.getPassword());
    domainText.setText(mProfile.getDomain());
    certificateText.setText(mProfile.getCertificate());
    proxyTypeList.setValue(mProfile.getProxyType());
    ssidList.setValue(mProfile.getSsid());

    isAuthCheck.setChecked(mProfile.isAuth());
    isNTLMCheck.setChecked(mProfile.isNTLM());
    isAutoConnectCheck.setChecked(mProfile.isAutoConnect());
    isAutoSetProxyCheck.setChecked(mProfile.isAutoSetProxy());
    isBypassAppsCheck.setChecked(mProfile.isBypassApps());
    isDNSProxyCheck.setChecked(mProfile.isDNSProxy());
    isPACCheck.setChecked(mProfile.isPAC());

    portText.setText(Integer.toString(mProfile.getPort()));

    Log.d(TAG, mProfile.toString());

    mProfile.setProfile(settings);
  }
コード例 #2
0
  @Override
  public boolean equals(final Object obj) {
    if (!(obj instanceof Profile)) {
      return false;
    }

    final Profile profile = (Profile) obj;

    if (!getHost().equals(profile.getHost())) {
      return false;
    }

    if (getPort() != profile.getPort()) {
      return false;
    }

    if (!getUser().equals(profile.getUser())) {
      return false;
    }

    return true;
  }
コード例 #3
0
ファイル: ProxyDroid.java プロジェクト: kunal15595/proxydroid
  /** Called when connect button is clicked. */
  private boolean serviceStart() {

    if (Utils.isWorking()) return false;

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);

    mProfile.getProfile(settings);

    try {

      Intent it = new Intent(ProxyDroid.this, ProxyDroidService.class);
      Bundle bundle = new Bundle();
      bundle.putString("host", mProfile.getHost());
      bundle.putString("user", mProfile.getUser());
      bundle.putString("bypassAddrs", mProfile.getBypassAddrs());
      bundle.putString("password", mProfile.getPassword());
      bundle.putString("domain", mProfile.getDomain());
      bundle.putString("certificate", mProfile.getCertificate());

      bundle.putString("proxyType", mProfile.getProxyType());
      bundle.putBoolean("isAutoSetProxy", mProfile.isAutoSetProxy());
      bundle.putBoolean("isBypassApps", mProfile.isBypassApps());
      bundle.putBoolean("isAuth", mProfile.isAuth());
      bundle.putBoolean("isNTLM", mProfile.isNTLM());
      bundle.putBoolean("isDNSProxy", mProfile.isDNSProxy());
      bundle.putBoolean("isPAC", mProfile.isPAC());

      bundle.putInt("port", mProfile.getPort());

      it.putExtras(bundle);
      startService(it);
    } catch (Exception ignore) {
      // Nothing
      return false;
    }

    return true;
  }