Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
Add library credits and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Feb 17, 2024
1 parent b429780 commit f76d852
Show file tree
Hide file tree
Showing 13 changed files with 415 additions and 9 deletions.
8 changes: 6 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.exclude
import java.io.ByteArrayOutputStream

plugins {
alias(libs.plugins.aboutlibraries)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
Expand All @@ -14,8 +16,8 @@ android {
applicationId = "dev.beefers.vendetta.manager"
minSdk = 28
targetSdk = 34
versionCode = 1121
versionName = "1.1.21"
versionCode = 1122
versionName = "1.1.22"

buildConfigField("String", "GIT_BRANCH", "\"${getCurrentBranch()}\"")
buildConfigField("String", "GIT_COMMIT", "\"${getLatestCommit()}\"")
Expand Down Expand Up @@ -85,6 +87,7 @@ android {
configurations {
all {
exclude(module = "listenablefuture")
exclude(module = "error_prone_annotations")
}
}
}
Expand All @@ -102,6 +105,7 @@ dependencies {
implementation(libs.bundles.voyager)

implementation(files("libs/lspatch.aar"))
implementation(libs.aboutlibraries.core)
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.collections)
implementation(libs.zip.android) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dev.beefers.vendetta.manager.di
import dev.beefers.vendetta.manager.ui.viewmodel.home.HomeViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.installer.InstallerViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.installer.LogViewerViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.libraries.LibrariesViewModel
import dev.beefers.vendetta.manager.ui.viewmodel.settings.AdvancedSettingsViewModel
import org.koin.core.module.dsl.factoryOf
import org.koin.dsl.module
Expand All @@ -12,4 +13,5 @@ val viewModelModule = module {
factoryOf(::AdvancedSettingsViewModel)
factoryOf(::HomeViewModel)
factoryOf(::LogViewerViewModel)
factoryOf(::LibrariesViewModel)
}
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
)
}
}
}
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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
Expand All @@ -33,6 +29,7 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
Expand All @@ -51,6 +48,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import dev.beefers.vendetta.manager.BuildConfig
import dev.beefers.vendetta.manager.R
import dev.beefers.vendetta.manager.domain.manager.PreferenceManager
import dev.beefers.vendetta.manager.ui.screen.libraries.LibrariesScreen
import dev.beefers.vendetta.manager.ui.widgets.about.LinkItem
import dev.beefers.vendetta.manager.ui.widgets.about.ListItem
import dev.beefers.vendetta.manager.ui.widgets.about.UserEntry
Expand All @@ -73,7 +71,7 @@ class AboutScreen : Screen {
ctx.getBitmap(R.drawable.ic_launcher, 60).asImageBitmap()
}
var tapCount by remember {
mutableStateOf(0)
mutableIntStateOf(0)
}

Scaffold(
Expand Down Expand Up @@ -227,10 +225,21 @@ class AboutScreen : Screen {
modifier = Modifier.padding(16.dp)
) {
ElevatedCard {
val navigator = LocalNavigator.currentOrThrow

ListItem(
text = stringResource(R.string.label_translate),
onClick = { uriHandler.openUri("https://crowdin.com/project/vendetta-manager") }
)
Divider(
thickness = 0.5.dp,
color = MaterialTheme.colorScheme.outline.copy(alpha = 0.3f),
modifier = Modifier.padding(horizontal = 16.dp)
)
ListItem(
text = stringResource(R.string.title_os_libraries),
onClick = { navigator.push(LibrariesScreen()) }
)
}
}
}
Expand Down
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
)
}

}
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()

}
Loading

0 comments on commit f76d852

Please sign in to comment.