diff options
Diffstat (limited to 'app/java/src/MainActivity.java')
-rw-r--r-- | app/java/src/MainActivity.java | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/app/java/src/MainActivity.java b/app/java/src/MainActivity.java index f30f91c..3d2c197 100644 --- a/app/java/src/MainActivity.java +++ b/app/java/src/MainActivity.java @@ -1,7 +1,6 @@ package org.pihole.dnsproxy; import android.app.Activity; -import android.app.AlertDialog; import android.content.BroadcastReceiver; import android.content.Context; @@ -9,26 +8,20 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; import android.net.VpnService; import android.net.wifi.WifiManager; import android.os.Bundle; -import android.preference.PreferenceManager; - 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; public class MainActivity extends Activity { @@ -72,7 +65,7 @@ public class MainActivity extends Activity { super.onResume(); this.setStateButtonStartStop(); - registerReceiver(this.receiveDNSProxyService, new IntentFilter(DNSProxyService.NOTIFICATION)); + registerReceiver(this.receiveDNSProxyService, new IntentFilter(DNSProxyService.NOTIFICATION_NOTIFY)); registerReceiver(this.receiveNetworkChange, new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION)); WifiListenerService.toggle(this); @@ -99,7 +92,7 @@ public class MainActivity extends Activity { public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); - if (itemId == R.id.menu__settings) { + if (itemId == R.id.menu_settings) { startActivity(new Intent(this, SettingsActivity.class)); return true; @@ -133,7 +126,7 @@ public class MainActivity extends Activity { } /** - * prepare VpnService properly + * Prepare VpnService properly * and ask for confirmation */ private void prepareVpnService() { @@ -157,15 +150,6 @@ public class MainActivity extends Activity { this.buttonStart.setVisibility(View.GONE); this.buttonStop.setVisibility(View.VISIBLE); } - - // toggle whether enabled - /* ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); - if (networkInfo.isConnected() || DNSProxyService.isRunning()) { - this.buttonStart.setEnabled(true); - } else if (!networkInfo.isConnected() && !DNSProxyService.isRunning()) { - this.buttonStart.setEnabled(false); - } */ } /** |