MCPcopy Create free account
hub / github.com/M66B/FairEmail / onCreate

Method onCreate

app/src/main/java/eu/faircode/email/ActivityBase.java:322–480  ·  view source on GitHub ↗
(Bundle savedInstanceState)

Source from the content-addressed store, hash-verified

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");

Callers

nothing calls this directly

Calls 15

logMethod · 0.95
getExtrasMethod · 0.95
hasPermissionMethod · 0.95
getThemeMethod · 0.95
resolveColorMethod · 0.95
isDarkThemeMethod · 0.95
getRequestKeyMethod · 0.95
wMethod · 0.95
eMethod · 0.95
checkAuthenticationMethod · 0.95
joinMethod · 0.80
getBooleanMethod · 0.80

Tested by

no test coverage detected