Skip to content

Commit

Permalink
list ui tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
kid1412621 committed May 12, 2024
1 parent 252e633 commit 7ad5a5f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.2.2 - 2024-05-12

List UI tweak

## 0.2.0 - 2024-05-02

### Fixes
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ TBD

## Build Release

1. Provide an env var: `export PROD_RELEASE=true`;

2. Add `google-services.json` to app directory:
1. Add `google-services.json` to app directory:

```bash
cat << EOF > app/google-services.json
Expand All @@ -33,7 +31,7 @@ cat << EOF > app/google-services.json
EOF
```

3. Create `keystore.jks` and `keystore.properties` to project root directory:
2. Create `keystore.jks` and `keystore.properties` to project root directory:

keystore.jks:

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId = "me.nanova.subspace"
minSdk = 29
targetSdk = 34
versionCode = 8
versionName = "0.2.1"
versionCode = 9
versionName = "0.2.2"
setProperty("archivesBaseName", "subspace-v${versionName}-${versionCode}")

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
29 changes: 24 additions & 5 deletions app/src/main/kotlin/me/nanova/subspace/ui/component/TorrentList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
Expand All @@ -28,6 +30,10 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import me.nanova.subspace.ui.vm.CallState
import me.nanova.subspace.ui.vm.HomeViewModel
import java.time.Instant
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter

@Composable
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
Expand Down Expand Up @@ -61,12 +67,18 @@ fun TorrentList(
)
},
supportingContent = {
Column {
Column(modifier = Modifier.fillMaxWidth()) {
LinearProgressIndicator(
progress = { it.progress },
modifier = Modifier
.padding(0.dp, 10.dp)
.fillMaxWidth()
)
Text(
it.addedOn.toString(),
maxLines = 1
formatUnixTimestamp(it.addedOn),
maxLines = 1,
modifier = Modifier.align(Alignment.End)
)
LinearProgressIndicator(progress = { it.progress })
}
},
leadingContent = {
Expand All @@ -75,7 +87,7 @@ fun TorrentList(
contentDescription = it.state,
)
},
trailingContent = { Text(it.state) }
// trailingContent = { Text(it.state) }
)

HorizontalDivider()
Expand Down Expand Up @@ -105,3 +117,10 @@ fun TorrentList(

}
}

fun formatUnixTimestamp(unixTimestamp: Long, pattern: String = "yyyy-MM-dd HH:mm:ss"): String {
val instant = Instant.ofEpochSecond(unixTimestamp)
val localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault())
val formatter = DateTimeFormatter.ofPattern(pattern)
return localDateTime.format(formatter)
}

0 comments on commit 7ad5a5f

Please sign in to comment.