Refactor attachBaseContext for Null Safety and Clean Code (#3769)

Simplified the attachBaseContext function by removing redundant let block and ensuring null safety with concise null handling. This refactor improves readability and ensures that null cases are handled directly.
This commit is contained in:
Tamim Hossain
2024-10-25 16:55:56 +06:00
committed by GitHub
parent fc132f7282
commit 5f8ea93f36

View File

@@ -34,9 +34,6 @@ abstract class BaseActivity : AppCompatActivity() {
@RequiresApi(Build.VERSION_CODES.N)
override fun attachBaseContext(newBase: Context?) {
val context = newBase?.let {
MyContextWrapper.wrap(newBase, Utils.getLocale())
}
super.attachBaseContext(context)
super.attachBaseContext(MyContextWrapper.wrap(newBase ?: return, Utils.getLocale()))
}
}