Skip to content

Commit

Permalink
Cleared the code and preparing for the release ASAP
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihai-Cristian Condrea committed Oct 26, 2024
1 parent d1ee539 commit 57791eb
Show file tree
Hide file tree
Showing 38 changed files with 188 additions and 327 deletions.
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
appealing user interface.
- **New**: Implemented date-based filtering in the Analyze screen, allowing for easier file
selection and management.
- **Patch**:Resolved an issue where APK installation from the App Manager was not functioning
- **Patch**: Resolved an issue where APK installation from the App Manager was not functioning
correctly.
- **Patch**:Improved the "Select All" button behavior in the App Manager to ensure accurate state
- **Patch**: Improved the "Select All" button behavior in the App Manager to ensure accurate state
representation.
- **New**: Introduced loading indicators in the App Manager for a smoother and more informative
experience.
- **New**: Added messages to indicate when no apps or APKs are found.
- **Patch**:Optimized app loading speed in the App Manager through code refactoring and efficiency
- **Patch**: Optimized app loading speed in the App Manager through code refactoring and efficiency
improvements.
- **New**: Enabled real-time RAM usage monitoring in the Memory Manager.
- **New**: A new Trash screen has been added to provide more granular control over your device's storage.
- **New**: Added a loading animation to the Memory Manager for visual feedback during data
retrieval.
- **New**: Introduced a new setting to customize the app's startup page, providing users with
greater control over their initial experience.
- **New**: Added an option to disable the bounce click effect for users who prefer a more
traditional interaction style.
- **Patch**:Resolved an issue where language selection was not consistently applied.
- **Patch**: Resolved an issue where language selection was not consistently applied.
- **New**: Added a snackbar notification for older Android versions when users copy device
information from the About section.
- **New**: Integrated haptic feedback for swipe gestures, enhancing the tactile response and user
Expand All @@ -29,7 +30,7 @@
- **New**: Redesigned the Settings page, aligning it with the modern aesthetics of the Android 15
design system.
- **Minor**: Backported the app to support devices running Android 6.0 and above.
- **Patch**:Fixed visual glitches within the App Manager.
- **Patch**: Fixed visual glitches within the App Manager.
- **Major**: Restructured the app's code flow for improved organization and future extensibility.
- **Major**: Implemented a robust error handling mechanism to gracefully manage unexpected
situations and provide helpful feedback to users.
Expand Down
5 changes: 3 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35
namespace = "com.d4rk.cleaner"
defaultConfig {
applicationId = "com.d4rk.cleaner"
minSdk = 23
targetSdk = 35
versionCode = 138
versionCode = 139
versionName = "3.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations += listOf(
Expand Down Expand Up @@ -64,6 +64,7 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}
Expand Down
18 changes: 1 addition & 17 deletions app/src/main/kotlin/com/d4rk/cleaner/data/datastore/DataStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,11 @@ class DataStore(context : Context) {
}

private val lastScanTimestampKey = longPreferencesKey(name = "last_scan_timestamp")
val lastScanTimestamp : Flow<Long> = dataStore.data.map { preferences ->
preferences[lastScanTimestampKey] ?: 0L
}

suspend fun saveLastScanTimestamp(timestamp : Long) {
dataStore.edit { preferences ->
preferences[lastScanTimestampKey] = timestamp
println("Cleaner for Android -> Saved timestamp: $timestamp")
}
}

