Social media links

This commit is contained in:
Rafał Kobyłko 2023-07-02 10:01:24 +02:00
parent bfe03177c1
commit 508e219060
7 changed files with 204 additions and 9 deletions

View File

@ -0,0 +1,43 @@
package com.twofasapp.designsystem.modifiers
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
fun Modifier.advancedShadow(
color: Color = Color.Black,
alpha: Float = 1f,
cornersRadius: Dp = 0.dp,
shadowBlurRadius: Dp = 0.dp,
offsetY: Dp = 0.dp,
offsetX: Dp = 0.dp
) = drawBehind {
val shadowColor = color.copy(alpha = alpha).toArgb()
val transparentColor = color.copy(alpha = 0f).toArgb()
drawIntoCanvas {
val paint = Paint()
val frameworkPaint = paint.asFrameworkPaint()
frameworkPaint.color = transparentColor
frameworkPaint.setShadowLayer(
shadowBlurRadius.toPx(),
offsetX.toPx(),
offsetY.toPx(),
shadowColor
)
it.drawRoundRect(
0f,
0f,
this.size.width,
this.size.height,
cornersRadius.toPx(),
cornersRadius.toPx(),
paint
)
}
}

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:pathData="M24,24m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0"
android:fillColor="#ffffff"/>
<path
android:pathData="M24,0C10.745,0 0,10.79 0,24.101C0,36.038 8.653,45.925 19.997,47.839V29.128H14.208V22.395H19.997V17.431C19.997,11.67 23.501,8.531 28.619,8.531C31.071,8.531 33.177,8.714 33.789,8.795V14.816L30.239,14.818C27.456,14.818 26.92,16.146 26.92,18.095V22.392H33.56L32.694,29.125H26.92V48C38.794,46.549 48,36.41 48,24.094C48,10.79 37.255,0 24,0Z"
android:fillColor="#1877F2"/>
</vector>

View File

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M0,0h48v48h-48z"/>
<path
android:pathData="M44.453,0H3.547C1.613,-0.027 0.027,1.533 0,3.467V44.533C0.027,46.467 1.613,48.027 3.547,48H44.453C46.387,48.027 47.973,46.467 48,44.533V3.467C47.973,1.533 46.387,-0.027 44.453,0Z"
android:fillColor="#2867B2"/>
<path
android:pathData="M7.12,18H14.24V40.907H7.12V18ZM10.693,6.667C12.973,6.667 14.827,8.52 14.827,10.8C14.827,13.08 12.973,14.933 10.693,14.933C8.413,14.933 6.56,13.08 6.56,10.8C6.56,8.52 8.413,6.667 10.693,6.667Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M18.72,18H25.547V21.133H25.64C27.027,18.76 29.613,17.333 32.373,17.44C39.587,17.44 40.907,22.187 40.907,28.347V40.907H33.787V29.76C33.787,27.093 33.787,23.68 30.08,23.68C26.373,23.68 25.813,26.573 25.813,29.56V40.893H18.72V18Z"
android:fillColor="#ffffff"/>
</group>
</vector>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:pathData="M24,-0C37.255,-0 48,10.745 48,24C48,37.255 37.255,48 24,48C10.745,48 0,37.255 0,24C0,10.745 10.745,-0 24,-0Z"
android:fillColor="#FF4500"/>
<path
android:pathData="M40,24C40,22.1 38.4,20.5 36.5,20.5C35.6,20.5 34.7,20.9 34.1,21.5C31.3,19.6 28.1,18.6 24.7,18.5L26.3,11L31.5,12.1C31.6,13.5 32.7,14.5 34.1,14.5C35.5,14.4 36.5,13.3 36.5,11.9C36.4,10.5 35.3,9.5 33.9,9.5C33,9.5 32.2,10.1 31.8,10.9L26,9.7C25.7,9.6 25.3,9.8 25.3,10.2L23.5,18.6C20.1,18.6 16.8,19.7 14,21.6C12.6,20.3 10.4,20.3 9.1,21.7C7.8,23.1 7.8,25.3 9.2,26.6C9.5,26.9 9.8,27.1 10.2,27.3C10,27.5 10,27.9 10,28.2C10,33.6 16.3,38 24,38C31.7,38 38,33.6 38,28.2C38,27.8 38,27.5 37.9,27.1C39.2,26.6 40,25.4 40,24ZM16,26.5C16,25.1 17.1,24 18.5,24C19.9,24 21,25.1 21,26.5C21,27.9 19.9,29 18.5,29C17.1,29 16,27.9 16,26.5ZM29.9,33.1C28.2,34.8 24.9,34.9 24,34.9C23.1,34.9 19.8,34.8 18.1,33.1C17.8,32.8 17.8,32.4 18.1,32.2C18.4,31.9 18.8,31.9 19,32.2C20.1,33.3 22.4,33.7 24,33.7C25.6,33.7 27.9,33.3 29,32.2C29.2,31.9 29.7,31.9 29.9,32.2C30.2,32.4 30.2,32.8 29.9,33.1ZM29.5,29C28.1,29 27,27.9 27,26.5C27,25.1 28.1,24 29.5,24C30.9,24 32,25.1 32,26.5C32,27.9 30.9,29 29.5,29Z"
android:fillColor="#ffffff"/>
</vector>

View File

