-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6044c7e
commit aaa6e78
Showing
10 changed files
with
81 additions
and
294 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/src/main/kotlin/com/d4rk/cleaner/data/model/ButtonState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.d4rk.cleaner.data.model | ||
|
||
enum class ButtonState { Pressed , Idle } |
7 changes: 7 additions & 0 deletions
7
app/src/main/kotlin/com/d4rk/cleaner/data/model/InternalStorageInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.d4rk.cleaner.data.model | ||
|
||
data class InternalStorageInfo( | ||
val totalStorage: Long, | ||
val freeStorage: Long, | ||
val usedStorage: Long | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.d4rk.cleaner.data.model | ||
|
||
data class RamInfo( | ||
val totalRam: Long = 0, | ||
val availableRam: Long = 0, | ||
val usedRam: Long = 0 | ||
) |
8 changes: 8 additions & 0 deletions
8
app/src/main/kotlin/com/d4rk/cleaner/data/model/StorageInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.d4rk.cleaner.data.model | ||
|
||
data class StorageInfo( | ||
val totalStorage: Long = 0, | ||
val freeStorage: Long = 0, | ||
val usedStorage: Long = 0, | ||
val storageBreakdown: Map<String, Long> = emptyMap() | ||
) |
228 changes: 0 additions & 228 deletions
228
app/src/main/kotlin/com/d4rk/cleaner/ui/memory/MemoryFragment.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/src/main/kotlin/com/d4rk/cleaner/utils/AnimationUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.d4rk.cleaner.utils | ||
|
||
import android.annotation.SuppressLint | ||
import androidx.compose.animation.core.animateFloatAsState | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.gestures.awaitFirstDown | ||
import androidx.compose.foundation.gestures.waitForUpOrCancellation | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.composed | ||
import androidx.compose.ui.graphics.graphicsLayer | ||
import androidx.compose.ui.input.pointer.pointerInput | ||
import com.d4rk.cleaner.data.model.ButtonState | ||
|
||
@SuppressLint("ReturnFromAwaitPointerEventScope") | ||
@Composable | ||
fun Modifier.bounceClick() = composed { | ||
var buttonState by remember { mutableStateOf(ButtonState.Idle) } | ||
val scale by animateFloatAsState( | ||
if (buttonState == ButtonState.Pressed) 0.95f else 1f , label = "" | ||
) | ||
this | ||
.graphicsLayer { | ||
scaleX = scale | ||
scaleY = scale | ||
} | ||
.clickable(interactionSource = remember { MutableInteractionSource() } , | ||
indication = null , | ||
onClick = { }) | ||
.pointerInput(buttonState) { | ||
awaitPointerEventScope { | ||
buttonState = if (buttonState == ButtonState.Pressed) { | ||
waitForUpOrCancellation() | ||
ButtonState.Idle | ||
} | ||
else { | ||
awaitFirstDown(false) | ||
ButtonState.Pressed | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.