Skip to content

Commit

Permalink
Better code organization and further improvements to UI and UX!
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihai-Cristian Condrea committed Sep 28, 2024
1 parent c43cdb7 commit 9c2c187
Show file tree
Hide file tree
Showing 80 changed files with 875 additions and 731 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 = 23
targetSdk = 34
versionCode = 124
versionCode = 125
versionName = "2.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations += listOf(
Expand Down
60 changes: 30 additions & 30 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
android:theme="@style/AppTheme"
tools:targetApi="33">

<activity android:name=".ui.startup.StartupActivity" />
<activity android:name=".ui.screens.startup.StartupActivity" />

<activity
android:name=".ui.main.MainActivity"
android:name=".ui.screens.main.MainActivity"
android:exported="true"
android:theme="@style/SplashScreenTheme">
<intent-filter>
Expand All @@ -71,55 +71,55 @@
</activity>

<activity
android:name=".ui.support.SupportActivity"
android:parentActivityName=".ui.main.MainActivity" />
android:name=".ui.screens.support.SupportActivity"
android:parentActivityName=".ui.screens.main.MainActivity" />

<activity
android:name=".ui.imageoptimizer.imageoptimizer.ImageOptimizerActivity"
android:name=".ui.screens.imageoptimizer.imageoptimizer.ImageOptimizerActivity"
android:exported="true"
android:label="@string/image_optimizer"
android:parentActivityName=".ui.main.MainActivity" />
android:parentActivityName=".ui.screens.main.MainActivity" />

<activity
android:name=".ui.imageoptimizer.imagepicker.ImagePickerActivity"
android:name=".ui.screens.imageoptimizer.imagepicker.ImagePickerActivity"
android:exported="true"
android:label="@string/image_optimizer"
android:parentActivityName=".ui.imageoptimizer.imageoptimizer.ImageOptimizerActivity" />
android:parentActivityName=".ui.screens.imageoptimizer.imageoptimizer.ImageOptimizerActivity" />

<activity
android:name=".ui.settings.SettingsActivity"
android:name=".ui.screens.settings.SettingsActivity"
android:exported="true"
android:label="@string/settings"
android:parentActivityName=".ui.main.MainActivity">
android:parentActivityName=".ui.screens.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
</intent-filter>
</activity>

<activity
android:name=".ui.settings.display.DisplaySettingsActivity"
android:parentActivityName=".ui.settings.SettingsActivity" />
android:name=".ui.screens.settings.display.DisplaySettingsActivity"
android:parentActivityName=".ui.screens.settings.SettingsActivity" />

<activity
android:name=".ui.settings.display.theme.ThemeSettingsActivity"
android:parentActivityName=".ui.settings.display.DisplaySettingsActivity" />
android:name=".ui.screens.settings.display.theme.ThemeSettingsActivity"
android:parentActivityName=".ui.screens.settings.display.DisplaySettingsActivity" />

<activity
android:name=".ui.settings.cleaning.CleaningSettingsActivity"
android:parentActivityName=".ui.settings.SettingsActivity" />
android:name=".ui.screens.settings.cleaning.CleaningSettingsActivity"
android:parentActivityName=".ui.screens.settings.SettingsActivity" />

<activity
android:name=".ui.settings.advanced.AdvancedSettingsActivity"
android:parentActivityName=".ui.settings.SettingsActivity" />
android:name=".ui.screens.settings.advanced.AdvancedSettingsActivity"
android:parentActivityName=".ui.screens.settings.SettingsActivity" />

<activity
android:name=".ui.settings.privacy.PrivacySettingsActivity"
android:parentActivityName=".ui.settings.SettingsActivity" />
android:name=".ui.screens.settings.privacy.PrivacySettingsActivity"
android:parentActivityName=".ui.screens.settings.SettingsActivity" />

<activity
android:name=".ui.settings.privacy.permissions.PermissionsSettingsActivity"
android:name=".ui.screens.settings.privacy.permissions.PermissionsSettingsActivity"
android:exported="true"
android:parentActivityName=".ui.settings.privacy.PrivacySettingsActivity"
android:parentActivityName=".ui.screens.settings.privacy.PrivacySettingsActivity"
android:permission="android.permission.START_VIEW_PERMISSION_USAGE">
<intent-filter>
<action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
Expand All @@ -130,16 +130,16 @@
</activity>

<activity
android:name=".ui.settings.privacy.usage.UsageAndDiagnosticsActivity"
android:parentActivityName=".ui.settings.privacy.PrivacySettingsActivity" />
android:name=".ui.screens.settings.privacy.usage.UsageAndDiagnosticsActivity"
android:parentActivityName=".ui.screens.settings.privacy.PrivacySettingsActivity" />

<activity
android:name=".ui.settings.privacy.ads.AdsSettingsActivity"
android:parentActivityName=".ui.settings.privacy.PrivacySettingsActivity" />
android:name=".ui.screens.settings.privacy.ads.AdsSettingsActivity"
android:parentActivityName=".ui.screens.settings.privacy.PrivacySettingsActivity" />

<activity
android:name=".ui.settings.about.AboutSettingsActivity"
android:parentActivityName=".ui.settings.SettingsActivity" />
android:name=".ui.screens.settings.about.AboutSettingsActivity"
android:parentActivityName=".ui.screens.settings.SettingsActivity" />

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
Expand All @@ -150,8 +150,8 @@
android:theme="@style/AppThemeActionBar" />

<activity
android:name=".ui.help.HelpActivity"
android:parentActivityName=".ui.main.MainActivity" />
android:name=".ui.screens.help.HelpActivity"
android:parentActivityName=".ui.screens.main.MainActivity" />

