Skip to content

Commit

Permalink
Merge pull request #63 from Efimj/enhancement/aboud-screen
Browse files Browse the repository at this point in the history
Enhancement/aboud screen
  • Loading branch information
Efimj committed Jul 1, 2024
2 parents d521ffe + d6978b9 commit 1001352
Show file tree
Hide file tree
Showing 24 changed files with 443 additions and 299 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/com/jobik/shkiper/helpers/IntentHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class IntentHelper {
(context as Activity).finish()
}

@Keep
fun sendMailIntent(
context: Context,
mailList: List<String>,
header: String,
header: String = "",
text: String = ""
) {
val intent = Intent(Intent.ACTION_SEND)
Expand Down
396 changes: 229 additions & 167 deletions app/src/main/java/com/jobik/shkiper/screens/about/AboutNotepadScreen.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.BugReport
import androidx.compose.material.icons.outlined.Done
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Language
import androidx.compose.material.icons.outlined.Loop
import androidx.compose.material.icons.outlined.NewReleases
import androidx.compose.material.icons.outlined.Palette
import androidx.compose.material.icons.outlined.Source
import androidx.compose.material.icons.outlined.Stars
import androidx.compose.material.icons.outlined.ViewCarousel
import androidx.compose.material.icons.rounded.Contrast
Expand Down Expand Up @@ -69,13 +72,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.jobik.shkiper.NotepadApplication
import com.jobik.shkiper.R
import com.jobik.shkiper.navigation.NavigationHelpers.Companion.navigateToSecondary
import com.jobik.shkiper.navigation.Screen
Expand Down Expand Up @@ -118,6 +121,7 @@ fun SettingsScreen(
Spacer(Modifier.height(75.dp))
ProgramSettings(navController = navController, settingsViewModel = settingsViewModel)
BackupSettings(settingsViewModel = settingsViewModel)
DevelopmentSettings()
OtherSettings(navController = navController)
DevSupportSettings(settingsViewModel = settingsViewModel, navController = navController)
InformationSettings()
Expand Down Expand Up @@ -152,6 +156,25 @@ private fun InformationSettings() {
}
}

@Composable
private fun DevelopmentSettings() {
val uriHandler = LocalUriHandler.current
val context = LocalContext.current

SettingsGroup(header = stringResource(R.string.development)) {
SettingsItem(
icon = Icons.Outlined.Source,
title = stringResource(R.string.source_code),
onClick = { uriHandler.openUri(context.getString(R.string.shkiper_github_link)) }
)
SettingsItem(
icon = Icons.Outlined.BugReport,
title = stringResource(R.string.issue_tracker),
onClick = { uriHandler.openUri(context.getString(R.string.github_issue_tracker_link)) }
)
}
}

@Composable
private fun DevSupportSettings(
settingsViewModel: SettingsViewModel,
Expand All @@ -177,7 +200,7 @@ private fun DevSupportSettings(
private fun OtherSettings(navController: NavController) {
SettingsGroup(header = stringResource(R.string.Other)) {
SettingsItem(
icon = Icons.Outlined.Info,
icon = Icons.Outlined.NewReleases,
title = stringResource(R.string.AboutNotepad),
onClick = { navController.navigateToSecondary(Screen.AboutNotepad) }
)
Expand Down Expand Up @@ -338,7 +361,7 @@ private fun ProgramSettings(navController: NavController, settingsViewModel: Set
onClick = { toggleNightMode(context = context, systemNightMode = systemNightMode) }
) {
CustomSwitch(
active = when (SettingsManager.settings.nightMode) {
active = when (settings.nightMode) {
NightMode.Light -> false
NightMode.Dark -> true
else -> isSystemInDarkTheme()
Expand All @@ -359,9 +382,9 @@ private fun ProgramSettings(navController: NavController, settingsViewModel: Set
private fun toggleNightMode(context: Context, systemNightMode: Boolean) {
SettingsManager.update(
context = context,
settings = SettingsManager.settings.copy(
settings = settings.copy(
nightMode =
when (SettingsManager.settings.nightMode) {
when (settings.nightMode) {
NightMode.Light -> NightMode.Dark
NightMode.Dark -> NightMode.Light
else -> if (systemNightMode) NightMode.Light else NightMode.Dark
Expand All @@ -372,7 +395,7 @@ private fun toggleNightMode(context: Context, systemNightMode: Boolean) {

@Composable
private fun SettingsColorThemePicker(settingsViewModel: SettingsViewModel) {
val isDarkMode = when (SettingsManager.settings.nightMode) {
val isDarkMode = when (settings.nightMode) {
NightMode.Light -> false
NightMode.Dark -> true
else -> isSystemInDarkTheme()
Expand Down Expand Up @@ -415,7 +438,7 @@ private fun SettingsColorThemePicker(settingsViewModel: SettingsViewModel) {
) {
SettingsManager.update(
context = context,
settings = SettingsManager.settings.copy(
settings = settings.copy(
theme = colorValuesName[theme]
)
)
Expand Down Expand Up @@ -454,7 +477,6 @@ private fun SettingsItemSelectLanguage() {
Column(
horizontalAlignment = Alignment.Start,
verticalArrangement = Arrangement.spacedBy(2.dp),
modifier = Modifier.padding(vertical = 6.dp)
) {
Text(
text = currentLanguage.getLocalizedValue(context).name,
Expand Down
106 changes: 106 additions & 0 deletions app/src/main/java/com/jobik/shkiper/ui/components/cards/MediaCard.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package com.jobik.shkiper.ui.components.cards

import androidx.annotation.DrawableRes
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.jobik.shkiper.ui.modifiers.bounceClick
import com.jobik.shkiper.ui.theme.AppTheme

@Composable
fun MediaCard(
isHighlight: Boolean = false,
@DrawableRes image: Int,
title: String,
description: String,
onClick: () -> Unit
) {
val backgroundColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.secondaryContainer else AppTheme.colors.container,
tween(500)
)

val iconColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.onSecondaryContainer else AppTheme.colors.onSecondaryContainer,
tween(500)
)

val titleColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.onSecondaryContainer else AppTheme.colors.text,
tween(500)
)

val descriptionColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.textSecondary else AppTheme.colors.textSecondary,
tween(500)
)

val scale by animateFloatAsState(if (isHighlight) 1.05f else 1f, tween(500))

Row(
modifier = Modifier
.graphicsLayer {
scaleX = scale
scaleY = scale
}
.bounceClick()
.clip(AppTheme.shapes.large)
.background(backgroundColor)
.clickable { onClick() }
.padding(vertical = 10.dp, horizontal = 15.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(15.dp)
) {
Image(
modifier = Modifier.size(50.dp),
painter = painterResource(id = image),
contentDescription = null,
contentScale = ContentScale.FillHeight,
colorFilter = ColorFilter.tint(iconColor)
)
Column(verticalArrangement = Arrangement.spacedBy(3.dp)) {
Text(
modifier = Modifier.fillMaxWidth(),
text = title,
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.SemiBold,
color = titleColor,
overflow = TextOverflow.Ellipsis,
)
Text(
modifier = Modifier.fillMaxWidth(),
text = description,
style = MaterialTheme.typography.bodyMedium,
color = descriptionColor,
overflow = TextOverflow.Ellipsis,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import androidx.compose.ui.unit.dp
import com.jobik.shkiper.R
import com.jobik.shkiper.ui.components.cards.FeatureCard
import com.jobik.shkiper.ui.components.cards.Features
import com.jobik.shkiper.ui.components.cards.MediaCard
import com.jobik.shkiper.ui.helpers.splitIntoTriple
import com.jobik.shkiper.ui.helpers.verticalWindowInsetsPadding
import com.jobik.shkiper.ui.modifiers.bounceClick
Expand Down Expand Up @@ -280,80 +281,6 @@ private fun SecondOnboardingScreen() {
}
}

@Composable
private fun MediaCard(
isHighlight: Boolean = false,
@DrawableRes image: Int,
title: String,
description: String,
onClick: () -> Unit
) {
val backgroundColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.secondaryContainer else AppTheme.colors.container,
tween(500)
)

val iconColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.onSecondaryContainer else AppTheme.colors.onSecondaryContainer,
tween(500)
)

val titleColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.onSecondaryContainer else AppTheme.colors.text,
tween(500)
)

val descriptionColor by
animateColorAsState(
targetValue = if (isHighlight) AppTheme.colors.textSecondary else AppTheme.colors.textSecondary,
tween(500)
)

val scale by animateFloatAsState(if (isHighlight) 1.05f else 1f, tween(500))

Row(
modifier = Modifier
.graphicsLayer {
scaleX = scale
scaleY = scale
}
.bounceClick()
.clip(AppTheme.shapes.large)
.background(backgroundColor)
.clickable { onClick() }
.padding(vertical = 10.dp, horizontal = 15.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(15.dp)
) {
Image(
modifier = Modifier.size(50.dp),
painter = painterResource(id = image),
contentDescription = null,
contentScale = ContentScale.FillHeight,
colorFilter = ColorFilter.tint(iconColor)
)
Column(verticalArrangement = Arrangement.spacedBy(3.dp)) {
Text(
modifier = Modifier.fillMaxWidth(),
text = title,
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.SemiBold,
color = titleColor,
overflow = TextOverflow.Ellipsis,
)
Text(
modifier = Modifier.fillMaxWidth(),
text = description,
style = MaterialTheme.typography.bodyMedium,
color = descriptionColor,
overflow = TextOverflow.Ellipsis,
)
}
}
}

@Composable
private fun ThirdOnboardingScreen() {
Expand Down Expand Up @@ -416,7 +343,7 @@ private fun ThirdOnboardingScreen() {

Text(
modifier = Modifier.padding(top = 30.dp, bottom = 10.dp),
text = "Bonus",
text = stringResource(R.string.bonus),
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.Center,
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_bug.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M480,840q-65,0 -120.5,-32T272,720h-72q-17,0 -28.5,-11.5T160,680q0,-17 11.5,-28.5T200,640h44q-3,-20 -3.5,-40t-0.5,-40h-40q-17,0 -28.5,-11.5T160,520q0,-17 11.5,-28.5T200,480h40q0,-20 0.5,-40t3.5,-40h-44q-17,0 -28.5,-11.5T160,360q0,-17 11.5,-28.5T200,320h72q14,-23 31.5,-43t40.5,-35l-37,-38q-11,-11 -11,-27.5t12,-28.5q11,-11 28,-11t28,11l58,58q28,-9 57,-9t57,9l60,-59q11,-11 27.5,-11t28.5,12q11,11 11,28t-11,28l-38,38q23,15 41.5,34.5T688,320h72q17,0 28.5,11.5T800,360q0,17 -11.5,28.5T760,400h-44q3,20 3.5,40t0.5,40h40q17,0 28.5,11.5T800,520q0,17 -11.5,28.5T760,560h-40q0,20 -0.5,40t-3.5,40h44q17,0 28.5,11.5T800,680q0,17 -11.5,28.5T760,720h-72q-32,56 -87.5,88T480,840ZM480,760q66,0 113,-47t47,-113v-160q0,-66 -47,-113t-113,-47q-66,0 -113,47t-47,113v160q0,66 47,113t113,47ZM440,640h80q17,0 28.5,-11.5T560,600q0,-17 -11.5,-28.5T520,560h-80q-17,0 -28.5,11.5T400,600q0,17 11.5,28.5T440,640ZM440,480h80q17,0 28.5,-11.5T560,440q0,-17 -11.5,-28.5T520,400h-80q-17,0 -28.5,11.5T400,440q0,17 11.5,28.5T440,480ZM480,520Z"
android:fillColor="#e8eaed"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_mail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h640q33,0 56.5,23.5T880,240v480q0,33 -23.5,56.5T800,800L160,800ZM800,320L501,507q-5,3 -10.5,4.5T480,513q-5,0 -10.5,-1.5T459,507L160,320v400h640v-400ZM480,440l320,-200L160,240l320,200ZM160,320v10,-59 1,-32 32,-0.5 58.5,-10 400,-400Z"
android:fillColor="#e8eaed"/>
</vector>
6 changes: 3 additions & 3 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@

<string name="ThankForPurchase3">Ihre Unterstützung ist für uns die beste Belohnung. Vielen Dank für Ihren Einkauf in unserer App!</string>

<string name="Efim">Efim</string>
<string name="efim">Efim</string>

<string name="EfimDescription">Android/Web und mehr..</string>
<string name="efim_description">Android/Web und mehr..</string>

<string name="Annually">Jährlich</string>

Expand Down Expand Up @@ -387,7 +387,7 @@

<string name="EmptyTagsTitle">Tags noch nicht erstellt</string>

<string name="OtherMyApps">Andere meine Apps</string>
<string name="other_my_apps">Andere meine Apps</string>


</resources>
Loading

0 comments on commit 1001352

Please sign in to comment.