Clear cache, configure cache size #482
No reviewers
Labels
No Label
Priority-high
Accepting-merge-requests
API
API-dependency
Backport
Blocked
Brainstorming
Breaking
Bug
Changelog
CI
Cleanup
Confirmed
Discussion
Documentation
Duplicate
Enhancement
External-dependecy
F-droid
Feature
Google-play
Improvement
Invalid
Investigate
LGTM-done
LGTM-need
Long-term
Major-release
Minor-release
Needs-cleanup
Needs-feedback
Needs-help
Priority-critical
Priority-low
Priority-medium
Question
Ready
Refactor
Regression
Release
Repository
Security
Suggestion
Support
Testing
Translation
UI/UX
Upstream
Website
WIP
No Milestone
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitnex/GitNex#482
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "app-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #347 and closes #349
To do:
@ -636,3 +646,3 @@
<string name="appreanceHintText">Themes, fonts, badges, code block theme</string>
<string name="fileViewerHintText">PDF mode, source code theme</string>
<string name="securityHintText">SSL certificates</string>
<string name="securityHintText">SSL certificates, cache</string>
Would use an uppercase 'c' instead.
I have used lower for all subsequent text following Android settings screen.
Then its ok. :)
@ -32,2 +34,3 @@
TinyDB tinyDb = new TinyDB(ctx);
final boolean connToInternet = AppUtil.haveNetworkConnection(ctx);
int cacheSize = 50 * 1024 * 1024; // 50MB
int cacheSize = FilesData.returnOnlyNumber(tinyDb.getString("cacheSizeStr")) * 1024 * 1024; // 50MB
Please remove
// 50MB
.@ -43,0 +98,4 @@
try {
FileUtils.deleteDirectory(cacheDir);
FileUtils.mkdir(String.valueOf(cacheDir));
Would'nt
cacheDir.getAbsolutePath()
be better?Or just use
cacheDir.mkdirs()
getCacheDir() also return absolute path.
But it returns a file.
cacheDir.getAbsolutePath()
returns a string and that is what you would need.I thought you meant the path. Yes, I will use that. :)
@ -0,0 +17,4 @@
String sizeInNumber = "";
if(fileSize.contains("MB")) {
sizeInNumber = fileSize.replace(" MB", "");
My suggestion would be to just use:
One liner. Nice.
@mmarif For picasso cache:
https://gitea.com/gitnex/GitNex/src/branch/master/app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java#L29
@opyale I just checked the picasso cache and the maxSize does take any arguments. Need to pass context to TinyDb. Another way I am thinking of is to pass context to the constructor and set the CACHE_SIZE there.
Ok, this PR is ready for a ride.
@ -117,2 +120,3 @@
return CACHE_SIZE;
TinyDB tinyDb = new TinyDB(ctx);
return FilesData.returnOnlyNumber(tinyDb.getString("cacheSizeImagesStr")) * 1024 * 1024;
maxSize()
gets called over and over again. Every time something gets cached.I dont think this is very good for overall performance.
I would just initialize the variable
CACHE_SIZE
with the current chache size from TinyDB.This will fix the init,
4b4e31c230
Great.
Works. 👍
The only thing I noticed was that my profile picture wont load anymore (in the navigation drawer) once I cleared the cache, but this may possibly not be related to these changes.
Just noticed this, but yeah it's not related to these changes.