From: Soren Stoutner Date: Sat, 14 Aug 2021 06:14:55 +0000 (-0700) Subject: Format the main activity. X-Git-Tag: v1.0~8 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff_plain;h=703dff21803cc19357c55982e596d114e81348c8 Format the main activity. --- diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d63e1a4..d807db0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,7 +40,6 @@ android:theme="@style/Theme.PrivacyCell" > (R.id.secure_from_stingray_imageview) + val secureFromStingrayTextView = findViewById(R.id.secure_from_stingray_textview) val voiceNetworkTextView = findViewById(R.id.voice_network) + val voiceNetworkDetailsTextView = findViewById(R.id.voice_network_details) val dataNetworkTextView = findViewById(R.id.data_network) + val dataNetworkDetailsTextView = findViewById(R.id.data_network_details) val additionalNetworkInfoTextView = findViewById(R.id.additional_network_info) - val secureFromStingrayTextView = findViewById(R.id.secure_from_stingray) + val additionalNetworkInfoDetailsTextView = findViewById(R.id.additional_network_info_details) // TODO. if (ActivityCompat.checkSelfPermission( @@ -63,72 +69,90 @@ class PrivacyCell : AppCompatActivity() { return } - // Get a handle for the the telephone Manager. + // Get a handle for the the telephone Manager and the context. val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager + val context: Context = this // Get the voice network type. val voiceNetworkType = getNetworkType(telephonyManager.voiceNetworkType) - // Populate the voice network text view. - voiceNetworkTextView.text = getString(R.string.voice_network, voiceNetworkType) + // Populate the voice network text views. + voiceNetworkTextView.text = getString(R.string.voice_network, voiceNetworkType[0]) + voiceNetworkDetailsTextView.text = voiceNetworkType[1] // Listen to changes in the cell network state. telephonyManager.listen(object : PhoneStateListener() { - override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) { + override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) {// Populate the secure from stingray text view. + // Populate the stingray security information. + if (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_NR) { // This is a secure 5G NR SA network. + // Populate the image view. + secureFromStingrayImageView.setImageDrawable(AppCompatResources.getDrawable(context, R.drawable.secure_5g_nr_sa)) + + // Set the text. + secureFromStingrayTextView.text = getString(R.string.secure_from_stingray) + + // Set the text color. + secureFromStingrayTextView.setTextColor(getColor(R.color.blue_700)) + } else { // This is not a secure 5G NR SA network. + // Populate the image view. + secureFromStingrayImageView.setImageDrawable(AppCompatResources.getDrawable(context, R.drawable.not_secure)) + + // Set the text. + secureFromStingrayTextView.text = getString(R.string.not_secure_from_stingray) + + // Set the text color. + secureFromStingrayTextView.setTextColor(getColor(R.color.red_700)) + // Get the strings that correspond to the network information. val dataNetworkType = getNetworkType(telephonyDisplayInfo.networkType) val additionalNetworkInfo = getAdditionalNetworkInfo(telephonyDisplayInfo.overrideNetworkType) - // Populate the network text views. - dataNetworkTextView.text = getString(R.string.data_network, dataNetworkType) - additionalNetworkInfoTextView.text = getString(R.string.additional_network_info, additionalNetworkInfo) - - // Populate the secure from stingray text view. - if (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_NR) { - secureFromStingrayTextView.text = getString(R.string.secure_from_stingray) - } else { - secureFromStingrayTextView.text = getString(R.string.not_secure_from_stingray) + // Populate the data network text views. + dataNetworkTextView.text = getString(R.string.data_network, dataNetworkType[0]) + dataNetworkDetailsTextView.text = dataNetworkType[1] + additionalNetworkInfoTextView.text = getString(R.string.additional_network_info, additionalNetworkInfo[0]) + additionalNetworkInfoDetailsTextView.text = additionalNetworkInfo[1] } } }, PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED) } - private fun getNetworkType(networkType: Int) : String { + private fun getNetworkType(networkType: Int) : Array { // Return the string that corresponds to the network type. return when(networkType) { - TelephonyManager.NETWORK_TYPE_UNKNOWN -> getString(R.string.unknown) - TelephonyManager.NETWORK_TYPE_GPRS -> getString(R.string.gprs) - TelephonyManager.NETWORK_TYPE_EDGE -> getString(R.string.edge) - TelephonyManager.NETWORK_TYPE_UMTS -> getString(R.string.umts) - TelephonyManager.NETWORK_TYPE_CDMA -> getString(R.string.cdma) - TelephonyManager.NETWORK_TYPE_EVDO_0 -> getString(R.string.evdo_0) - TelephonyManager.NETWORK_TYPE_EVDO_A -> getString(R.string.evdo_a) - TelephonyManager.NETWORK_TYPE_1xRTT -> getString(R.string.rtt) - TelephonyManager.NETWORK_TYPE_HSDPA -> getString(R.string.hsdpa) - TelephonyManager.NETWORK_TYPE_HSUPA -> getString(R.string.hsupa) - TelephonyManager.NETWORK_TYPE_HSPA -> getString(R.string.hspa) - TelephonyManager.NETWORK_TYPE_IDEN -> getString(R.string.iden) - TelephonyManager.NETWORK_TYPE_EVDO_B -> getString(R.string.evdo_b) - TelephonyManager.NETWORK_TYPE_LTE -> getString(R.string.lte) - TelephonyManager.NETWORK_TYPE_EHRPD -> getString(R.string.ehrpd) - TelephonyManager.NETWORK_TYPE_HSPAP -> getString(R.string.hspap) - TelephonyManager.NETWORK_TYPE_GSM -> getString(R.string.gsm) - TelephonyManager.NETWORK_TYPE_TD_SCDMA -> getString(R.string.td_scdma) - TelephonyManager.NETWORK_TYPE_IWLAN -> getString(R.string.iwlan) - TelephonyManager.NETWORK_TYPE_NR -> getString(R.string.nr) - else -> getString(R.string.error) + TelephonyManager.NETWORK_TYPE_UNKNOWN -> arrayOf(getString(R.string.unknown), getString(R.string.unknown)) + TelephonyManager.NETWORK_TYPE_GPRS -> arrayOf(getString(R.string.gprs), getString(R.string.gprs_detal)) + TelephonyManager.NETWORK_TYPE_EDGE -> arrayOf(getString(R.string.edge), getString(R.string.edge_detail)) + TelephonyManager.NETWORK_TYPE_UMTS -> arrayOf(getString(R.string.umts), getString(R.string.umts_detail)) + TelephonyManager.NETWORK_TYPE_CDMA -> arrayOf(getString(R.string.cdma), getString(R.string.cdma_detail)) + TelephonyManager.NETWORK_TYPE_EVDO_0 -> arrayOf(getString(R.string.evdo_0), getString(R.string.evdo_0_detail)) + TelephonyManager.NETWORK_TYPE_EVDO_A -> arrayOf(getString(R.string.evdo_a), getString(R.string.evdo_a_detail)) + TelephonyManager.NETWORK_TYPE_1xRTT -> arrayOf(getString(R.string.rtt), getString(R.string.rtt_detail)) + TelephonyManager.NETWORK_TYPE_HSDPA -> arrayOf(getString(R.string.hsdpa), getString(R.string.hsdpa_detail)) + TelephonyManager.NETWORK_TYPE_HSUPA -> arrayOf(getString(R.string.hsupa), getString(R.string.hsupa_detail)) + TelephonyManager.NETWORK_TYPE_HSPA -> arrayOf(getString(R.string.hspa), getString(R.string.hspa_detail)) + TelephonyManager.NETWORK_TYPE_IDEN -> arrayOf(getString(R.string.iden), getString(R.string.iden_detail)) + TelephonyManager.NETWORK_TYPE_EVDO_B -> arrayOf(getString(R.string.evdo_b), getString(R.string.evdo_b_detail)) + TelephonyManager.NETWORK_TYPE_LTE -> arrayOf(getString(R.string.lte), getString(R.string.lte_detail)) + TelephonyManager.NETWORK_TYPE_EHRPD -> arrayOf(getString(R.string.ehrpd), getString(R.string.ehrpd_detail)) + TelephonyManager.NETWORK_TYPE_HSPAP -> arrayOf(getString(R.string.hspap), getString(R.string.hspap_detail)) + TelephonyManager.NETWORK_TYPE_GSM -> arrayOf(getString(R.string.gsm), getString(R.string.gsm_detail)) + TelephonyManager.NETWORK_TYPE_TD_SCDMA -> arrayOf(getString(R.string.td_scdma), getString(R.string.td_scdma_detail)) + TelephonyManager.NETWORK_TYPE_IWLAN -> arrayOf(getString(R.string.iwlan), getString(R.string.iwlan_detail)) + TelephonyManager.NETWORK_TYPE_NR -> arrayOf(getString(R.string.nr), getString(R.string.nr_detail)) + else -> arrayOf(getString(R.string.error), getString(R.string.error)) } } - private fun getAdditionalNetworkInfo(overrideNetworkType: Int) : String { + private fun getAdditionalNetworkInfo(overrideNetworkType: Int) : Array { // Return the string that corresponds to the override network type. return when(overrideNetworkType) { - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE -> getString(R.string.none) - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA -> getString(R.string.lte_ca) - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO -> getString(R.string.lte_advanced_pro) - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA -> getString(R.string.lte_nr_nsa) - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE -> getString(R.string.lte_nr_nsa_mmwave) - else -> getString(R.string.error) + TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE -> arrayOf(getString(R.string.none), "") + TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA -> arrayOf(getString(R.string.lte_ca), getString(R.string.lte_ca_detail)) + TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO -> arrayOf(getString(R.string.lte_advanced_pro), getString(R.string.lte_advanced_pro_detail)) + TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA -> arrayOf(getString(R.string.lte_nr_nsa), getString(R.string.lte_nr_nsa_detail)) + TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE -> arrayOf(getString(R.string.lte_nr_nsa_mmwave), getString(R.string.lte_nr_nsa_mmwave_detail)) + else -> arrayOf(getString(R.string.error), "") } } } \ No newline at end of file diff --git a/app/src/main/res/drawable/not_secure.xml b/app/src/main/res/drawable/not_secure.xml new file mode 100644 index 0000000..de128f3 --- /dev/null +++ b/app/src/main/res/drawable/not_secure.xml @@ -0,0 +1,39 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/secure_5g_nr_sa.xml b/app/src/main/res/drawable/secure_5g_nr_sa.xml new file mode 100644 index 0000000..33ac99f --- /dev/null +++ b/app/src/main/res/drawable/secure_5g_nr_sa.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/privacy_cell_linearlayout.xml b/app/src/main/res/layout/privacy_cell_linearlayout.xml index b8473de..167ae8f 100644 --- a/app/src/main/res/layout/privacy_cell_linearlayout.xml +++ b/app/src/main/res/layout/privacy_cell_linearlayout.xml @@ -18,29 +18,91 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> - + android:layout_width="wrap_content" > - + android:layout_width="wrap_content" + android:orientation="vertical" + android:padding="15dp" > - + + - + - - \ No newline at end of file + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127..7bcc782 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,10 +1,29 @@ + + + - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 #FF000000 + #FF2196F3 + #FF1976D2 + #FF0D47A1 + #FFE53935 + #FFD32F2F #FFFFFFFF \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 19b37b0..5a461af 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -29,34 +29,57 @@ Unknown GPRS + General Packet Radio Service EDGE + Enhanced Data rates for GSM Evolution UMTS + Universal Mobile Telecommunications System CDMA + Code-Division Multiple Access EVDO 0 + Evolution-Data Optimized release 0 EVDO A + Evolution-Data Optimized revision A 1xRTT + Single-Carrier Radio Transmission Technology HSDPA + High Speed Downlink Packet Access HSUPA + High-Speed Uplink Packet Access HSPA + High Speed Packet Access IDEN + Integrated Digital Enhanced Network EVDO B + Evolution-Data Optimized revision B LTE + Long-Term Evolution EHRPD + Enhanced High-Rate Packet Data HSPAP + High Speed Packet Access Plus GSM - TD SCDMA + Global System for Mobile Communications + TD-SCDMA + Time Division-Synchronous Code Division Multiple Access IWLAN + Interworking Wireless LAN NR + New Radio Error None LTE CA + Long-Term Evolution Carrier Aggregation LTE Advanced Pro - LTE NR NSA - Long Term Evolution New Radio Non-StandAlone - LTE NR NSA MMWave - Long Term Evolution New Radio Non-StandAlong MilliMeter Wavae + mmWave 5G network + LTE NR NSA + Long Term Evolution New Radio Non-Standalone + LTE NR NSA mmWave + Long Term Evolution New Radio Non-Standalone millimeter Wave - Your device is connected to a standalone 5G network and is (at least a little bit more) secure from stingray IMSI man-in-the-middle attacks. - Your device is not connected to a standalone 5G network and is not secure from stingray IMSI man-in-the-middle attacks. + Your device is connected to a standalone 5G network.\n\nIt is secure from stingray IMSI man-in-the-middle attacks. + Your device is not connected to a standalone 5G network.\n\nIt is not secure from stingray IMSI man-in-the-middle attacks. \ No newline at end of file