summaryrefslogtreecommitdiff
path: root/app/java/src/MainActivity.java
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-05-19 12:28:24 +0200
committerDaniel Weipert <code@drogueronin.de>2023-05-19 12:28:24 +0200
commitf47c908c88875c32fd4c624aeecefbf660c17e85 (patch)
tree659fd0d6a854d9af06275172e21a8e9e9fc8cc65 /app/java/src/MainActivity.java
parent309993eec6085cfa0e112cd5f45c8c55beeee5db (diff)
cleanup and comments
Diffstat (limited to 'app/java/src/MainActivity.java')
-rw-r--r--app/java/src/MainActivity.java22
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);
- } */
}
/**