forked from ReVanced/revanced-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
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
9065c0d
commit 54f0a69
Showing
17 changed files
with
575 additions
and
113 deletions.
There are no files selected for viewing
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
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
68 changes: 0 additions & 68 deletions
68
app/src/main/java/app/revanced/manager/compose/installer/utils/PM.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...mpose/installer/service/InstallService.kt → ...manager/compose/service/InstallService.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
2 changes: 1 addition & 1 deletion
2
...ose/installer/service/UninstallService.kt → ...nager/compose/service/UninstallService.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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/app/revanced/manager/compose/ui/component/AppIcon.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,41 @@ | ||
package app.revanced.manager.compose.ui.component | ||
|
||
import android.graphics.drawable.Drawable | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Android | ||
import androidx.compose.material3.LocalContentColor | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.graphics.vector.rememberVectorPainter | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.rememberAsyncImagePainter | ||
|
||
@Composable | ||
fun AppIcon( | ||
drawable: Drawable?, | ||
contentDescription: String?, | ||
size: Int = 48 | ||
) { | ||
if (drawable == null) { | ||
val image = rememberVectorPainter(Icons.Default.Android) | ||
val colorFilter = ColorFilter.tint(LocalContentColor.current) | ||
|
||
Image( | ||
image, | ||
contentDescription, | ||
Modifier.size(size.dp), | ||
colorFilter = colorFilter | ||
) | ||
} else { | ||
val image = rememberAsyncImagePainter(drawable) | ||
|
||
Image( | ||
image, | ||
contentDescription, | ||
Modifier.size(size.dp) | ||
) | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
app/src/main/java/app/revanced/manager/compose/ui/component/AppScaffold.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,60 @@ | ||
package app.revanced.manager.compose.ui.component | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.RowScope | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.ArrowBack | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.input.nestedscroll.nestedScroll | ||
import androidx.compose.ui.unit.dp | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun AppScaffold( | ||
topBar: @Composable (TopAppBarScrollBehavior) -> Unit = {}, | ||
bottomBar: @Composable () -> Unit = {}, | ||
floatingActionButton: @Composable () -> Unit = {}, | ||
content: @Composable (PaddingValues) -> Unit | ||
) { | ||
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()) | ||
|
||
Scaffold( | ||
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), | ||
topBar = { topBar(scrollBehavior) }, | ||
bottomBar = bottomBar, | ||
floatingActionButton = floatingActionButton, | ||
content = content | ||
) | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun AppTopBar( | ||
title: String, | ||
onBackClick: (() -> Unit)? = null, | ||
actions: @Composable (RowScope.() -> Unit) = {}, | ||
scrollBehavior: TopAppBarScrollBehavior? = null | ||
) { | ||
val containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp) | ||
|
||
TopAppBar( | ||
title = { Text(title) }, | ||
scrollBehavior = scrollBehavior, | ||
navigationIcon = { | ||
if (onBackClick != null) { | ||
IconButton(onClick = onBackClick) { | ||
Icon( | ||
imageVector = Icons.Default.ArrowBack, | ||
contentDescription = null | ||
) | ||
} | ||
} | ||
}, | ||
actions = actions, | ||
colors = TopAppBarDefaults.topAppBarColors( | ||
containerColor = containerColor | ||
) | ||
) | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/app/revanced/manager/compose/ui/component/LoadingIndicator.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,31 @@ | ||
package app.revanced.manager.compose.ui.component | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.CircularProgressIndicator | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import app.revanced.manager.compose.R | ||
|
||
@Composable | ||
fun LoadingIndicator(progress: Float? = null, text: Int? = R.string.loading_body) { | ||
Column( | ||
modifier = Modifier.fillMaxSize(), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
if (text != null) | ||
Text(stringResource(text)) | ||
if (progress == null) { | ||
CircularProgressIndicator(modifier = Modifier.padding(vertical = 16.dp)) | ||
} else { | ||
CircularProgressIndicator(progress = progress, modifier = Modifier.padding(vertical = 16.dp)) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.