Skip to content

Commit

Permalink
Decent useful changes
Browse files Browse the repository at this point in the history
+ Added crash reporting (Kudos mostly to Gramophone projects for Uncaught Exception Handler backends, definitely really important to catch bugs and crashes)
+ Blacklists filter
+ Move aggresive filters to blacklist filter, disabled by default
+ use updatePercentage function instead of changing MainActivity gui bindings through FileScanner (cleaner code, and reusable FileScanner code in other projects).
+ Fixed Dynamic Colors not applied properly (i have to put it in Application, not MainActivity).
+ Fixed crashing when importing data, then clicking import/export again.
+ Reuse existing App.prefs, instead of creating individual prefs or rely on MainActivity.prefs.
+ [.github/ISSUE_TEMPLATE/bug-report] convert to .yml, and change some stuff...
+ [build.gradle] Disable crunch png by default, because its no longer needed, since the PNGs are optimized in the first place before compiling
+ [build.gradle] remove `.toString()` from `JavaVersion.VERSION_21`.
+ [build.gradle] Don't include some metadata (https://gitlab.com/IzzyOnDroid/repo/-/issues/491)
+ [build.gradle] Dependency upgrade...
+ [AndroidManifest] Add BlacklistActivity and ErrorActivity.
+ [App.kt] Count how many times the app has been run (not used yet, probably useful for first-run related code in the future).
+ [BootReceiver.kt] replace context with ctx.
+ [BootReceiver.kt] remove unnecessary runCleanup function.
+ [BootReceiver.kt] Replace ScheduledWorker.Companion variables with  Constants variables.
+ [MainActivity.kt] move some scan Thread calls to scan function directly to reduce duplicate codes.
+ [MainActivity.kt] cleanup addText function code.
+ [MainActivity.kt] remove unnecessary reset function code.
+ [MainActivity.kt] move MainActivity.convertSize to CommonFunctions.convertSize
+ [SettingsActivity.kt] use separate loadFragment function.
+ [SettingsActivity.kt] Simplify crashing code (by simply throwing Exception).
+ [WhitelistActivity.kt] Added ability to disable filters
+ [WhitelistActivity.kt] Mostly same codes as WhiteList, but for blacklists, and pressing add asks for path (can use Kotlin regex).
+ [FileScanner.kt] Import java.util.Locale instead of everything in java.util
+ [FileScanner.kt] Add ability to remove empty files
+ [FileScanner.kt] remove unnecessary gui variable
+ [FileScanner.kt] Simplify getListFiles logic
+ [FileScanner.kt] Simplify maxCycles code
+ [FileScanner.kt] remove aggresive filter related codes
+ [PanicResponderActivity.kt] Code cleanups...
+ [PanicResponderActivity.kt] Trying to make it run somewhat faster by using Thread...
+ [ScheduledWorker.kt] replace `controllers.MainActivity.Companion.convertSize` with `CommonFunctions.convertSize`
+ [ScheduledWorker.kt] move UNIQUE_WORK_NAME and WORK_TAG to Constants.BGCLEAN_WORK_NAME and Constants.BGCLEAN_WORK_TAG
+ [ScheduledWorker.kt] move makeStatusNotification to CommonFunctions
+ [preferences.xml] Add blacklist & whitelist button, remove aggressive filter, add empty file, replace "empty" key to "emptyFolder" (to avoid confusion, since we have new empty file option as well), add dynamic color toggle, and modify about section as well.
+ [README.md] remove Repobeats analytics image that links to old repo
+ Remove some ununsed translations (only default and in-rID, the rest are in next commit because there is wayy too many of these)
  • Loading branch information
MDP43140 committed Mar 2, 2024
1 parent a577a6c commit 5215c73
Show file tree
Hide file tree
Showing 24 changed files with 1,121 additions and 534 deletions.
32 changes: 0 additions & 32 deletions .github/ISSUE_TEMPLATE/bug-report.md

This file was deleted.

93 changes: 93 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Bug report
description: Create a bug report to help us improve
labels: [bug, needs triage]
body:
- type: checkboxes
id: checklist
attributes:
label: "Checklist"
options:
- label: "I am able to reproduce the bug with the latest version."
required: true
- label: "I made sure that there are *no existing issues* - [open](https://github.com/TeamNewPipe/NewPipe/issues) or [closed](https://github.com/TeamNewPipe/NewPipe/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true

