Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
fast4x committed Oct 4, 2024
2 parents 9731c8e + 8c35b15 commit 9405ad4
Show file tree
Hide file tree
Showing 9 changed files with 505 additions and 130 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ WARNING, the custom version is not an official release, download only if invited
- [fast4x](https://github.com/fast4x)
- [ikanakova](https://github.com/ikanakova)
- [iscle](https://github.com/iscle)
- [JZITNIK-github](https://github.com/JZITNIK-github)
- [JZITNIK](https://github.com/jzitnik-dev)
- [knighthat](https://github.com/knighthat)
- [locxter](https://github.com/locxter)
- [lrusso96](https://github.com/lrusso96)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package it.fast4x.rimusic.ui.screens.settings

import android.content.Context
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -25,11 +27,12 @@ import it.fast4x.rimusic.utils.getVersionName
import it.fast4x.rimusic.utils.secondary
import me.knighthat.colorPalette
import me.knighthat.typography
import me.knighthat.ui.screens.settings.about.DevBoard


@ExperimentalAnimationApi
@Composable
fun About() {
fun About( context: Context ) {
val uriHandler = LocalUriHandler.current

Column(
Expand Down Expand Up @@ -125,10 +128,18 @@ fun About() {

SettingsGroupSpacer()

SettingsEntryGroupText(title = stringResource(R.string.contributors))
SettingsDescription(text = stringResource(R.string.in_alphabetical_order))
HeaderWithIcon(
title = stringResource(R.string.contributors),
iconId = 0,
enabled = false,
showIcon = true,
modifier = Modifier,
onClick = {}
)
SettingsGroupSpacer()

SettingsTopDescription( text ="Translator:")
SettingsEntryGroupText(title = "Translators")
SettingsDescription(text = stringResource(R.string.in_alphabetical_order))
SettingsTopDescription( text =
"2010furs \n"+
"821938089 \n"+
Expand Down Expand Up @@ -204,26 +215,10 @@ fun About() {
"ZeroZero00 \n"
)

SettingsTopDescription( text ="Developer / Designer:")
SettingsTopDescription( text =
"25huizengek1 \n"+
"821938089 \n"+
"aneesh1122\n"+
"bbyeen \n"+
"Craeckie \n"+
"DanielSevillano \n"+
"Fast4x \n"+
"Ikanakova \n"+
"Iscle \n"+
"JZITNIK-github \n" +
"Locxter \n"+
"lrusso96 \n"+
"martkol \n"+
"Roklc \n"+
"sharunkumar \n" +
"SuhasDissa \n" +
"twistios \n"
)
SettingsEntryGroupText(title = "Developers / Designers")
SettingsDescription(text = stringResource(R.string.in_alphabetical_order))
DevBoard( context )

SettingsGroupSpacer(
modifier = Modifier.height(Dimensions.bottomSpacer)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ fun SettingsScreen(
playerEssential: @Composable () -> Unit = {},
) {
val saveableStateHolder = rememberSaveableStateHolder()
val context = LocalContext.current

val (tabIndex, onTabChanged) = rememberSaveable {
mutableStateOf(0)
Expand Down Expand Up @@ -110,7 +111,7 @@ fun SettingsScreen(
2 -> QuickPicsSettings()
3 -> DataSettings()
4 -> OtherSettings()
5 -> About()
5 -> About( context )

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package me.knighthat.ui.screens.settings.about

import android.content.Context
import androidx.compose.foundation.layout.Box
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.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.google.gson.Gson
import com.google.gson.JsonArray
import it.fast4x.rimusic.R
import me.knighthat.colorPalette
import java.io.InputStream

private val GSON = Gson()
private lateinit var DEVS: List<Developer>

private fun init( context: Context ) {
// Open contributors.json file
val fileStream: InputStream =
context.resources.openRawResource( R.raw.contributors )
// Parse content to JSON array
val json: JsonArray =
GSON.fromJson( fileStream.bufferedReader(), JsonArray::class.java )

// Convert each object of JSON array to Developer instance
// then sort it based on their username
DEVS = json.map { GSON.fromJson( it, Developer::class.java ) }.sortedBy { it.username }
}

@Composable
fun DevBoard( context: Context ) {
if( !::DEVS.isInitialized )
init( context )

Box( Modifier.fillMaxWidth().height( 300.dp ) ) {
// For decoration purposes only
val dividerColor = colorPalette().textSecondary.copy( alpha = .5f )
HorizontalDivider(
modifier = Modifier.padding( start = 35.dp ).width( 50.dp ),
color = dividerColor
)
VerticalDivider(
modifier = Modifier.padding( start = 35.dp ).size( 80.dp ),
color = dividerColor
)
// End of decoration

LazyColumn( Modifier.fillMaxWidth().padding( top = 15.dp ) ) {
items( DEVS ) { it.Draw() }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package me.knighthat.ui.screens.settings.about

import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardColors
import androidx.compose.material3.Icon
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.layout.ContentScale
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
import com.google.gson.annotations.SerializedName
import it.fast4x.rimusic.R
import it.fast4x.rimusic.ui.styling.favoritesIcon
import me.knighthat.colorPalette
import me.knighthat.typography

data class Developer(
val id: Int,
@SerializedName( "login" ) val username: String,
@SerializedName( "name" ) val displayName: String?,
@SerializedName( "html_url" )val url: String,
@SerializedName( "avatar_url") val avatar: String,
val contributions: Int?
) {
private val handle: String
get() = url.split( "/" ).last()

@Composable
fun Draw() {
val uriHandler = LocalUriHandler.current
val avatarPainter = rememberAsyncImagePainter( this.avatar )
val borderColor =
if( id == 1484476 )
Color.hsl( 132f, .34f, .56f )
else
colorPalette().textSecondary

Card(
modifier = Modifier
.padding(start = 50.dp, end = 20.dp, bottom = 10.dp)
.fillMaxWidth()
.border( 1.dp, borderColor, RoundedCornerShape( 12.dp ) ),
colors = CardColors(
containerColor = Color.Transparent,
contentColor = Color.Transparent,
disabledContainerColor = Color.Transparent,
disabledContentColor = Color.Transparent
),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically
) {
// Avatar
Image(
painter = avatarPainter,
contentDescription = null,
modifier = Modifier
.size(50.dp)
.clip( RoundedCornerShape( 25.dp ) )
.border( 1.dp, Color.White, RoundedCornerShape( 25.dp ) ),
contentScale = ContentScale.Fit
)

Spacer(modifier = Modifier.width( 16.dp ) )

// Dev's info, sits to the right of avatar
Column( Modifier.fillMaxWidth() ) {
Text(
text = displayName ?: username,
style = TextStyle(
color = colorPalette().text,
fontSize = typography().xl.fontSize,
fontWeight = FontWeight.Bold
),
textAlign = TextAlign.Start
)

Row( Modifier.fillMaxWidth() ) {
// Handle
Text(
text = "@$handle",
style = TextStyle(
color = colorPalette().textSecondary,
fontSize = typography().s.fontSize,
fontStyle = FontStyle.Italic,
),
modifier = Modifier
.wrapContentSize()
.clickable { uriHandler.openUri(url) },
)

if( contributions == null )
return@Column

val color = colorPalette().favoritesIcon.copy( alpha = .8f )
// contributions aligned to the right of handle
Text(
text = contributions.toString(),
style = TextStyle(
color = color,
fontSize = typography().s.fontSize,
),
textAlign = TextAlign.End,
modifier = Modifier.weight( 1f )
)

Spacer( Modifier.width(5.dp ) )

// Pull request icon
Icon(
painter = painterResource( R.drawable.git_pull_request_outline ),
contentDescription = null,
tint = color,
modifier = Modifier.size( typography().s.fontSize.value.dp )
)
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="512"
android:viewportHeight="512"
android:width="512dp"
android:height="512dp">
<path
android:pathData="M176 416A48 48 0 0 1 80 416A48 48 0 0 1 176 416Z"
android:strokeColor="#000000"
android:strokeWidth="32"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M128 144v224M288 160l-64 -64 64 -64"
android:strokeColor="#000000"
android:strokeWidth="32"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M176 96A48 48 0 0 1 80 96A48 48 0 0 1 176 96Z"
android:strokeColor="#000000"
android:strokeWidth="32"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M432 416A48 48 0 0 1 336 416A48 48 0 0 1 432 416Z"
android:strokeColor="#000000"
android:strokeWidth="32"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M240 96h84a60 60 0 0160 60v212"
android:strokeColor="#000000"
android:strokeWidth="32"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
Loading

0 comments on commit 9405ad4

Please sign in to comment.