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

Method onCreate

app/src/main/java/eu/faircode/email/ActivityMain.java:53–446  ·  view source on GitHub ↗
(Bundle savedInstanceState)

Source from the content-addressed store, hash-verified

51 Helper.getBackgroundExecutor(1, "main");
52
53 @Override
54 protected void onCreate(Bundle savedInstanceState) {
55 long now = new Date().getTime();
56
57 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
58 boolean accept_unsupported = prefs.getBoolean("accept_unsupported", false);
59 long accept_space = prefs.getLong("accept_space", 0);
60 boolean sync_on_launch = prefs.getBoolean("sync_on_launch", false);
61
62 long cake = Helper.getAvailableStorageSpace();
63 if (cake < Helper.MIN_REQUIRED_SPACE && accept_space < now) {
64 setTheme(R.style.AppThemeBlueOrangeLight);
65 super.onCreate(savedInstanceState);
66 setContentView(R.layout.activity_space);
67
68 TextView tvRemaining = findViewById(R.id.tvRemaining);
69 tvRemaining.setText(getString(R.string.app_cake_remaining,
70 Helper.humanReadableByteCount(cake)));
71
72 TextView tvRequired = findViewById(R.id.tvRequired);
73 tvRequired.setText(getString(R.string.app_cake_required,
74 Helper.humanReadableByteCount(Helper.MIN_REQUIRED_SPACE, true)));
75
76 Button btnFix = findViewById(R.id.btnFix);
77 btnFix.setOnClickListener(new View.OnClickListener() {
78 @Override
79 public void onClick(View v) {
80 Intent intent = new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS);
81 v.getContext().startActivity(intent);
82 }
83 });
84
85 Button btnContinue = findViewById(R.id.btnContinue);
86 btnContinue.setOnClickListener(new View.OnClickListener() {
87 @Override
88 public void onClick(View v) {
89 prefs.edit().putLong("accept_space", now + IGNORE_STORAGE_SPACE).commit();
90 ApplicationEx.restart(v.getContext(), "accept_space");
91 }
92 });
93
94 return;
95 }
96
97 if (!accept_unsupported &&
98 !Helper.isSupportedDevice() &&
99 Helper.isPlayStoreInstall()) {
100 setTheme(R.style.AppThemeBlueOrangeLight);
101 super.onCreate(savedInstanceState);
102 setContentView(R.layout.activity_unsupported);
103
104 Button btnContinue = findViewById(R.id.btnContinue);
105 btnContinue.setOnClickListener(new View.OnClickListener() {
106 @Override
107 public void onClick(View v) {
108 prefs.edit().putBoolean("accept_unsupported", true).commit();
109 ApplicationEx.restart(v.getContext(), "accept_unsupported");
110 }

Callers

nothing calls this directly

Calls 15

isSupportedDeviceMethod · 0.95
isPlayStoreInstallMethod · 0.95
eMethod · 0.95
iMethod · 0.95
shouldAuthenticateMethod · 0.95
isNightMethod · 0.95
getBooleanMethod · 0.80
getLongMethod · 0.80
setContentViewMethod · 0.80

Tested by

no test coverage detected