Skip to content

Commit

Permalink
Improved the code and the animations
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jun 29, 2024
1 parent 3ec7cde commit f1f7641
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
applicationId = "com.d4rk.cleaner"
minSdk = 26
targetSdk = 34
versionCode = 73
versionCode = 75
versionName = "2.0.0"
archivesName = "${applicationId}-v${versionName}"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/d4rk/cleaner/MainComposable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.d4rk.cleaner.ads.FullBannerAdsComposable
import com.d4rk.cleaner.data.datastore.DataStore
import com.d4rk.cleaner.ui.components.navigation.NavigationDrawerItem
import com.d4rk.cleaner.ui.components.navigation.BottomNavigationScreen
import com.d4rk.cleaner.ui.appmanager.AppManagerComposable
import com.d4rk.cleaner.ui.components.navigation.BottomNavigationScreen
import com.d4rk.cleaner.ui.components.navigation.NavigationDrawerItem
import com.d4rk.cleaner.ui.help.HelpActivity
import com.d4rk.cleaner.ui.home.HomeComposable
import com.d4rk.cleaner.ui.imageoptimizer.ImagePickerActivity
Expand Down
42 changes: 30 additions & 12 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/home/HomeComposable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.asFlow
import androidx.lifecycle.viewmodel.compose.viewModel
import com.d4rk.cleaner.R
import com.d4rk.cleaner.ui.startup.StartupActivity
import com.d4rk.cleaner.utils.CircularDeterminateIndicator
import com.d4rk.cleaner.utils.Utils
import com.d4rk.cleaner.utils.bounceClick
import com.google.common.io.Files.getFileExtension
import java.io.File
Expand Down Expand Up @@ -109,8 +107,16 @@ fun HomeComposable() {
) {
AnimatedVisibility(
visible = showCleaningComposable,
enter = fadeIn() + expandHorizontally(expandFrom = Alignment.Start),
exit = fadeOut() + shrinkHorizontally(shrinkTowards = Alignment.Start),
enter = fadeIn(animationSpec = tween(durationMillis = 400)) +
expandHorizontally(
animationSpec = tween(durationMillis = 400),
expandFrom = Alignment.Start
),
exit = fadeOut(animationSpec = tween(durationMillis = 400)) +
shrinkHorizontally(
animationSpec = tween(durationMillis = 400),
shrinkTowards = Alignment.Start
),
modifier = Modifier.weight(1f)
) {
val enabled = !isAnalyzing && selectedFileCount > 0
Expand All @@ -129,9 +135,6 @@ fun HomeComposable() {
.bounceClick(),
onClick = {
viewModel.clean(activity = context as Activity)
Utils.openActivity(
context, StartupActivity::class.java
)
},
shape = MaterialTheme.shapes.medium,
enabled = enabled,
Expand Down Expand Up @@ -241,13 +244,24 @@ fun AnalyzeComposable() {
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text = if (selectedFileCount > 0) {
"Status: Selected $selectedFileCount files"
val statusText = if (selectedFileCount > 0) {
"Status: Selected $selectedFileCount files"
} else {
"Status: No files selected"
}
val statusColor by animateColorAsState(
targetValue = if (selectedFileCount > 0) {
MaterialTheme.colorScheme.primary
} else {
"Status: No files selected"
MaterialTheme.colorScheme.secondary
},
color = MaterialTheme.colorScheme.primary,
animationSpec = tween(), label = ""
)

Text(
text = statusText,
color = statusColor,
modifier = Modifier.animateContentSize()
)
SelectAllComposable(
checked = allFilesSelected,
Expand Down Expand Up @@ -335,6 +349,10 @@ fun FileItemComposable(
fileIconMap[it] = R.drawable.ic_video_file
}

context.resources.getStringArray(R.array.image_extensions).forEach {
fileIconMap[it] = R.drawable.ic_image
}

fileIconMap["nomedia"] = R.drawable.ic_draft
fileIconMap["vcf"] = R.drawable.ic_contact_page

Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/drawable-anydpi/ic_image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">

<path
android:fillColor="#000000"
android:pathData="M19 3H5c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2V5c0-1.1-0.9-2-2-2zm0 16H5V5h14v14zm-5-7l-3 3.72L9 13l-3 4h12l-4-5z" />
</vector>
Binary file removed app/src/main/res/font/font_poppins.ttf
Binary file not shown.
6 changes: 0 additions & 6 deletions app/src/main/res/layout/fragment_memory.xml

This file was deleted.

14 changes: 0 additions & 14 deletions app/src/main/res/layout/item_cpu_list.xml

This file was deleted.

1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
<string name="theme">Theme</string>



<string name="feedback">Feedback</string>
<string name="in_app_ads">In-app ads</string>
<string name="change_ad_settings">Change ad settings</string>
Expand Down

0 comments on commit f1f7641

Please sign in to comment.