- type: input
id: app-version
attributes:
label: Affected version
description: "In which version did you encounter the bug?"
placeholder: "x.x.x - Not required if you include the log"

- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce the bug
description: |
What did you do for the bug to show up?
placeholder: |
1. Go to '...'
2. Scroll down to '....'
3. Click on '....'
validations:
required: true

- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: |
What do you expect to happen?
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: |
What happens with the steps given above?
- type: textarea
id: screen-media
attributes:
label: Screenshots/Screen recordings
description: |
A picture or video is worth a thousand words.
If applicable, add screenshots or a screen recording to help explain your problem.
GitHub supports uploading them directly in the text box.
If your file is too big for GitHub to accept, try to compress it (ZIP-file) or feel free to paste a link to an image/video hoster here instead.
:heavy_exclamation_mark: DON'T POST SCREENSHOTS OF THE ERROR PAGE.
Instead, follow the instructions in the "Logs" section below.
- type: textarea
id: logs
attributes:
label: Logs
description: |
If your bug includes a crash log, tap on "Share formatted log" at the bottom, click "Copy to clipboard", and paste it here.
- type: input
id: device-os-info
attributes:
label: Affected Android/Custom ROM version
description: |
With what Operating System (+ version) did you encounter the bug?
placeholder: "eg. Android 13/LineageOS 20"

- type: input
id: device-model-info
attributes:
label: Affected device model
description: |
On what device did you encounter the bug?
placeholder: "eg. Google Pixel 7/Samsung Galaxy S10"

