(Bundle savedInstanceState)
| 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 | } |
nothing calls this directly
no test coverage detected