From f47c908c88875c32fd4c624aeecefbf660c17e85 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 19 May 2023 12:28:24 +0200 Subject: cleanup and comments --- app/java/src/SettingsActivity.java | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'app/java/src/SettingsActivity.java') diff --git a/app/java/src/SettingsActivity.java b/app/java/src/SettingsActivity.java index d04e2ba..0b3c7f2 100644 --- a/app/java/src/SettingsActivity.java +++ b/app/java/src/SettingsActivity.java @@ -1,43 +1,17 @@ package org.pihole.dnsproxy; -import android.app.Activity; -import android.app.AlertDialog; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; -import android.net.VpnService; -import android.net.wifi.WifiManager; -import android.net.wifi.WifiInfo; - import android.os.Bundle; -import android.preference.MultiSelectListPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.TextureView; -import android.view.View; - -import android.widget.Button; -import android.widget.Toast; -import android.provider.Settings; - -import java.util.List; - public class SettingsActivity extends PreferenceActivity { - private MultiSelectListPreference knownSsids; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -135,12 +109,7 @@ public class SettingsActivity extends PreferenceActivity { WifiListenerService.OnActivationListener.askLocationIfNeeded(context.getActivity()); if (sharedPreferences.getString("wifi_listener_ssid", "").equals("")) { - WifiManager wifiManager = (WifiManager) context.getActivity().getSystemService(Context.WIFI_SERVICE); - WifiInfo wifiInfo = wifiManager.getConnectionInfo(); - String ssid = wifiInfo.getSSID(); - - // remove quotes around ssid - ssid = ssid.substring(1, ssid.length() - 1); + String ssid = WifiListenerService.getWifiSSID(context.getActivity()); if (!ssid.equals("unknown ssid")) { SharedPreferences.Editor sharedPreferencesEditor = sharedPreferences.edit(); -- cgit v1.2.3