@ -12,8 +12,11 @@ class Links {
val donate = "https://2fas.com/donate"
val support = "https://support.2fas.com"
val browserExt = "https://2fas.com/be"
val youtube = "https://www.youtube.com/@2FAS"
val youtube = "https://www.youtube.com/@2fas"
val twitter = "https://twitter.com/2FAS_com"
val discord = "https://discord.gg/q4cP6qh2g5"
val github = "https://github.com/twofas"
val linkedin = "https://www.linkedin.com/company/2fasapp/"
val reddit = "https://www.reddit.com/r/2fas_com"
val facebook = "https://facebook.com/twofas"
}

View File

@ -93,6 +93,14 @@ class Strings(c: Context) {
val aboutLicenses = c.getString(R.string.about_licenses)
val aboutTellFriend = c.getString(R.string.settings__tell_a_friend)
val aboutTellFriendShareText = c.getString(R.string.settings__recommendation)
val aboutSocialMedia = c.getString(R.string.social__social_media)
val aboutSocialDiscord = c.getString(R.string.social__discord)
val aboutSocialYouTube = c.getString(R.string.social__youtube)
val aboutSocialTwitter = c.getString(R.string.social__twitter)
val aboutSocialGitHub = c.getString(R.string.social__github)
val aboutSocialLinkedIn = c.getString(R.string.social__linkedin)
val aboutSocialReddit = c.getString(R.string.social__reddit)
val aboutSocialFacebook = c.getString(R.string.social__facebook)
val settingsBackup = c.getString(R.string.backup__2fas_backup)
val settingsSecurity = c.getString(R.string.settings__security)

View File

@ -1,10 +1,16 @@
package com.twofasapp.feature.about.ui.about
import android.app.Activity
import androidx.compose.foundation.Image
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.lazy.LazyColumn
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
@ -12,9 +18,9 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.app.ShareCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.twofasapp.locale.R
import com.twofasapp.designsystem.TwIcons
import com.twofasapp.designsystem.TwTheme
import com.twofasapp.designsystem.common.TwTopAppBar
@ -23,6 +29,7 @@ import com.twofasapp.designsystem.settings.SettingsDivider
import com.twofasapp.designsystem.settings.SettingsHeader
import com.twofasapp.designsystem.settings.SettingsLink
import com.twofasapp.designsystem.settings.SettingsSwitch
import com.twofasapp.locale.R
import com.twofasapp.locale.TwLocale
import org.koin.androidx.compose.koinViewModel
@ -58,7 +65,7 @@ private fun AboutScreen(
Scaffold(
topBar = { TwTopAppBar(titleText = TwLocale.strings.aboutTitle) }
) { padding ->
Column(modifier = Modifier.padding(padding)) {
Column(modifier = Modifier.padding(top = padding.calculateTopPadding())) {
LazyColumn(modifier = Modifier.weight(1f)) {
@ -115,13 +122,104 @@ private fun AboutScreen(
onCheckedChange = { onSendCrashLogsToggle() }
)
}
}
SettingsLink(
title = stringResource(id = R.string.settings__version, versionName),
image = painterResource(id = com.twofasapp.designsystem.R.drawable.logo_2fas),
textColor = TwTheme.color.onSurfaceSecondary
)
item { SettingsDivider() }
item { SettingsHeader(title = TwLocale.strings.aboutSocialMedia) }
item {
SettingsLink(
title = TwLocale.strings.aboutSocialDiscord,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_discord),
external = true
) {
uriHandler.openSafely(TwLocale.links.discord, activity)
}
}
item {
SettingsLink(
title = TwLocale.strings.aboutSocialYouTube,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_youtube),
external = true
) {
uriHandler.openSafely(TwLocale.links.youtube, activity)
}
}
item {
SettingsLink(
title = TwLocale.strings.aboutSocialTwitter,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_twitter),
external = true
) {
uriHandler.openSafely(TwLocale.links.twitter, activity)
}
}
item {
SettingsLink(
title = TwLocale.strings.aboutSocialGitHub,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_github),
external = true
) {
uriHandler.openSafely(TwLocale.links.github, activity)
}
}
item {
SettingsLink(
title = TwLocale.strings.aboutSocialLinkedIn,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_linkedin),
external = true
) {
uriHandler.openSafely(TwLocale.links.linkedin, activity)
}
}
item {
SettingsLink(
title = TwLocale.strings.aboutSocialReddit,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_reddit),
external = true
) {
uriHandler.openSafely(TwLocale.links.reddit, activity)
}
}
item {
SettingsLink(
title = TwLocale.strings.aboutSocialFacebook,
image = painterResource(id = com.twofasapp.designsystem.R.drawable.ic_facebook),
external = true
) {
uriHandler.openSafely(TwLocale.links.facebook, activity)
}
}
item { SettingsDivider() }
item {
Row(
Modifier
.fillMaxWidth()
.padding(vertical = 24.dp)
.padding(start = 24.dp, end = 16.dp)
) {
Text(
text = stringResource(id = R.string.settings__version, versionName),
color = TwTheme.color.onSurfaceSecondary,
style = TwTheme.typo.body3
)
Spacer(modifier = Modifier.weight(1f))
Image(
painter = painterResource(id = com.twofasapp.designsystem.R.drawable.logo_2fas),
contentDescription = null,
modifier = Modifier.size(24.dp)
)
}
}
}
}
}
}