Skip to content

Commit

Permalink
More code cleanup and strings resources usages
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jul 11, 2024
1 parent 124f259 commit dc1e51e
Show file tree
Hide file tree
Showing 24 changed files with 985 additions and 915 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ free and open-source software!

# Features

- Automatic daily cleaning
- App management
- Image optimization
- Clean empty folders
Expand Down
3 changes: 2 additions & 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 = 90
versionCode = 92
versionName = "2.0.0"
archivesName = "${applicationId}-v${versionName}"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -35,6 +35,7 @@ android {
"bg",
"pl",
"uk",
"b+zh+rTW",
)
vectorDrawables {
useSupportLibrary = true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.ACTION_OPEN_DOCUMENT_TREE" />
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 @@ -165,7 +165,7 @@ fun MainComposable() {
}
}) {
Icon(
imageVector = Icons.Default.Menu, contentDescription = "Menu"
imageVector = Icons.Default.Menu, contentDescription = stringResource(id = R.string.navigation_drawer_open)
)
}
}, actions = {
Expand All @@ -174,7 +174,7 @@ fun MainComposable() {
}) {
Icon(
Icons.Outlined.VolunteerActivism,
contentDescription = "Support"
contentDescription = stringResource(id = R.string.support_us)
)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ fun AppManagerComposable() {
factory = AppManagerViewModelFactory(LocalContext.current.applicationContext as Application)
)
val context = LocalContext.current
val tabs = listOf("Installed Apps", "System Apps", "App Install Files")
val tabs = listOf(
stringResource(id = R.string.installed_apps),
stringResource(id = R.string.system_apps),
stringResource(id = R.string.app_install_files)
)
val pagerState = rememberPagerState(pageCount = { tabs.size })
val coroutineScope = rememberCoroutineScope()
val isLoading by viewModel.isLoading.collectAsState()
Expand Down Expand Up @@ -353,7 +357,7 @@ fun ApkItemComposable(apkPath: String) {
context.startActivity(Intent.createChooser(shareIntent, "Share APK"))
})

DropdownMenuItem(text = { Text("Install") }, onClick = {
DropdownMenuItem(text = { Text(stringResource(id = R.string.installed)) }, onClick = {
val installIntent = Intent(Intent.ACTION_VIEW)
installIntent.setDataAndType(
Uri.fromFile(apkFile),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.d4rk.cleaner.R


@Composable
Expand All @@ -14,8 +15,8 @@ fun RescanAlertDialog(
) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("Rescan?") },
text = { Text("Are you sure you want to scan again?") },
title = { Text(stringResource(id = R.string.rescan_title)) },
text = { Text(stringResource(id = R.string.rescan_message)) },
confirmButton = {
TextButton(onClick = onYes) {
Text(stringResource(android.R.string.ok))
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/kotlin/com/d4rk/cleaner/ui/home/HomeComposable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.asFlow
Expand Down Expand Up @@ -198,7 +199,7 @@ fun HomeComposable() {
contentDescription = null,
modifier = Modifier.size(ButtonDefaults.IconSize)
)
Text(text = "Clean", style = MaterialTheme.typography.bodyMedium)
Text(text = stringResource(R.string.clean), style = MaterialTheme.typography.bodyMedium)
}
}
}
Expand All @@ -224,7 +225,7 @@ fun HomeComposable() {
contentDescription = null,
modifier = Modifier.size(ButtonDefaults.IconSize)
)
Text(text = "Analyze", style = MaterialTheme.typography.bodyMedium)
Text(text = stringResource(R.string.analyze), style = MaterialTheme.typography.bodyMedium)
}
}
}
Expand Down Expand Up @@ -291,9 +292,9 @@ fun AnalyzeComposable(launchScanningKey: MutableState<Boolean>, imageLoader: Ima
horizontalArrangement = Arrangement.SpaceBetween,
) {
val statusText = if (selectedFileCount > 0) {
"Status: Selected $selectedFileCount files"
stringResource(id = R.string.status_selected_files, selectedFileCount)
} else {
"Status: No files selected"
stringResource(id = R.string.status_no_files_selected)
}
val statusColor by animateColorAsState(
targetValue = if (selectedFileCount > 0) {
Expand Down Expand Up @@ -432,7 +433,7 @@ fun SelectAllComposable(
onClick = {
onCheckedChange(!checked)
},
label = { Text("Select All") },
label = { Text(stringResource(id = R.string.select_all)) },
leadingIcon = {
AnimatedContent(targetState = checked, label = "") { targetChecked ->
if (targetChecked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import com.d4rk.cleaner.databinding.ActivityImageOptimizerBinding
import com.d4rk.cleaner.ui.imageoptimizer.imageoptimizer.tabs.FileSizeFragment
import com.d4rk.cleaner.ui.imageoptimizer.imageoptimizer.tabs.ManualModeFragment
import com.d4rk.cleaner.ui.imageoptimizer.imageoptimizer.tabs.QuickCompressFragment
import com.d4rk.cleaner.ui.viewmodel.ImageOptimizerViewModel
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.MobileAds
import com.google.android.material.snackbar.Snackbar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.viewmodel
package com.d4rk.cleaner.ui.imageoptimizer.imageoptimizer

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.d4rk.cleaner.R
import com.d4rk.cleaner.databinding.FragmentQuickCompressBinding
import com.d4rk.cleaner.ui.viewmodel.ImageOptimizerViewModel
import com.d4rk.cleaner.ui.imageoptimizer.imageoptimizer.ImageOptimizerViewModel

class QuickCompressFragment : Fragment() {
private lateinit var binding: FragmentQuickCompressBinding
Expand Down
Loading

0 comments on commit dc1e51e

Please sign in to comment.