diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-05-14 13:20:43 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-05-14 13:24:30 +0200 |
commit | 6f4dc54bd119203da8dd1f91e65c4e4b99ab2ff0 (patch) | |
tree | fa7fe2459283fe81dba17f95eccdf5eded883e11 /app/java/src/MainActivity.java | |
parent | 6aae8398d489de5f33e8824a252793306d570d3c (diff) |
menu
Diffstat (limited to 'app/java/src/MainActivity.java')
-rw-r--r-- | app/java/src/MainActivity.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/app/java/src/MainActivity.java b/app/java/src/MainActivity.java index 049ee29..bfad05a 100644 --- a/app/java/src/MainActivity.java +++ b/app/java/src/MainActivity.java @@ -14,11 +14,15 @@ import android.os.Bundle; 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 { @@ -44,6 +48,9 @@ public class MainActivity extends Activity { this.buttonStart = (Button) findViewById(R.id.button_start); this.dnsProxyService = new Intent(this, DNSProxyService.class); + + // if setting.get(USER_WIFI_LISTENER) + // startService(new Intent(this, WifiListenerService.class)); } @Override @@ -61,6 +68,28 @@ public class MainActivity extends Activity { unregisterReceiver(receiver); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.settings, menu); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int itemId = item.getItemId(); + + if (itemId == R.id.menu__settings) { + Intent intent = new Intent(MainActivity.this, SettingsActivity.class); + startActivity(intent); + + return true; + } + + return super.onOptionsItemSelected(item); + } + /** * is called by "startActivityForResult" internally */ @@ -71,9 +100,6 @@ public class MainActivity extends Activity { } } - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {} - /** * button_start is clicked */ |