This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add library credits and bump version
- Loading branch information
Showing
13 changed files
with
415 additions
and
9 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
65 changes: 65 additions & 0 deletions
65
app/src/main/java/dev/beefers/vendetta/manager/ui/components/Label.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,65 @@ | ||
package dev.beefers.vendetta.manager.ui.components | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
@Composable | ||
fun Label( | ||
modifier: Modifier = Modifier, | ||
text: String? = null, | ||
icon: ImageVector? = null, | ||
textColor: Color, | ||
borderColor: Color = textColor, | ||
fillColor: Color = Color.Transparent, | ||
iconColor: Color = textColor | ||
) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(4.dp), | ||
modifier = Modifier | ||
.then(modifier) | ||
.clip(CircleShape) | ||
.background(fillColor) | ||
.border(1.dp, borderColor, CircleShape) | ||
.then( | ||
if (text == null) | ||
Modifier.padding(5.dp) | ||
else | ||
Modifier.padding(vertical = 5.dp, horizontal = 7.dp) | ||
) | ||
) { | ||
icon?.let { | ||
Icon( | ||
imageVector = it, | ||
contentDescription = null, | ||
tint = iconColor, | ||
modifier = Modifier.size(12.dp) | ||
) | ||
} | ||
text?.let { | ||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.labelSmall, | ||
fontSize = 10.sp, | ||
color = textColor, | ||
maxLines = 1 | ||
) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/dev/beefers/vendetta/manager/ui/components/ThinDivider.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,12 @@ | ||
package dev.beefers.vendetta.manager.ui.components | ||
|
||
import androidx.compose.material3.Divider | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun ThinDivider() = Divider( | ||
color = MaterialTheme.colorScheme.onSurface.copy(0.1f), | ||
thickness = 0.5.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
88 changes: 88 additions & 0 deletions
88
app/src/main/java/dev/beefers/vendetta/manager/ui/screen/libraries/LibrariesScreen.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,88 @@ | ||
package dev.beefers.vendetta.manager.ui.screen.libraries | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.foundation.lazy.itemsIndexed | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.ArrowBack | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.LargeTopAppBar | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.material3.TopAppBarScrollBehavior | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.input.nestedscroll.nestedScroll | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.stringResource | ||
import cafe.adriel.voyager.core.screen.Screen | ||
import cafe.adriel.voyager.koin.getScreenModel | ||
import cafe.adriel.voyager.navigator.LocalNavigator | ||
import cafe.adriel.voyager.navigator.currentOrThrow | ||
import dev.beefers.vendetta.manager.R | ||
import dev.beefers.vendetta.manager.domain.manager.PreferenceManager | ||
import dev.beefers.vendetta.manager.ui.components.ThinDivider | ||
import dev.beefers.vendetta.manager.ui.viewmodel.libraries.LibrariesViewModel | ||
import dev.beefers.vendetta.manager.ui.widgets.libraries.LibraryItem | ||
import org.koin.androidx.compose.get | ||
|
||
class LibrariesScreen: Screen { | ||
|
||
@Composable | ||
@OptIn(ExperimentalMaterial3Api::class) | ||
override fun Content() { | ||
val viewModel: LibrariesViewModel = getScreenModel() | ||
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior() | ||
|
||
Scaffold( | ||
topBar = { TitleBar(scrollBehavior) }, | ||
contentWindowInsets = WindowInsets(0, 0, 0, 0), | ||
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) | ||
) { pv -> | ||
LazyColumn( | ||
modifier = Modifier.padding(pv) | ||
) { | ||
itemsIndexed(viewModel.libraries.libraries) { i, library -> | ||
Column { | ||
LibraryItem( | ||
library = library | ||
) | ||
if(i != viewModel.libraries.libraries.lastIndex) { | ||
ThinDivider() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
@OptIn(ExperimentalMaterial3Api::class) | ||
fun TitleBar( | ||
scrollBehavior: TopAppBarScrollBehavior | ||
) { | ||
val navigator = LocalNavigator.currentOrThrow | ||
|
||
LargeTopAppBar( | ||
title = { | ||
Text(stringResource(R.string.title_libraries)) | ||
}, | ||
navigationIcon = { | ||
IconButton(onClick = { navigator.pop() }) { | ||
Icon( | ||
imageVector = Icons.Filled.ArrowBack, | ||
contentDescription = stringResource(R.string.action_back) | ||
) | ||
} | ||
}, | ||
scrollBehavior = scrollBehavior | ||
) | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/dev/beefers/vendetta/manager/ui/viewmodel/libraries/LibrariesViewModel.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,14 @@ | ||
package dev.beefers.vendetta.manager.ui.viewmodel.libraries | ||
|
||
import android.content.Context | ||
import cafe.adriel.voyager.core.model.ScreenModel | ||
import com.mikepenz.aboutlibraries.Libs | ||
import com.mikepenz.aboutlibraries.util.withContext | ||
|
||
class LibrariesViewModel( | ||
context: Context | ||
): ScreenModel { | ||
|
||
val libraries = Libs.Builder().withContext(context).build() | ||
|
||
} |
Oops, something went wrong.