Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/kotlin/com/d4rk/cleaner/MainActivity.kt
  • Loading branch information
Mihai-Cristian Condrea committed Jun 2, 2024
2 parents 7d3300d + d92ee7b commit af46eaa
Show file tree
Hide file tree
Showing 19 changed files with 479 additions and 581 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage me"]
labels: [ "bug", "triage me" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Feature request
description: File a feature request
title: "[FR]: "
labels: ["enhancement", "triage me"]
labels: [ "enhancement", "triage me" ]
body:
- type: markdown
attributes:
Expand Down
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: weekly
time: "11:00"
open-pull-requests-limit: 10
- package-ecosystem: gradle
directory: "/"
schedule:
interval: weekly
time: "11:00"
open-pull-requests-limit: 10
208 changes: 104 additions & 104 deletions app/src/main/kotlin/com/d4rk/cleaner/MainComposable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.navigation.compose.NavHost
Expand All @@ -59,125 +58,126 @@ import kotlinx.coroutines.launch
@Composable
fun MainComposable() {
val bottomBarItems = listOf(
Screen.Home , Screen.AppManager , Screen.MemoryManager
Screen.Home, Screen.AppManager, Screen.MemoryManager
)
val drawerItems = listOf(
NavigationItem(
title = R.string.whitelist , selectedIcon = Icons.AutoMirrored.Outlined.ListAlt
) ,
title = R.string.whitelist, selectedIcon = Icons.AutoMirrored.Outlined.ListAlt
),

NavigationItem(
title = R.string.image_optimizer , selectedIcon = Icons.Outlined.Image
) ,
title = R.string.image_optimizer, selectedIcon = Icons.Outlined.Image
),

NavigationItem(
title = R.string.settings ,
selectedIcon = Icons.Outlined.Settings ,
) ,
title = R.string.settings,
selectedIcon = Icons.Outlined.Settings,
),
NavigationItem(
title = R.string.help_and_feedback ,
selectedIcon = Icons.AutoMirrored.Outlined.Help ,
) ,
title = R.string.help_and_feedback,
selectedIcon = Icons.AutoMirrored.Outlined.Help,
),
NavigationItem(
title = R.string.updates ,
selectedIcon = Icons.AutoMirrored.Outlined.EventNote ,
) ,
title = R.string.updates,
selectedIcon = Icons.AutoMirrored.Outlined.EventNote,
),
NavigationItem(
title = R.string.share , selectedIcon = Icons.Outlined.Share
) ,
title = R.string.share, selectedIcon = Icons.Outlined.Share
),
)
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
val scope = rememberCoroutineScope()
val navController = rememberNavController()
val context = LocalContext.current
val selectedItemIndex by rememberSaveable { mutableIntStateOf(- 1) }
ModalNavigationDrawer(drawerState = drawerState , drawerContent = {
val selectedItemIndex by rememberSaveable { mutableIntStateOf(-1) }
ModalNavigationDrawer(drawerState = drawerState, drawerContent = {
ModalDrawerSheet {
Spacer(modifier = Modifier.height(16.dp))
drawerItems.forEachIndexed { index , item ->
drawerItems.forEachIndexed { index, item ->
val title = stringResource(item.title)
NavigationDrawerItem(label = { Text(text = title) } ,
selected = index == selectedItemIndex ,
onClick = {
when (item.title) {
R.string.whitelist -> {
Utils.openActivity(
context , WhitelistActivity::class.java
)
}
NavigationDrawerItem(
label = { Text(text = title) },
selected = index == selectedItemIndex,
onClick = {
when (item.title) {
R.string.whitelist -> {
Utils.openActivity(
context, WhitelistActivity::class.java
)
}

R.string.image_optimizer -> {
Utils.openActivity(
context , ImagePickerActivity::class.java
)
}
R.string.image_optimizer -> {
Utils.openActivity(
context, ImagePickerActivity::class.java
)
}

R.string.settings -> {
Utils.openActivity(
context , SettingsActivity::class.java
)
}
R.string.settings -> {
Utils.openActivity(
context, SettingsActivity::class.java
)
}

R.string.help_and_feedback -> {
Utils.openActivity(
context , HelpActivity::class.java
)
}
R.string.help_and_feedback -> {
Utils.openActivity(
context, HelpActivity::class.java
)
}

R.string.updates -> {
Utils.openUrl(
context ,
"https://github.com/D4rK7355608/${context.packageName}/blob/master/CHANGELOG.md"
)
}
R.string.updates -> {
Utils.openUrl(
context,
"https://github.com/D4rK7355608/${context.packageName}/blob/master/CHANGELOG.md"
)
}

R.string.share -> {
val shareIntent = Intent().apply {
this.action = Intent.ACTION_SEND
this.putExtra(
Intent.EXTRA_TEXT , context.getString(
R.string.summary_share_message ,
"https://play.google.com/store/apps/details?id=${context.packageName}"
)
)
this.type = "text/plain"
}
context.startActivity(
Intent.createChooser(
shareIntent , context.resources.getText(
R.string.send_email_using
)
)
)
}
}
scope.launch {
drawerState.close()
}
} ,
icon = {
Icon(
item.selectedIcon , contentDescription = title
)
} ,
badge = {
item.badgeCount?.let {
Text(text = item.badgeCount.toString())
}
} ,
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
R.string.share -> {
val shareIntent = Intent().apply {
this.action = Intent.ACTION_SEND
this.putExtra(
Intent.EXTRA_TEXT, context.getString(
R.string.summary_share_message,
"https://play.google.com/store/apps/details?id=${context.packageName}"
)
)
this.type = "text/plain"
}
context.startActivity(
Intent.createChooser(
shareIntent, context.resources.getText(
R.string.send_email_using
)
)
)
}
}
scope.launch {
drawerState.close()
}
},
icon = {
Icon(
item.selectedIcon, contentDescription = title
)
},
badge = {
item.badgeCount?.let {
Text(text = item.badgeCount.toString())
}
},
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
)
if (item.title == R.string.image_optimizer) {
HorizontalDivider(modifier = Modifier.padding(8.dp))
}
}
}

} , content = {
}, content = {
Scaffold(topBar = {
TopAppBar(title = {
Text(text = stringResource(R.string.app_name))
} , navigationIcon = {
}, navigationIcon = {
IconButton(onClick = {
scope.launch {
drawerState.apply {
Expand All @@ -186,41 +186,41 @@ fun MainComposable() {
}
}) {
Icon(
imageVector = Icons.Default.Menu , contentDescription = "Menu"
imageVector = Icons.Default.Menu, contentDescription = "Menu"
)
}
} , actions = {
}, actions = {
IconButton(onClick = {
Utils.openActivity(context , SupportActivity::class.java)
Utils.openActivity(context, SupportActivity::class.java)
}) {
Icon(
Icons.Outlined.VolunteerActivism ,
Icons.Outlined.VolunteerActivism,
contentDescription = "Support"
)
}
})
} , bottomBar = {
}, bottomBar = {
NavigationBar {
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry?.destination?.route
bottomBarItems.forEach { screen ->
NavigationBarItem(icon = {
val iconResource =
if (currentRoute == screen.route) screen.selectedIcon else screen.icon
Icon(iconResource , contentDescription = null)
} ,
label = { Text(stringResource(screen.title)) } ,
selected = currentRoute == screen.route ,
onClick = {
navController.navigate(screen.route) {
popUpTo(navController.graph.startDestinationId)
launchSingleTop = true
}
})
if (currentRoute == screen.route) screen.selectedIcon else screen.icon
Icon(iconResource, contentDescription = null)
},
label = { Text(stringResource(screen.title)) },
selected = currentRoute == screen.route,
onClick = {
navController.navigate(screen.route) {
popUpTo(navController.graph.startDestinationId)
launchSingleTop = true
}
})
}
}
}) { innerPadding ->
NavHost(navController , startDestination = Screen.Home.route) {
NavHost(navController, startDestination = Screen.Home.route) {
composable(Screen.Home.route) {
Box(modifier = Modifier.padding(innerPadding)) {
HomeComposable()
Expand Down
41 changes: 0 additions & 41 deletions app/src/main/kotlin/com/d4rk/cleaner/adapters/CpuAdapter.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.d4rk.cleaner.data.navigation
import androidx.compose.ui.graphics.vector.ImageVector

data class NavigationItem(
val title : Int , val selectedIcon : ImageVector , val badgeCount : Int? = null
val title: Int, val selectedIcon: ImageVector, val badgeCount: Int? = null
)
12 changes: 6 additions & 6 deletions app/src/main/kotlin/com/d4rk/cleaner/data/navigation/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import androidx.compose.ui.graphics.vector.ImageVector
import com.d4rk.cleaner.R

sealed class Screen(
val route : String , val icon : ImageVector , val selectedIcon : ImageVector , val title : Int
val route: String, val icon: ImageVector, val selectedIcon: ImageVector, val title: Int
) {
data object Home : Screen("Home" , Icons.Outlined.Home , Icons.Filled.Home , R.string.home)
data object Home : Screen("Home", Icons.Outlined.Home, Icons.Filled.Home, R.string.home)

data object AppManager : Screen(
"App Manager" ,
Icons.Sharp.AppRegistration ,
Icons.Rounded.AppRegistration ,
"App Manager",
Icons.Sharp.AppRegistration,
Icons.Rounded.AppRegistration,
R.string.app_manager
)

data object MemoryManager : Screen(
"Memory Manager" , Icons.Sharp.Storage , Icons.Rounded.Storage , R.string.memory_manager
"Memory Manager", Icons.Sharp.Storage, Icons.Rounded.Storage, R.string.memory_manager
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class RequireRestartDialog : DialogFragment() {
Process.killProcess(Process.myPid())
}.setNegativeButton(android.R.string.cancel, null).show()
}
}
}
Loading

0 comments on commit af46eaa

Please sign in to comment.