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 authored and GitHub committed 2024-10-25 18:55:56 +08:00
1 parent fc132f7282
commit 5f8ea93f36
1 file changed
+1 -4
@@ -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()))
}
}