import com.google.android.material.navigation.NavigationView
import com.stoutner.privacycell.R
-import com.stoutner.privacycell.dialogs.PermissionsDialog
import com.stoutner.privacycell.dialogs.PhonePermissionDialog
+import com.stoutner.privacycell.dialogs.WebViewDialog
class PrivacyCell : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener, PhonePermissionDialog.StoragePermissionDialogListener {
// Declare the class variables.
}
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 = PermissionsDialog()
+ 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 permissions alert dialog.
- permissionsDialogFragment.show(supportFragmentManager, getString(R.string.phone_permission))
+ // 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.