-
Notifications
You must be signed in to change notification settings - Fork 25
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
b461e48
commit 4c3afac
Showing
3 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
148 changes: 148 additions & 0 deletions
148
app/src/main/java/com/vishal2376/snaptick/presentation/about_screen/AboutScreen.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,148 @@ | ||
package com.vishal2376.snaptick.presentation.about_screen | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
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.material.icons.Icons | ||
import androidx.compose.material.icons.rounded.ArrowBack | ||
import androidx.compose.material3.Divider | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
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.text.style.TextDecoration | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import androidx.glance.LocalContext | ||
import com.vishal2376.snaptick.R | ||
import com.vishal2376.snaptick.presentation.about_screen.component.FeaturesComponent | ||
import com.vishal2376.snaptick.presentation.common.AppTheme | ||
import com.vishal2376.snaptick.presentation.common.fontRobotoMono | ||
import com.vishal2376.snaptick.presentation.common.h1TextStyle | ||
import com.vishal2376.snaptick.presentation.common.h2TextStyle | ||
import com.vishal2376.snaptick.presentation.common.h3TextStyle | ||
import com.vishal2376.snaptick.presentation.common.taskTextStyle | ||
import com.vishal2376.snaptick.presentation.main.MainState | ||
import com.vishal2376.snaptick.ui.theme.SnaptickTheme | ||
import com.vishal2376.snaptick.ui.theme.Yellow | ||
import com.vishal2376.snaptick.util.Constants | ||
import com.vishal2376.snaptick.util.openUrl | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun AboutScreen( | ||
appState: MainState, | ||
onBack: () -> Unit | ||
) { | ||
val context = LocalContext.current | ||
val repoUrl = "${Constants.GITHUB}/snaptick" | ||
|
||
Scaffold(topBar = { | ||
TopAppBar( | ||
colors = TopAppBarDefaults.topAppBarColors( | ||
containerColor = MaterialTheme.colorScheme.background, | ||
), | ||
title = { | ||
Text( | ||
text = stringResource(R.string.about), | ||
style = h1TextStyle | ||
) | ||
}, | ||
navigationIcon = { | ||
IconButton(onClick = { onBack() }) { | ||
Icon( | ||
imageVector = Icons.Rounded.ArrowBack, | ||
contentDescription = null | ||
) | ||
} | ||
}, | ||
) | ||
}) { innerPadding -> | ||
|
||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(innerPadding), verticalArrangement = Arrangement.spacedBy(16.dp) | ||
) { | ||
Column( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Image( | ||
painter = painterResource(if (appState.theme == AppTheme.Amoled) R.drawable.app_logo_amoled else R.drawable.app_logo), | ||
contentDescription = null, | ||
modifier = Modifier.size(64.dp), | ||
) | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
Text( | ||
text = stringResource(R.string.app_name), | ||
style = h2TextStyle, | ||
color = MaterialTheme.colorScheme.onPrimary | ||
) | ||
Text( | ||
text = stringResource(R.string.buildVersion, appState.buildVersion), | ||
fontFamily = fontRobotoMono, | ||
fontSize = 15.sp, | ||
fontWeight = FontWeight.Bold, | ||
color = MaterialTheme.colorScheme.onPrimary | ||
) | ||
} | ||
Divider(color = MaterialTheme.colorScheme.secondary) | ||
Text( | ||
modifier = Modifier.padding(32.dp, 0.dp), | ||
text = stringResource(R.string.app_description), | ||
color = MaterialTheme.colorScheme.onSecondary, | ||
style = h3TextStyle | ||
) | ||
|
||
Text( | ||
text = "Source Code", | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.clickable { | ||
openUrl(context, repoUrl) | ||
}, | ||
fontStyle = FontStyle.Italic, | ||
style = taskTextStyle, | ||
textDecoration = TextDecoration.Underline, | ||
textAlign = TextAlign.Center | ||
) | ||
|
||
Divider(color = MaterialTheme.colorScheme.secondary) | ||
Text( | ||
modifier = Modifier.padding(32.dp, 0.dp), | ||
text = stringResource(R.string.features), | ||
color = Yellow, | ||
style = h2TextStyle, | ||
) | ||
FeaturesComponent() | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun AboutScreenPreview() { | ||
SnaptickTheme { | ||
AboutScreen(MainState(), {}) | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...main/java/com/vishal2376/snaptick/presentation/about_screen/component/FeatureComponent.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,49 @@ | ||
package com.vishal2376.snaptick.presentation.about_screen.component | ||
|
||
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.padding | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
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.unit.dp | ||
import com.vishal2376.snaptick.presentation.common.h3TextStyle | ||
import com.vishal2376.snaptick.presentation.common.infoTextStyle | ||
|
||
@Composable | ||
fun FeaturesComponent(modifier: Modifier = Modifier) { | ||
Column( | ||
modifier = modifier | ||
.padding(32.dp,0.dp) | ||
.verticalScroll(rememberScrollState()) | ||
, verticalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
FeatureItem(icon = "📝", text = "Create and Edit Tasks") | ||
FeatureItem(icon = "⏲️", text = "Pomodoro Timer") | ||
FeatureItem(icon = "🔄", text = "Sort Tasks") | ||
FeatureItem(icon = "⏰", text = "Analyze Free Time") | ||
FeatureItem(icon = "😴", text = "Set Sleep Time") | ||
FeatureItem(icon = "🗓️", text = "Manage tasks in Calendar View") | ||
FeatureItem(icon = "🔁", text = "Repeatable Tasks with Notification") | ||
FeatureItem(icon = "🎬", text = "Smooth Animations") | ||
FeatureItem(icon = "🎨", text = "Modern UI with Cool Themes") | ||
FeatureItem(icon = "🌐", text = "Available in 15+ Languages") | ||
FeatureItem(icon = "🧩", text = "Create Widgets") | ||
} | ||
} | ||
|
||
@Composable | ||
fun FeatureItem(icon: String, text: String) { | ||
Row(verticalAlignment = Alignment.CenterVertically) { | ||
Text(text = icon, style = infoTextStyle, color = MaterialTheme.colorScheme.onPrimary) | ||
Spacer(modifier = Modifier.width(8.dp)) | ||
Text(text = text, style = h3TextStyle, color = MaterialTheme.colorScheme.onPrimary) | ||
} | ||
} |
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