(Bundle savedInstanceState)
| 320 | } |
| 321 | |
| 322 | @Override |
| 323 | protected void onCreate(Bundle savedInstanceState) { |
| 324 | EntityLog.log(this, "Activity create " + this.getClass().getName() + |
| 325 | " version=" + BuildConfig.VERSION_NAME + BuildConfig.REVISION + |
| 326 | " process=" + android.os.Process.myPid()); |
| 327 | Intent intent = getIntent(); |
| 328 | if (intent != null) |
| 329 | EntityLog.log(this, intent + |
| 330 | " extras=" + TextUtils.join(", ", Log.getExtras(intent.getExtras()))); |
| 331 | |
| 332 | Window window = getWindow(); |
| 333 | getSupportFragmentManager().registerFragmentLifecycleCallbacks(lifecycleCallbacks, true); |
| 334 | |
| 335 | this.contacts = hasPermission(Manifest.permission.READ_CONTACTS); |
| 336 | |
| 337 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); |
| 338 | |
| 339 | boolean secure = prefs.getBoolean("secure", false); |
| 340 | if (secure) |
| 341 | window.addFlags(WindowManager.LayoutParams.FLAG_SECURE); |
| 342 | |
| 343 | if (!this.getClass().equals(ActivityMain.class)) { |
| 344 | themeId = FragmentDialogTheme.getTheme(this); |
| 345 | setTheme(themeId); |
| 346 | |
| 347 | EdgeToEdge.enable(this); |
| 348 | |
| 349 | boolean edge_to_edge = prefs.getBoolean("edge_to_edge", false); |
| 350 | int colorStatus = Helper.resolveColor(this, androidx.appcompat.R.attr.colorPrimary); |
| 351 | int colorNavigation = (edge_to_edge |
| 352 | ? (Helper.isDarkTheme(this) ? Color.BLACK : Color.WHITE) : colorStatus); |
| 353 | double lumStatus = ColorUtils.calculateLuminance(colorStatus); |
| 354 | double lumNavigation = ColorUtils.calculateLuminance(colorNavigation); |
| 355 | EntityLog.log(this, "NAVBAR e2e=" + edge_to_edge + |
| 356 | " color=" + Integer.toHexString(colorStatus) + "/" + Integer.toHexString(colorNavigation) + |
| 357 | " dark=" + Helper.isDarkTheme(this) + |
| 358 | " lum=" + lumStatus + "/" + lumNavigation + |
| 359 | " light=" + (lumStatus > LUMINANCE_THRESHOLD) + "/" + (lumNavigation > LUMINANCE_THRESHOLD)); |
| 360 | |
| 361 | WindowInsetsControllerCompat controller = WindowCompat.getInsetsController(window, window.getDecorView()); |
| 362 | controller.setAppearanceLightStatusBars(lumStatus > LUMINANCE_THRESHOLD); |
| 363 | controller.setAppearanceLightNavigationBars(lumNavigation > LUMINANCE_THRESHOLD); |
| 364 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { |
| 365 | window.setNavigationBarColor(Color.TRANSPARENT); |
| 366 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) |
| 367 | window.setNavigationBarContrastEnforced(false); |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | String requestKey = getRequestKey(); |
| 372 | if (!BuildConfig.PLAY_STORE_RELEASE) |
| 373 | EntityLog.log(this, "Listening key=" + requestKey); |
| 374 | getSupportFragmentManager().setFragmentResultListener(requestKey, this, new FragmentResultListener() { |
| 375 | @Override |
| 376 | public void onFragmentResult(@NonNull String requestKey, @NonNull Bundle result) { |
| 377 | try { |
| 378 | result.setClassLoader(ApplicationEx.class.getClassLoader()); |
| 379 | int requestCode = result.getInt("requestCode"); |
nothing calls this directly
no test coverage detected