From bd84f1f839df624a7de4160d2248951a71e9b292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Carlos=20Pontes?= <45675983+jcarlospontes@users.noreply.github.com> Date: Sat, 1 Oct 2022 20:44:31 -0300 Subject: [PATCH] switch case option structure adding switch case in onOptionsItemSelected funcion --- .../lineageos/updater/UpdatesActivity.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java index bea3e928..008bb563 100644 --- a/src/org/lineageos/updater/UpdatesActivity.java +++ b/src/org/lineageos/updater/UpdatesActivity.java @@ -231,19 +231,21 @@ public boolean onCreateOptionsMenu(Menu menu) { @Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); - if (itemId == R.id.menu_refresh) { - downloadUpdatesList(true); - return true; - } else if (itemId == R.id.menu_preferences) { - showPreferencesDialog(); - return true; - } else if (itemId == R.id.menu_show_changelog) { - Intent openUrl = new Intent(Intent.ACTION_VIEW, - Uri.parse(Utils.getChangelogURL(this))); - startActivity(openUrl); - return true; - } - return super.onOptionsItemSelected(item); + switch (itemId) { + case R.id.menu_refresh: + downloadUpdatesList(true); + return true; + case R.id.menu_preferences: + showPreferencesDialog(); + return true; + case R.id.menu_show_changelog: + Intent openUrl = new Intent(Intent.ACTION_VIEW, + Uri.parse(Utils.getChangelogURL(this))); + startActivity(openUrl); + return true; + default: + return super.onOptionsItemSelected(item); + } } @Override