Skip to content

Commit cc22782

Browse files
committed
Fix broken builds and linting after option changes
1 parent f3fcd71 commit cc22782

2 files changed

Lines changed: 62 additions & 74 deletions

File tree

app/src/foss/java/com/doubleangels/nextdnsmanagement/MainActivity.java

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -785,43 +785,37 @@ public boolean onCreateOptionsMenu(@NonNull Menu menu) {
785785
@Override
786786
public boolean onOptionsItemSelected(MenuItem item) {
787787
// Determine action based on selected menu item
788-
switch (item.getItemId()) {
789-
case R.id.back:
790-
// Navigate back in the WebView history
791-
if (webView == null) {
792-
setupWebViewForActivity(getString(R.string.main_url));
793-
} else {
794-
webView.goBack();
795-
}
796-
break;
797-
case R.id.refreshNextDNS:
798-
// Reload the WebView
799-
if (webView == null) {
800-
setupWebViewForActivity(getString(R.string.main_url));
801-
} else {
802-
webView.reload();
803-
}
804-
break;
805-
case R.id.pingNextDNS:
806-
// Launch the PingActivity
807-
startActivity(new Intent(this, PingActivity.class));
808-
break;
809-
case R.id.returnHome:
810-
// Load the main URL in the WebView
811-
if (webView == null) {
812-
setupWebViewForActivity(getString(R.string.main_url));
813-
} else {
814-
webView.loadUrl(getString(R.string.main_url));
815-
}
816-
break;
817-
case R.id.privateDNS:
818-
// Open wireless settings
819-
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
820-
break;
821-
case R.id.settings:
822-
// Launch the SettingsActivity
823-
startActivity(new Intent(this, SettingsActivity.class));
824-
break;
788+
int itemId = item.getItemId();
789+
if (itemId == R.id.back) {
790+
// Navigate back in the WebView history
791+
if (webView == null) {
792+
setupWebViewForActivity(getString(R.string.main_url));
793+
} else {
794+
webView.goBack();
795+
}
796+
} else if (itemId == R.id.refreshNextDNS) {
797+
// Reload the WebView
798+
if (webView == null) {
799+
setupWebViewForActivity(getString(R.string.main_url));
800+
} else {
801+
webView.reload();
802+
}
803+
} else if (itemId == R.id.pingNextDNS) {
804+
// Launch the PingActivity
805+
startActivity(new Intent(this, PingActivity.class));
806+
} else if (itemId == R.id.returnHome) {
807+
// Load the main URL in the WebView
808+
if (webView == null) {
809+
setupWebViewForActivity(getString(R.string.main_url));
810+
} else {
811+
webView.loadUrl(getString(R.string.main_url));
812+
}
813+
} else if (itemId == R.id.privateDNS) {
814+
// Open wireless settings
815+
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
816+
} else if (itemId == R.id.settings) {
817+
// Launch the SettingsActivity
818+
startActivity(new Intent(this, SettingsActivity.class));
825819
}
826820
return super.onOptionsItemSelected(item);
827821
}

app/src/gms/java/com/doubleangels/nextdnsmanagement/MainActivity.java

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -804,43 +804,37 @@ public boolean onCreateOptionsMenu(@NonNull Menu menu) {
804804
@Override
805805
public boolean onOptionsItemSelected(MenuItem item) {
806806
// Determine action based on selected menu item
807-
switch (item.getItemId()) {
808-
case R.id.back:
809-
// Navigate back in the WebView history
810-
if (webView == null) {
811-
setupWebViewForActivity(getString(R.string.main_url));
812-
} else {
813-
webView.goBack();
814-
}
815-
break;
816-
case R.id.refreshNextDNS:
817-
// Reload the WebView
818-
if (webView == null) {
819-
setupWebViewForActivity(getString(R.string.main_url));
820-
} else {
821-
webView.reload();
822-
}
823-
break;
824-
case R.id.pingNextDNS:
825-
// Launch the PingActivity
826-
startActivity(new Intent(this, PingActivity.class));
827-
break;
828-
case R.id.returnHome:
829-
// Load the main URL in the WebView
830-
if (webView == null) {
831-
setupWebViewForActivity(getString(R.string.main_url));
832-
} else {
833-
webView.loadUrl(getString(R.string.main_url));
834-
}
835-
break;
836-
case R.id.privateDNS:
837-
// Open wireless settings
838-
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
839-
break;
840-
case R.id.settings:
841-
// Launch the SettingsActivity
842-
startActivity(new Intent(this, SettingsActivity.class));
843-
break;
807+
int itemId = item.getItemId();
808+
if (itemId == R.id.back) {
809+
// Navigate back in the WebView history
810+
if (webView == null) {
811+
setupWebViewForActivity(getString(R.string.main_url));
812+
} else {
813+
webView.goBack();
814+
}
815+
} else if (itemId == R.id.refreshNextDNS) {
816+
// Reload the WebView
817+
if (webView == null) {
818+
setupWebViewForActivity(getString(R.string.main_url));
819+
} else {
820+
webView.reload();
821+
}
822+
} else if (itemId == R.id.pingNextDNS) {
823+
// Launch the PingActivity
824+
startActivity(new Intent(this, PingActivity.class));
825+
} else if (itemId == R.id.returnHome) {
826+
// Load the main URL in the WebView
827+
if (webView == null) {
828+
setupWebViewForActivity(getString(R.string.main_url));
829+
} else {
830+
webView.loadUrl(getString(R.string.main_url));
831+
}
832+
} else if (itemId == R.id.privateDNS) {
833+
// Open wireless settings
834+
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
835+
} else if (itemId == R.id.settings) {
836+
// Launch the SettingsActivity
837+
startActivity(new Intent(this, SettingsActivity.class));
844838
}
845839
return super.onOptionsItemSelected(item);
846840
}

0 commit comments

Comments
 (0)