mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
feat: Add LandingElement for CustomRecordingNotificationsScreen
This commit is contained in:
parent
1e5806000a
commit
17a52fdcb5
@ -0,0 +1,111 @@
|
||||
package app.myzel394.alibi.ui.components.CustomRecordingNotificationsScreen.atoms
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
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.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowRightAlt
|
||||
import androidx.compose.material.icons.filled.Edit
|
||||
import androidx.compose.material.icons.filled.Notifications
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Icon
|
||||
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.graphics.ColorFilter
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.myzel394.alibi.R
|
||||
import app.myzel394.alibi.ui.utils.openNotificationsSettings
|
||||
|
||||
@Composable
|
||||
fun LandingElement(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 32.dp)
|
||||
.then(modifier),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Box() {}
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ic_custom_recording_notifications_blob),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.tertiaryContainer),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.width(512.dp)
|
||||
)
|
||||
Icon(
|
||||
imageVector = Icons.Default.Notifications,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.tertiary,
|
||||
modifier = Modifier
|
||||
.size(128.dp)
|
||||
)
|
||||
}
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.ui_settings_customNotifications_landing_title),
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
)
|
||||
Text(
|
||||
stringResource(R.string.ui_settings_customNotifications_landing_description),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
Button(
|
||||
onClick = {},
|
||||
colors = ButtonDefaults.filledTonalButtonColors(),
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Edit,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(ButtonDefaults.IconSize)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(ButtonDefaults.IconSpacing))
|
||||
Text(
|
||||
stringResource(
|
||||
R.string.ui_settings_customNotifications_landing_getStarted
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Button(
|
||||
onClick = context::openNotificationsSettings,
|
||||
colors = ButtonDefaults.textButtonColors(),
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.ui_settings_customNotifications_landing_help_hideNotifications),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Snackbar
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.rememberTopAppBarState
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -37,6 +38,7 @@ import app.myzel394.alibi.R
|
||||
import app.myzel394.alibi.dataStore
|
||||
import app.myzel394.alibi.db.AppSettings
|
||||
import app.myzel394.alibi.ui.SUPPORTS_DARK_MODE_NATIVELY
|
||||
import app.myzel394.alibi.ui.components.CustomRecordingNotificationsScreen.atoms.LandingElement
|
||||
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.BitrateTile
|
||||
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.CustomNotificationTile
|
||||
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.EncoderTile
|
||||
@ -70,7 +72,7 @@ fun CustomRecordingNotificationsScreen(
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
LargeTopAppBar(
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(stringResource(R.string.ui_settings_option_customNotification_title))
|
||||
},
|
||||
@ -88,13 +90,11 @@ fun CustomRecordingNotificationsScreen(
|
||||
modifier = Modifier
|
||||
.nestedScroll(scrollBehavior.nestedScrollConnection)
|
||||
) { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(padding)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
if (settings.notificationSettings == null) {
|
||||
LandingElement(
|
||||
modifier = Modifier
|
||||
.padding(padding),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import androidx.core.app.ActivityCompat
|
||||
|
||||
@ -32,3 +33,17 @@ fun Context.openAppSystemSettings() {
|
||||
data = Uri.fromParts("package", packageName, null)
|
||||
})
|
||||
}
|
||||
|
||||
fun Context.openNotificationsSettings() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startActivity(Intent().apply {
|
||||
action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
|
||||
putExtra(Settings.EXTRA_APP_PACKAGE, packageName)
|
||||
})
|
||||
} else {
|
||||
startActivity(Intent().apply {
|
||||
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
|
||||
data = Uri.fromParts("package", packageName, null)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="1000dp"
|
||||
android:height="1000dp"
|
||||
android:viewportWidth="1000"
|
||||
android:viewportHeight="1000">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M889,646q-41,146 -180,199t-237,-37q-98,-90 -253.5,-119.5t-79.5,-161Q215,396 242.5,249t176,-137q148.5,10 235,98T835,399q95,101 54,247Z"/>
|
||||
<path
|
||||
android:pathData="M889,646q-41,146 -180,199t-237,-37q-98,-90 -253.5,-119.5t-79.5,-161Q215,396 242.5,249t176,-137q148.5,10 235,98T835,399q95,101 54,247Z"
|
||||
android:fillColor="#000000"/>
|
||||
</group>
|
||||
</vector>
|
@ -74,4 +74,8 @@
|
||||
<string name="ui_settings_option_customNotification_title">Custom Notifications</string>
|
||||
<string name="ui_settings_option_customNotification_description_setup">Setup custom recording notifications now</string>
|
||||
<string name="ui_settings_option_customNotification_description_edit">Edit recording notifications</string>
|
||||
<string name="ui_settings_customNotifications_landing_title">Don\'t expose yourself</string>
|
||||
<string name="ui_settings_customNotifications_landing_description">Due to Android\'s restrictions, Alibi has to show a notification while recording. To hide the fact that you\'re using Alibi, you can customize the notification.</string>
|
||||
<string name="ui_settings_customNotifications_landing_help_hideNotifications">Alternatively, you can also simply disable notifications</string>
|
||||
<string name="ui_settings_customNotifications_landing_getStarted">Create own notification</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user