Expand All @@ -184,20 +182,6 @@ class DataStore(context : Context) {

private val trashFilePathsKey = stringSetPreferencesKey("trash_file_paths")

val trashFilePaths: Flow<Set<Pair<String, String>>> = dataStore.data.map { preferences ->
preferences[trashFilePathsKey]?.mapNotNull { entry ->
val parts = entry.split("||")
if (parts.size == 2) {
Pair(parts[0] , parts[1])
}
else {
println("Cleaner for Android -> Invalid entry in trashFilePaths: $entry. It should contain the '||' delimiter.")
null
}
}?.toSet() ?: emptySet()

}

suspend fun addTrashFilePath(pathPair: Pair<String, String>) {
dataStore.edit { settings ->
val currentPaths = settings[trashFilePathsKey] ?: emptySet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.d4rk.cleaner.data.model.ui.memorymanager

data class StorageInfo(
val totalStorage: Long = 0,
val storageUsageProgress: Float = 0f,
val freeStorage: Long = 0,
val usedStorage: Long = 0,
val storageBreakdown: Map<String, Long> = emptyMap()
val freeSpacePercentage: Int = 0,
val storageBreakdown: Map<String, Long> = emptyMap(),
val usedStorageFormatted: String = "",
val totalStorageFormatted: String = "",
val cleanedSpace: String = "0 KB" ,
)
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.d4rk.cleaner.data.model.ui.screens

import com.d4rk.cleaner.data.model.ui.memorymanager.StorageInfo
import java.io.File

data class UiHomeModel(
var storageUsageProgress : Float = 0f ,
var usedStorageFormatted : String = "" ,
var totalStorageFormatted : String = "" ,
val storageInfo: StorageInfo = StorageInfo() ,
var analyzeState : UiAnalyzeModel = UiAnalyzeModel() ,
var daysFromLastScan : Int = 0,
val cleanedSpace: String = "0 KB",
var daysFromLastScan : Int = 0 ,
var isRescanDialogVisible : Boolean = false ,
)

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/components/Buttons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.d4rk.cleaner.ui.components

import android.view.SoundEffectConstants
import android.view.View
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -52,7 +53,7 @@ fun TwoRowButtons(
modifier = Modifier.size(ButtonDefaults.IconSize)
)
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
Text(text = stringResource(id = onStartButtonText))
Text(text = stringResource(id = onStartButtonText), modifier = Modifier.basicMarquee())
}

Spacer(Modifier.width(8.dp))
Expand All @@ -73,7 +74,7 @@ fun TwoRowButtons(
modifier = Modifier.size(ButtonDefaults.IconSize)
)
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
Text(text = stringResource(id = onEndButtonText))
Text(text = stringResource(id = onEndButtonText), modifier = Modifier.basicMarquee())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fun CircularDeterminateIndicator(
@Composable
fun StorageProgressBar(storageInfo: StorageInfo) {
val progress: Float =
(storageInfo.usedStorage.toFloat() / storageInfo.totalStorage.toFloat()).coerceIn(
(storageInfo.usedStorage.toFloat() / storageInfo.storageUsageProgress).coerceIn(
0f, 1f
)
LinearProgressIndicator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.navDeepLink
import com.d4rk.cleaner.constants.ui.bottombar.BottomBarRoutes
import com.d4rk.cleaner.data.datastore.DataStore
import com.d4rk.cleaner.data.model.ui.navigation.BottomNavigationScreen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,19 +529,23 @@ fun FileCard(
onCheckedChange(checked)
} , modifier = Modifier.align(Alignment.TopEnd))

Text(
text = file.name ,
maxLines = 1 ,
overflow = TextOverflow.Ellipsis ,
Box(
modifier = Modifier
.fillMaxWidth()
.basicMarquee()
.background(
color = Color.Black.copy(alpha = 0.4f)
)
.padding(8.dp)
.align(Alignment.BottomCenter)
)
) {
Text(
text = file.name ,
maxLines = 1 ,
overflow = TextOverflow.Ellipsis ,
modifier = Modifier
.basicMarquee()
.padding(8.dp)
)
}
}
}
}
Expand Down Expand Up @@ -587,6 +591,7 @@ fun SelectAllComposable(
Icon(
imageVector = Icons.Filled.Check ,
contentDescription = null ,
modifier = Modifier.size(18.dp)
)
}
}
Expand Down
41 changes: 21 additions & 20 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/screens/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -26,7 +25,6 @@ import androidx.compose.runtime.key
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -80,19 +78,19 @@ fun HomeScreen() {
) {

if (! uiState.analyzeState.isAnalyzeScreenVisible) {
CircularDeterminateIndicator(progress = uiState.storageUsageProgress ,
CircularDeterminateIndicator(progress = uiState.storageInfo.storageUsageProgress ,
modifier = Modifier
.align(Alignment.TopCenter)
.offset(y = 98.dp) ,
onClick = {
viewModel.analyze()
})
LastScanInfo(
ExtraStorageInfo(
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = 16.dp) ,
cleanedSpace = uiState.cleanedSpace ,
daysFromLastScan = uiState.daysFromLastScan ,
cleanedSpace = uiState.storageInfo.cleanedSpace ,
freeSpace = "${uiState.storageInfo.freeSpacePercentage} %",
)
}

Expand All @@ -117,12 +115,11 @@ fun HomeScreen() {
}

@Composable
fun LastScanInfo(
fun ExtraStorageInfo(
modifier : Modifier = Modifier ,
cleanedSpace : String ,
daysFromLastScan : Int ,
freeSpace : String ,
) {
val context = LocalContext.current

Row(
modifier = modifier
Expand All @@ -135,30 +132,34 @@ fun LastScanInfo(
InfoColumn(
title = stringResource(id = R.string.cleaned_space) ,
value = cleanedSpace ,
isRecent = false
modifier = Modifier.weight(1f)
)

VerticalDivider()

InfoColumn(
title = stringResource(id = R.string.last_scan) ,
value = context.getString(R.string.last_scan_days_ago , daysFromLastScan) ,
isRecent = daysFromLastScan <= 2
title = stringResource(id = R.string.free_space) ,
value = freeSpace,
modifier = Modifier.weight(1f)
)
}
}

@Composable
fun InfoColumn(title : String , value : String , isRecent : Boolean) {
fun InfoColumn(
title: String,
value: String,
modifier: Modifier = Modifier
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally , modifier = Modifier.wrapContentSize()
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier
) {
Text(text = title , style = MaterialTheme.typography.bodySmall)
Text(text = title, style = MaterialTheme.typography.bodySmall)
Text(
text = value ,
style = MaterialTheme.typography.bodyMedium ,
color = if (isRecent) Color.Green else MaterialTheme.colorScheme.onSurface ,
maxLines = 2 ,
text = value,
style = MaterialTheme.typography.bodyMedium,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
}
Expand Down
Loading

0 comments on commit 57791eb

Please sign in to comment.