]> gitweb.stoutner.com Git - PrivacyCell.git/blobdiff - app/src/main/java/com/stoutner/privacycell/activities/PrivacyCellActivity.kt
Make some progress on fixing realtime notifications.
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / activities / PrivacyCellActivity.kt
index cd0e1a1fcc10eb15355be338eb476418815f756d..091586fdf9386896a8161013ddd2825551ab1650 100644 (file)
@@ -55,8 +55,6 @@ import com.stoutner.privacycell.services.RealtimeMonitoringService
 
 class PrivacyCellActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener, PhonePermissionDialog.StoragePermissionDialogListener {
     // Declare the class variables.
 
 class PrivacyCellActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener, PhonePermissionDialog.StoragePermissionDialogListener {
     // Declare the class variables.
-    private lateinit var context: Context
-    private lateinit var telephonyManager: TelephonyManager
     private lateinit var actionBarDrawerToggle: ActionBarDrawerToggle
 
     // Declare the views.
     private lateinit var actionBarDrawerToggle: ActionBarDrawerToggle
 
     // Declare the views.
@@ -109,10 +107,6 @@ class PrivacyCellActivity : AppCompatActivity(), NavigationView.OnNavigationItem
         additionalNetworkInfoDetailsTextView = findViewById(R.id.additional_network_info_details)
         val navigationView = findViewById<NavigationView>(R.id.navigationview)
 
         additionalNetworkInfoDetailsTextView = findViewById(R.id.additional_network_info_details)
         val navigationView = findViewById<NavigationView>(R.id.navigationview)
 
-        // Get handles for the context and the telephony manager.
-        context = this
-        telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
-
         // Set the support action bar.
         setSupportActionBar(toolbar)
 
         // Set the support action bar.
         setSupportActionBar(toolbar)
 
@@ -337,6 +331,9 @@ class PrivacyCellActivity : AppCompatActivity(), NavigationView.OnNavigationItem
     }
 
     private fun populatePrivacyCell(context: Context) {
     }
 
     private fun populatePrivacyCell(context: Context) {
+        // Get a handle for the telephony manager.
+        val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
+
         // Listen to changes in the cell network state.
         telephonyManager.listen(object : PhoneStateListener() {
             override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) {
         // Listen to changes in the cell network state.
         telephonyManager.listen(object : PhoneStateListener() {
             override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) {