X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyCell.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Factivities%2FPrivacyCell.kt;h=eec29e4f08b3626b2b8f1ef625859ca9a578cfcd;hp=964854687d7610f47863488a91bab640d40ab5ac;hb=8484f5cbc7f74e008624d0cd13af4a6f964ee516;hpb=70fa89f618b62a9d17064699ec130341069aa77d diff --git a/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt b/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt index 9648546..eec29e4 100644 --- a/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt +++ b/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt @@ -162,28 +162,47 @@ class PrivacyCell : AppCompatActivity(), NavigationView.OnNavigationItemSelected } override fun onNavigationItemSelected(menuItem: MenuItem) : Boolean { - // Get the menu item ID. - val menuItemId = menuItem.itemId - // Run the commands that correspond to the selected menu item. - if (menuItemId == R.id.permissions) { // Permissions. - // Instantiate the permissions dialog fragment. - val permissionsDialogFragment = WebViewDialog().type(WebViewDialog.PERMISSIONS) - - // Show the permissions alert dialog. - permissionsDialogFragment.show(supportFragmentManager, getString(R.string.permissions)) - } else if (menuItemId == R.id.privacy_policy) { // Privacy Policy. - // Instantiate the privacy policy dialog fragment. - val privacyPolicyDialogFragment = WebViewDialog().type(WebViewDialog.PRIVACY_POLICY) - - // Show the privacy policy alert dialog. - privacyPolicyDialogFragment.show(supportFragmentManager, getString(R.string.privacy_policy)) - } else if (menuItemId == R.id.changelog) { // Changelog. - // Instantiate the changelog dialog fragment. - val changelogDialogFragment = WebViewDialog().type(WebViewDialog.CHANGELOG) - - // Show the changelog alert dialog. - changelogDialogFragment.show(supportFragmentManager, getString(R.string.changelog)) + when (menuItem.itemId) { + R.id.permissions -> { // Permissions. + // Instantiate the permissions dialog fragment. + val permissionsDialogFragment = WebViewDialog().type(WebViewDialog.PERMISSIONS) + + // Show the alert dialog. + permissionsDialogFragment.show(supportFragmentManager, getString(R.string.permissions)) + } + + R.id.privacy_policy -> { // Privacy Policy. + // Instantiate the privacy policy dialog fragment. + val privacyPolicyDialogFragment = WebViewDialog().type(WebViewDialog.PRIVACY_POLICY) + + // Show the alert dialog. + privacyPolicyDialogFragment.show(supportFragmentManager, getString(R.string.privacy_policy)) + } + + R.id.changelog -> { // Changelog. + // Instantiate the changelog dialog fragment. + val changelogDialogFragment = WebViewDialog().type(WebViewDialog.CHANGELOG) + + // Show the alert dialog. + changelogDialogFragment.show(supportFragmentManager, getString(R.string.changelog)) + } + + R.id.licenses -> { // Licenses. + // Instantiate the licenses dialog fragment. + val licensesDialogFragment = WebViewDialog().type(WebViewDialog.LICENSES) + + // Show the alert dialog. + licensesDialogFragment.show(supportFragmentManager, getString(R.string.licenses)) + } + + R.id.contributors -> { // Contributors. + // Instantiate the contributors dialog fragment. + val contributorsDialogFragment = WebViewDialog().type(WebViewDialog.CONTRIBUTORS) + + // Show the alert dialog. + contributorsDialogFragment.show(supportFragmentManager, getString(R.string.contributors)) + } } // Close the navigation drawer.