treewide: Nullability fixes for AOSP 14 r29
All checks were successful
/ build-debug (push) Successful in 4m48s
All checks were successful
/ build-debug (push) Successful in 4m48s
Mainly a treewide `findViewById` -> `requireViewById`, with miscellaneous fixes.
This commit is contained in:
parent
348395c48d
commit
3a0d805eb2
|
@ -58,9 +58,9 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
|
|||
): View {
|
||||
val view = inflater.inflate(R.layout.fragment_euicc, container, false)
|
||||
|
||||
swipeRefresh = view.findViewById(R.id.swipe_refresh)
|
||||
fab = view.findViewById(R.id.fab)
|
||||
profileList = view.findViewById(R.id.profile_list)
|
||||
swipeRefresh = view.requireViewById(R.id.swipe_refresh)
|
||||
fab = view.requireViewById(R.id.fab)
|
||||
profileList = view.requireViewById(R.id.profile_list)
|
||||
|
||||
return view
|
||||
}
|
||||
|
@ -191,11 +191,11 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
|
|||
}
|
||||
|
||||
inner class ProfileViewHolder(private val root: View) : ViewHolder(root) {
|
||||
private val iccid: TextView = root.findViewById(R.id.iccid)
|
||||
private val name: TextView = root.findViewById(R.id.name)
|
||||
private val state: TextView = root.findViewById(R.id.state)
|
||||
private val provider: TextView = root.findViewById(R.id.provider)
|
||||
private val profileMenu: ImageButton = root.findViewById(R.id.profile_menu)
|
||||
private val iccid: TextView = root.requireViewById(R.id.iccid)
|
||||
private val name: TextView = root.requireViewById(R.id.name)
|
||||
private val state: TextView = root.requireViewById(R.id.state)
|
||||
private val provider: TextView = root.requireViewById(R.id.provider)
|
||||
private val profileMenu: ImageButton = root.requireViewById(R.id.profile_menu)
|
||||
|
||||
init {
|
||||
iccid.setOnClickListener {
|
||||
|
|
|
@ -39,12 +39,12 @@ class LogsActivity : AppCompatActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_logs)
|
||||
setSupportActionBar(findViewById(R.id.toolbar))
|
||||
setSupportActionBar(requireViewById(R.id.toolbar))
|
||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
swipeRefresh = findViewById(R.id.swipe_refresh)
|
||||
scrollView = findViewById(R.id.scroll_view)
|
||||
logText = findViewById(R.id.log_text)
|
||||
swipeRefresh = requireViewById(R.id.swipe_refresh)
|
||||
scrollView = requireViewById(R.id.scroll_view)
|
||||
logText = requireViewById(R.id.log_text)
|
||||
|
||||
swipeRefresh.setOnRefreshListener {
|
||||
lifecycleScope.launch {
|
||||
|
|
|
@ -36,9 +36,9 @@ open class MainActivity : AppCompatActivity(), OpenEuiccContextMarker {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
setSupportActionBar(findViewById(R.id.toolbar))
|
||||
setSupportActionBar(requireViewById(R.id.toolbar))
|
||||
|
||||
noEuiccPlaceholder = findViewById(R.id.no_euicc_placeholder)
|
||||
noEuiccPlaceholder = requireViewById(R.id.no_euicc_placeholder)
|
||||
|
||||
tm = telephonyManager
|
||||
|
||||
|
|
|
@ -37,14 +37,14 @@ class NotificationsActivity: AppCompatActivity(), OpenEuiccContextMarker {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_notifications)
|
||||
setSupportActionBar(findViewById(R.id.toolbar))
|
||||
setSupportActionBar(requireViewById(R.id.toolbar))
|
||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
euiccChannel = euiccChannelManager
|
||||
.findEuiccChannelBySlotBlocking(intent.getIntExtra("logicalSlotId", 0))!!
|
||||
|
||||
swipeRefresh = findViewById(R.id.swipe_refresh)
|
||||
notificationList = findViewById(R.id.recycler_view)
|
||||
swipeRefresh = requireViewById(R.id.swipe_refresh)
|
||||
notificationList = requireViewById(R.id.recycler_view)
|
||||
|
||||
notificationList.layoutManager =
|
||||
LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
|
@ -118,8 +118,8 @@ class NotificationsActivity: AppCompatActivity(), OpenEuiccContextMarker {
|
|||
@SuppressLint("ClickableViewAccessibility")
|
||||
inner class NotificationViewHolder(private val root: View):
|
||||
RecyclerView.ViewHolder(root), View.OnCreateContextMenuListener, OnMenuItemClickListener {
|
||||
private val address: TextView = root.findViewById(R.id.notification_address)
|
||||
private val profileName: TextView = root.findViewById(R.id.notification_profile_name)
|
||||
private val address: TextView = root.requireViewById(R.id.notification_address)
|
||||
private val profileName: TextView = root.requireViewById(R.id.notification_profile_name)
|
||||
|
||||
private lateinit var notification: LocalProfileNotificationWrapper
|
||||
|
||||
|
|
|
@ -69,13 +69,13 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
|||
): View {
|
||||
val view = inflater.inflate(R.layout.fragment_profile_download, container, false)
|
||||
|
||||
toolbar = view.findViewById(R.id.toolbar)
|
||||
profileDownloadServer = view.findViewById(R.id.profile_download_server)
|
||||
profileDownloadCode = view.findViewById(R.id.profile_download_code)
|
||||
profileDownloadConfirmationCode = view.findViewById(R.id.profile_download_confirmation_code)
|
||||
profileDownloadIMEI = view.findViewById(R.id.profile_download_imei)
|
||||
profileDownloadFreeSpace = view.findViewById(R.id.profile_download_free_space)
|
||||
progress = view.findViewById(R.id.progress)
|
||||
toolbar = view.requireViewById(R.id.toolbar)
|
||||
profileDownloadServer = view.requireViewById(R.id.profile_download_server)
|
||||
profileDownloadCode = view.requireViewById(R.id.profile_download_code)
|
||||
profileDownloadConfirmationCode = view.requireViewById(R.id.profile_download_confirmation_code)
|
||||
profileDownloadIMEI = view.requireViewById(R.id.profile_download_imei)
|
||||
profileDownloadFreeSpace = view.requireViewById(R.id.profile_download_free_space)
|
||||
progress = view.requireViewById(R.id.progress)
|
||||
|
||||
toolbar.inflateMenu(R.menu.fragment_profile_download)
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ class ProfileRenameFragment : BaseMaterialDialogFragment(), EuiccChannelFragment
|
|||
): View {
|
||||
val view = inflater.inflate(R.layout.fragment_profile_rename, container, false)
|
||||
|
||||
toolbar = view.findViewById(R.id.toolbar)
|
||||
profileRenameNewName = view.findViewById(R.id.profile_rename_new_name)
|
||||
progress = view.findViewById(R.id.progress)
|
||||
toolbar = view.requireViewById(R.id.toolbar)
|
||||
profileRenameNewName = view.requireViewById(R.id.profile_rename_new_name)
|
||||
progress = view.requireViewById(R.id.progress)
|
||||
|
||||
toolbar.inflateMenu(R.menu.fragment_profile_rename)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class SettingsActivity: AppCompatActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_settings)
|
||||
setSupportActionBar(findViewById(R.id.toolbar))
|
||||
setSupportActionBar(requireViewById(R.id.toolbar))
|
||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.settings_container, SettingsFragment())
|
||||
|
|
|
@ -39,13 +39,13 @@ class SlotSelectFragment : BaseMaterialDialogFragment(), OpenEuiccContextMarker
|
|||
): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_slot_select, container, false)
|
||||
|
||||
toolbar = view.findViewById(R.id.toolbar)
|
||||
toolbar = view.requireViewById(R.id.toolbar)
|
||||
toolbar.setTitle(R.string.slot_select)
|
||||
toolbar.inflateMenu(R.menu.fragment_slot_select)
|
||||
|
||||
val adapter = ArrayAdapter<String>(inflater.context, R.layout.spinner_item)
|
||||
|
||||
spinner = view.findViewById(R.id.spinner)
|
||||
spinner = view.requireViewById(R.id.spinner)
|
||||
spinner.adapter = adapter
|
||||
|
||||
channels.forEach { channel ->
|
||||
|
|
|
@ -24,7 +24,7 @@ val Context.selfAppVersion: String
|
|||
get() =
|
||||
try {
|
||||
val pInfo = packageManager.getPackageInfo(packageName, 0)
|
||||
pInfo.versionName
|
||||
pInfo.versionName!!
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
throw RuntimeException(e)
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ class CompatibilityCheckActivity: AppCompatActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_compatibility_check)
|
||||
setSupportActionBar(findViewById(R.id.toolbar))
|
||||
setSupportActionBar(requireViewById(R.id.toolbar))
|
||||
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
compatibilityCheckList = findViewById(R.id.recycler_view)
|
||||
compatibilityCheckList = requireViewById(R.id.recycler_view)
|
||||
compatibilityCheckList.layoutManager =
|
||||
LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
compatibilityCheckList.addItemDecoration(DividerItemDecoration(this, LinearLayoutManager.VERTICAL))
|
||||
|
@ -51,9 +51,9 @@ class CompatibilityCheckActivity: AppCompatActivity() {
|
|||
}
|
||||
|
||||
inner class ViewHolder(private val root: View): RecyclerView.ViewHolder(root) {
|
||||
private val titleView: TextView = root.findViewById(R.id.compatibility_check_title)
|
||||
private val descView: TextView = root.findViewById(R.id.compatibility_check_desc)
|
||||
private val statusContainer: ViewGroup = root.findViewById(R.id.compatibility_check_status_container)
|
||||
private val titleView: TextView = root.requireViewById(R.id.compatibility_check_title)
|
||||
private val descView: TextView = root.requireViewById(R.id.compatibility_check_desc)
|
||||
private val statusContainer: ViewGroup = root.requireViewById(R.id.compatibility_check_status_container)
|
||||
|
||||
fun bindItem(item: CompatibilityCheck) {
|
||||
titleView.text = item.title
|
||||
|
@ -65,16 +65,16 @@ class CompatibilityCheckActivity: AppCompatActivity() {
|
|||
|
||||
when (item.state) {
|
||||
CompatibilityCheck.State.SUCCESS -> {
|
||||
root.findViewById<View>(R.id.compatibility_check_checkmark).visibility = View.VISIBLE
|
||||
root.requireViewById<View>(R.id.compatibility_check_checkmark).visibility = View.VISIBLE
|
||||
}
|
||||
CompatibilityCheck.State.FAILURE -> {
|
||||
root.findViewById<View>(R.id.compatibility_check_error).visibility = View.VISIBLE
|
||||
root.requireViewById<View>(R.id.compatibility_check_error).visibility = View.VISIBLE
|
||||
}
|
||||
CompatibilityCheck.State.FAILURE_UNKNOWN -> {
|
||||
root.findViewById<View>(R.id.compatibility_check_unknown).visibility = View.VISIBLE
|
||||
root.requireViewById<View>(R.id.compatibility_check_unknown).visibility = View.VISIBLE
|
||||
}
|
||||
else -> {
|
||||
root.findViewById<View>(R.id.compatibility_check_progress_bar).visibility = View.VISIBLE
|
||||
root.requireViewById<View>(R.id.compatibility_check_progress_bar).visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,9 +104,9 @@ class OpenEuiccService : EuiccService(), OpenEuiccContextMarker {
|
|||
return GetDefaultDownloadableSubscriptionListResult(RESULT_OK, arrayOf())
|
||||
}
|
||||
|
||||
override fun onGetEuiccProfileInfoList(slotId: Int): GetEuiccProfileInfoListResult? {
|
||||
override fun onGetEuiccProfileInfoList(slotId: Int): GetEuiccProfileInfoListResult {
|
||||
Log.i(TAG, "onGetEuiccProfileInfoList slotId=$slotId")
|
||||
val channel = findChannel(slotId) ?: return null
|
||||
val channel = findChannel(slotId)!!
|
||||
val profiles = channel.lpa.profiles.operational.map {
|
||||
EuiccProfileInfo.Builder(it.iccid).apply {
|
||||
setProfileName(it.name)
|
||||
|
|
|
@ -10,10 +10,10 @@ class LuiActivity : AppCompatActivity() {
|
|||
super.onStart()
|
||||
setContentView(R.layout.activity_lui)
|
||||
|
||||
findViewById<View>(R.id.lui_skip).setOnClickListener { finish() }
|
||||
requireViewById<View>(R.id.lui_skip).setOnClickListener { finish() }
|
||||
// TODO: Deactivate LuiActivity if there is no eSIM found.
|
||||
// TODO: Support pre-filled download info (from carrier apps); UX
|
||||
findViewById<View>(R.id.lui_download).setOnClickListener {
|
||||
requireViewById<View>(R.id.lui_download).setOnClickListener {
|
||||
startActivity(Intent(this, DirectProfileDownloadActivity::class.java))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
|
|||
override suspend fun onCreateFooterViews(parent: ViewGroup): List<View> =
|
||||
if (channel.isMEP) {
|
||||
val view = layoutInflater.inflate(R.layout.footer_mep, parent, false)
|
||||
view.findViewById<Button>(R.id.footer_mep_slot_mapping).setOnClickListener {
|
||||
view.requireViewById<Button>(R.id.footer_mep_slot_mapping).setOnClickListener {
|
||||
(requireActivity() as PrivilegedMainActivity).showSlotMappingFragment()
|
||||
}
|
||||
listOf(view)
|
||||
|
|
|
@ -51,12 +51,12 @@ class SlotMappingFragment: BaseMaterialDialogFragment(),
|
|||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
val view = inflater.inflate(R.layout.fragment_slot_mapping, container, false)
|
||||
toolbar = view.findViewById(R.id.toolbar)
|
||||
toolbar = view.requireViewById(R.id.toolbar)
|
||||
toolbar.inflateMenu(R.menu.fragment_slot_mapping)
|
||||
recyclerView = view.findViewById(R.id.mapping_list)
|
||||
recyclerView = view.requireViewById(R.id.mapping_list)
|
||||
recyclerView.layoutManager =
|
||||
LinearLayoutManager(view.context, LinearLayoutManager.VERTICAL, false)
|
||||
helpTextView = view.findViewById(R.id.mapping_help)
|
||||
helpTextView = view.requireViewById(R.id.mapping_help)
|
||||
return view
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,8 @@ class SlotMappingFragment: BaseMaterialDialogFragment(),
|
|||
}
|
||||
|
||||
inner class ViewHolder(root: View): RecyclerView.ViewHolder(root), OnItemSelectedListener {
|
||||
private val textViewLogicalSlot: TextView = root.findViewById(R.id.slot_mapping_logical_slot)
|
||||
private val spinnerPorts: Spinner = root.findViewById(R.id.slot_mapping_ports)
|
||||
private val textViewLogicalSlot: TextView = root.requireViewById(R.id.slot_mapping_logical_slot)
|
||||
private val spinnerPorts: Spinner = root.requireViewById(R.id.slot_mapping_ports)
|
||||
|
||||
init {
|
||||
spinnerPorts.adapter = ArrayAdapter(requireContext(), im.angry.openeuicc.common.R.layout.spinner_item, portsDesc)
|
||||
|
|
|
@ -95,9 +95,9 @@ fun TelephonyManager.iccOpenLogicalChannelByPortCompat(
|
|||
slotIndex: Int, portIndex: Int, aid: String?, p2: Int
|
||||
): IccOpenLogicalChannelResponse =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
iccOpenLogicalChannelByPort(slotIndex, portIndex, aid, p2)
|
||||
iccOpenLogicalChannelByPort(slotIndex, portIndex, aid, p2)!!
|
||||
} else {
|
||||
iccOpenLogicalChannelBySlot(slotIndex, aid, p2)
|
||||
iccOpenLogicalChannelBySlot(slotIndex, aid, p2)!!
|
||||
}
|
||||
|
||||
fun TelephonyManager.iccCloseLogicalChannelByPortCompat(
|
||||
|
|
Loading…
Reference in a new issue