Java Code Examples for com.danimahardhika.android.helpers.core.FileHelper#clearDirectory()
The following examples show how to use
com.danimahardhika.android.helpers.core.FileHelper#clearDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LicenseCallbackHelper.java From candybar with Apache License 2.0 | 5 votes |
private void onLicenseChecked(LicenseHelper.Status status) { Preferences.get(mContext).setFirstRun(false); if (status == LicenseHelper.Status.SUCCESS) { Preferences.get(mContext).setLicensed(true); if (Preferences.get(mContext).isNewVersion()) { ChangelogFragment.showChangelog(((AppCompatActivity) mContext).getSupportFragmentManager()); File cache = mContext.getCacheDir(); FileHelper.clearDirectory(cache); } } else if (status == LicenseHelper.Status.FAILED) { Preferences.get(mContext).setLicensed(false); ((AppCompatActivity) mContext).finish(); } }
Example 2
Source File: PlaystoreCheckHelper.java From candybar with Apache License 2.0 | 5 votes |
private void doIfNewVersion() { if (Preferences.get(mContext).isNewVersion()) { ChangelogFragment.showChangelog(((AppCompatActivity) mContext).getSupportFragmentManager()); File cache = mContext.getCacheDir(); FileHelper.clearDirectory(cache); } }
Example 3
Source File: CandyBarMainActivity.java From candybar with Apache License 2.0 | 4 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.setTheme(Preferences.get(this).isDarkTheme() ? R.style.AppThemeDark : R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ColorHelper.setupStatusBarIconColor(this); ColorHelper.setNavigationBarColor(this, ContextCompat.getColor(this, Preferences.get(this).isDarkTheme() ? R.color.navigationBarDark : R.color.navigationBar)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !Preferences.get(this).isDarkTheme()) { int flags = 0; if (ColorHelper.isLightColor(ContextCompat.getColor(this, R.color.navigationBar))) flags = flags | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; if (ColorHelper.isLightColor(ContextCompat.getColor(this, R.color.colorPrimaryDark))) flags = flags | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; if (flags != 0) { this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); this.getWindow().getDecorView().setSystemUiVisibility(flags); this.getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); } } registerBroadcastReceiver(); startService(new Intent(this, CandyBarService.class)); //Todo: wait until google fix the issue, then enable wallpaper crop again on API 26+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Preferences.get(this).setCropWallpaper(false); } mConfig = onInit(); InAppBillingProcessor.get(this).init(mConfig.getLicenseKey()); mDrawerLayout = findViewById(R.id.drawer_layout); mNavigationView = findViewById(R.id.navigation_view); Toolbar toolbar = findViewById(R.id.toolbar); mToolbarTitle = findViewById(R.id.toolbar_title); toolbar.setPopupTheme(Preferences.get(this).isDarkTheme() ? R.style.AppThemeDark : R.style.AppTheme); toolbar.setTitle(""); setSupportActionBar(toolbar); mFragManager = getSupportFragmentManager(); initNavigationView(toolbar); initNavigationViewHeader(); mPosition = mLastPosition = 0; if (savedInstanceState != null) { mPosition = mLastPosition = savedInstanceState.getInt(Extras.EXTRA_POSITION, 0); onSearchExpanded(false); } Bundle bundle = getIntent().getExtras(); if (bundle != null) { int position = bundle.getInt(Extras.EXTRA_POSITION, -1); if (position >= 0 && position < 5) { mPosition = mLastPosition = position; } } IntentHelper.sAction = IntentHelper.getAction(getIntent()); if (IntentHelper.sAction == IntentHelper.ACTION_DEFAULT) { setFragment(getFragment(mPosition)); } else { setFragment(getActionFragment(IntentHelper.sAction)); } checkWallpapers(); IconRequestTask.start(this, AsyncTask.THREAD_POOL_EXECUTOR); IconsLoaderTask.start(this); new PlaystoreCheckHelper(this).run(); if (Preferences.get(this).isFirstRun() && mConfig.isLicenseCheckerEnabled()) { mLicenseHelper = new LicenseHelper(this); mLicenseHelper.run(mConfig.getLicenseKey(), mConfig.getRandomString(), new LicenseCallbackHelper(this)); return; } if (!Preferences.get(this).isPlaystoreCheckEnabled() && !mConfig.isLicenseCheckerEnabled()) { if (Preferences.get(this).isNewVersion()) { ChangelogFragment.showChangelog(mFragManager); File cache = this.getCacheDir(); FileHelper.clearDirectory(cache); } } if (mConfig.isLicenseCheckerEnabled() && !Preferences.get(this).isLicensed()) { finish(); } }