<provider
android:name="androidx.core.content.FileProvider"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.utils.compose
package com.d4rk.cleaner.ui.components

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.utils.compose.components
package com.d4rk.cleaner.ui.components

import android.view.SoundEffectConstants
import android.view.View
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.utils.compose.components
package com.d4rk.cleaner.ui.components

import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.LinearOutSlowInEasing
Expand All @@ -24,7 +24,7 @@ import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.d4rk.cleaner.data.model.ui.memorymanager.StorageInfo
import com.d4rk.cleaner.utils.compose.bounceClick
import com.d4rk.cleaner.ui.components.animations.bounceClick

/**
* Composable function representing a circular determinate progress indicator with storage information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ads
package com.d4rk.cleaner.ui.components.ads

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.utils.compose
package com.d4rk.cleaner.ui.components.animations

import android.content.Context
import androidx.compose.animation.core.animateFloatAsState
Expand Down Expand Up @@ -26,35 +26,38 @@ import com.d4rk.cleaner.data.model.ui.button.ButtonState

@Composable
fun Modifier.bounceClick(
animationEnabled: Boolean = true
): Modifier = composed {
var buttonState: ButtonState by remember { mutableStateOf(ButtonState.Idle) }
val context: Context = LocalContext.current
val dataStore: DataStore = DataStore.getInstance(context)
animationEnabled : Boolean = true ,
) : Modifier = composed {
var buttonState : ButtonState by remember { mutableStateOf(ButtonState.Idle) }
val context : Context = LocalContext.current
val dataStore : DataStore = DataStore.getInstance(context)
val bouncyButtonsEnabled : Boolean by dataStore.bouncyButtons.collectAsState(initial = true)
val scale: Float by animateFloatAsState(
if (buttonState == ButtonState.Pressed && animationEnabled && bouncyButtonsEnabled) 0.96f else 1f,
val scale : Float by animateFloatAsState(
if (buttonState == ButtonState.Pressed && animationEnabled && bouncyButtonsEnabled) 0.96f else 1f ,
label = "Button Press Scale Animation"
)

if (bouncyButtonsEnabled) {
this.graphicsLayer {
scaleX = scale
scaleY = scale
}
return@composed this
.graphicsLayer {
scaleX = scale
scaleY = scale
}
.pointerInput(buttonState) {
awaitPointerEventScope {
buttonState = if (buttonState == ButtonState.Pressed) {
waitForUpOrCancellation()
ButtonState.Idle
} else {
}
else {
awaitFirstDown(requireUnconsumed = false)
ButtonState.Pressed
}
}
}
} else {
this
}
else {
return@composed this
}
}

Expand All @@ -73,7 +76,7 @@ fun Modifier.hapticDrawerSwipe(drawerState : DrawerState) : Modifier = composed
}
}

this
return@composed this
}

fun Modifier.hapticPagerSwipe(pagerState : PagerState) : Modifier = composed {
Expand All @@ -90,5 +93,5 @@ fun Modifier.hapticPagerSwipe(pagerState : PagerState) : Modifier = composed {
}
}

this
return@composed this
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.dialogs
package com.d4rk.cleaner.ui.components.dialogs

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.dialogs
package com.d4rk.cleaner.ui.components.dialogs

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.dialogs
package com.d4rk.cleaner.ui.components.dialogs

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.dialogs
package com.d4rk.cleaner.ui.components.dialogs

import android.app.Dialog
import android.app.NotificationManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.dialogs
package com.d4rk.cleaner.ui.components.dialogs

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.d4rk.cleaner.ui.dialogs
package com.d4rk.cleaner.ui.components.dialogs

import android.content.Context
import android.graphics.drawable.Drawable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.d4rk.cleaner.ui.components.navigation

import android.view.SoundEffectConstants
import android.view.View
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavController
import androidx.navigation.compose.currentBackStackEntryAsState
import com.d4rk.cleaner.ui.components.ads.FullBannerAdsComposable
import com.d4rk.cleaner.data.datastore.DataStore
import com.d4rk.cleaner.data.model.ui.navigation.BottomNavigationScreen
import com.d4rk.cleaner.ui.components.animations.bounceClick

@Composable
fun BottomNavBar(
navController: NavController ,
dataStore: DataStore ,
view: View
) {
val bottomBarItems: List<BottomNavigationScreen> = listOf(
BottomNavigationScreen.Home,
BottomNavigationScreen.AppManager,
BottomNavigationScreen.MemoryManager
)
val showLabels: Boolean =
dataStore.getShowBottomBarLabels().collectAsState(initial = true).value

Column {
FullBannerAdsComposable(
modifier = Modifier.fillMaxWidth() , dataStore = dataStore
)
NavigationBar {
val navBackStackEntry: NavBackStackEntry? by navController.currentBackStackEntryAsState()
val currentRoute: String? = navBackStackEntry?.destination?.route
bottomBarItems.forEach { screen ->
NavigationBarItem(modifier = Modifier.bounceClick(),
icon = {
val iconResource: ImageVector =
if (currentRoute == screen.route) screen.selectedIcon else screen.icon
Icon(
iconResource,
contentDescription = null
)
},
label = {
if (showLabels) Text(
text = stringResource(id = screen.title)
)
},
selected = currentRoute == screen.route,
onClick = {
view.playSoundEffect(SoundEffectConstants.CLICK)
navController.navigate(screen.route) {
popUpTo(navController.graph.startDestinationId)
launchSingleTop = true
}
})
}
}
}
}
Loading

0 comments on commit 9c2c187

Please sign in to comment.