- type: textarea
id: additional-information
attributes:
label: Additional information
description: |
Any other information you'd like to include
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Despite hitting 100k users, he is no longer able to devote time to it. Thank you
[![GitHub issues](https://img.shields.io/github/issues/mdp43140/LTECleanerFOSS)](/issues)
[![License](https://img.shields.io/github/license/mdp43140/LTECleanerFOSS)](/blob/master/LICENSE)

![Alt](https://repobeats.axiom.co/api/embed/e57b4b0c0e47daffc4e7feb4cff54fa6a1bc4120.svg "Repobeats analytics image")

***The last Android cleaner you will ever need!***

Tired of the abundance of phone cleaners on the Play Store? Tired of
Expand All @@ -31,7 +29,8 @@ __LTE Cleaner is 100% free, open source, no ads, and deletes everything it claim
## Install
[GitHub](https://github.com/MDP43140/LTECleanerFOSS/files/13996640/app-release.zip)
[Build it yourself](#compiling-the-app)
[Original version (outdated)](https://github.com/theredspy15/LTECleanerFOSS)
[Original F-Droid (outdated)](https://f-droid.org/packages/theredspy15.ltecleanerfoss)
[Original source code (outdated)](https://github.com/theredspy15/LTECleanerFOSS)

## Features
- Clipboard clearing
Expand All @@ -46,6 +45,7 @@ Cleans:
- Advertisement folders

To do list (not guaranteed because i'm busy irl):
- Code cleanups
- Clean SD card (has to support minimal Android 10+, hopefully we can use StorageAccessFramework to make this work, but it might be a huge work that can take days, not possible with my spare time)
- Custom (regex) blacklist (In theory should be simple, just need to add additional rule matching to cleaning system, but implementing the separate Activity might be a bit painful)
- Regex whilelist
Expand Down
15 changes: 10 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ android {
release {
minifyEnabled true
shrinkResources true
crunchPngs true
//crunchPngs true // no longer needed, since the PNGs are optimized in the first place before compiling
debuggable false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_21.toString()
jvmTarget = JavaVersion.VERSION_21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
Expand All @@ -53,13 +53,18 @@ android {
resources.excludes.add("assets/dexopt/*")
resources.excludes.add("META-INF/*")
}
dependenciesInfo {
// https://gitlab.com/IzzyOnDroid/repo/-/issues/491
includeInApk = false
includeInBundle = false
}
}
dependencies {
//implementation fileTree(dir: 'libs', include: ['*.jar'])

//noinspection GradleCompatible
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "com.google.android.material:material:1.11.0"
implementation "androidx.appcompat:appcompat:1.7.0-alpha03"
implementation "com.google.android.material:material:1.12.0-alpha03"
implementation "androidx.gridlayout:gridlayout:1.1.0-beta01"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.2"

Expand All @@ -72,6 +77,6 @@ dependencies {
//Preference
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.work:work-runtime-ktx:2.9.0"
implementation "androidx.core:core-ktx:1.12.0"
implementation "androidx.core:core-ktx:1.13.0-alpha05"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:exported="false"
android:name=".controllers.BlacklistActivity"
android:parentActivityName=".controllers.SettingsActivity" />
<activity
android:exported="false"
android:name=".controllers.WhitelistActivity"
Expand All @@ -44,6 +48,9 @@
android:exported="false"
android:name=".controllers.SettingsActivity"
android:parentActivityName=".controllers.MainActivity" />
<activity
android:exported="false"
android:name=".controllers.ErrorActivity" />
<receiver
android:exported="false"
android:name=".BootReceiver">
Expand Down
34 changes: 21 additions & 13 deletions app/src/main/java/theredspy15/ltecleanerfoss/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@
*/
package theredspy15.ltecleanerfoss
import android.app.Application
import android.content.Intent
import android.content.pm.ShortcutInfo
import android.content.pm.ShortcutManager
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatDelegate
import android.graphics.drawable.Icon
import android.os.Build
import androidx.preference.PreferenceManager
import com.google.android.material.color.DynamicColors
import theredspy15.ltecleanerfoss.controllers.MainActivity
import theredspy15.ltecleanerfoss.controllers.SettingsActivity
import theredspy15.ltecleanerfoss.R
import theredspy15.ltecleanerfoss.CommonFunctions
class App: Application(){
var runCount = 0
override fun onCreate(){
super.onCreate()
// Catches bugs and crashes, and makes it easy to report the bug
Thread.setDefaultUncaughtExceptionHandler { _, paramThrowable ->
CommonFunctions.handleError(this, 3, paramThrowable)
}
prefs = PreferenceManager.getDefaultSharedPreferences(this)
updateTheme()
}
protected fun updateTheme(){
val auto = resources.getStringArray(R.array.themes)[0]
val light = resources.getStringArray(R.array.themes)[1]
val dark = resources.getStringArray(R.array.themes)[2]
val theme = prefs!!.getString("theme",auto)
AppCompatDelegate.setDefaultNightMode(when (theme) {
light -> AppCompatDelegate.MODE_NIGHT_NO
dark -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
})
// Stores how many times the app has been opened,
// Can also be used for first run related codes in the future, who knows...
runCount = prefs!!.getInt("runCount",0)
prefs!!.edit().putInt("runCount",runCount + 1).commit()
// Update theme and apply dynamic color
CommonFunctions.updateTheme(prefs)
if (prefs!!.getBoolean("dynamicColor",true)) DynamicColors.applyToActivitiesIfAvailable(this)
}
companion object {
@JvmField var prefs:SharedPreferences? = null
Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/theredspy15/ltecleanerfoss/BootReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,27 @@ import androidx.work.ExistingWorkPolicy
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
import java.util.concurrent.TimeUnit
import theredspy15.ltecleanerfoss.App
import theredspy15.ltecleanerfoss.Constants
class BootReceiver: BroadcastReceiver() {
override fun onReceive(ctxt: Context, i: Intent) {
runCleanup(ctxt)
}
fun runCleanup(context: Context){
val prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
override fun onReceive(ctx: Context, i: Intent) {
val constraints = Constraints.Builder()
.setRequiresBatteryNotLow(true)
.setRequiresDeviceIdle(true)
.build()

// Schedule the work hourly
ScheduledWorker.enqueueWork(context)
ScheduledWorker.enqueueWork(ctx)

// Schedule the work at boot completed
if (prefs.getBoolean("bootedcleanup",false)){
if (App.prefs!!.getBoolean("bootedcleanup",false)){
val myWork = OneTimeWorkRequestBuilder<ScheduledWorker>()
.addTag(ScheduledWorker.Companion.WORK_TAG)
.addTag(Constants.BGCLEAN_WORK_TAG)
.setConstraints(constraints)
.setInitialDelay(1, TimeUnit.MINUTES)
.build()
WorkManager.getInstance(context).enqueueUniqueWork(
ScheduledWorker.Companion.UNIQUE_WORK_NAME,
WorkManager.getInstance(ctx).enqueueUniqueWork(
Constants.BGCLEAN_WORK_NAME,
ExistingWorkPolicy.REPLACE,
myWork
)
Expand Down
Loading

0 comments on commit 5215c73

Please sign in to comment.