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=84d8db663003a6d8e312cd1083583fa5e083611e;hp=a8863477a7bceb3a902452cd397468a6c7d3555c;hb=bfab9b01fcc75d413741664d8401a4e9d4785136;hpb=578979a47d905469cfc5c7cdc748fe9b539437e2 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 a886347..84d8db6 100644 --- a/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt +++ b/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt @@ -21,7 +21,9 @@ package com.stoutner.privacycell.activities import android.Manifest import android.content.Context +import android.content.Intent import android.content.pm.PackageManager +import android.net.Uri import android.os.Bundle import android.telephony.PhoneStateListener import android.telephony.ServiceState @@ -44,8 +46,8 @@ import androidx.drawerlayout.widget.DrawerLayout 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. @@ -162,16 +164,102 @@ 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 = 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 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)) + } + + R.id.news -> { // News. + // Create a news URL intent. + val newsUrlIntent = Intent(Intent.ACTION_VIEW) + + // Add the URL to the intent. + newsUrlIntent.data = Uri.parse("https://www.stoutner.com/category/privacy-cell/") - // Show the permissions alert dialog. - permissionsDialogFragment.show(supportFragmentManager, getString(R.string.phone_permission)) + // Make it so. + startActivity(newsUrlIntent) + } + + R.id.roadmap -> { // Roadmap. + // Create a roadmap URL intent. + val roadmapUrlIntent = Intent(Intent.ACTION_VIEW) + + // Add the URL to the intent. + roadmapUrlIntent.data = Uri.parse("https://www.stoutner.com/category/privacy-cell-roadmap/") + + // Make it so. + startActivity(roadmapUrlIntent) + } + + R.id.bug_tracker -> { // Bug tracker. + // Create a bug tracker URL intent. + val bugTrackerUrlIntent = Intent(Intent.ACTION_VIEW) + + // Add the URL to the intent. + bugTrackerUrlIntent.data = Uri.parse("https://redmine.stoutner.com/projects/privacy-cell/issues") + + // Make it so. + startActivity(bugTrackerUrlIntent) + } + + R.id.forum -> { // Forum. + // Create a forum URL intent. + val forumUrlIntent = Intent(Intent.ACTION_VIEW) + + // Add the URL to the intent. + forumUrlIntent.data = Uri.parse("https://redmine.stoutner.com/projects/privacy-cell/boards") + + // Make it so. + startActivity(forumUrlIntent) + } + + R.id.donations -> { // Donations. + // Create a donations URL intent. + val donationsUrlIntent = Intent(Intent.ACTION_VIEW) + + // Add the URL to the intent. + donationsUrlIntent.data = Uri.parse("https://www.stoutner.com/donations/") + + // Make it so. + startActivity(donationsUrlIntent) + } } // Close the navigation drawer.