├── beautyxt_rs_typst ├── .gitignore ├── src │ └── lib.rs ├── uniffi-bindgen.rs ├── uniffi.toml ├── Roboto │ ├── Roboto-Bold.ttf │ ├── Roboto-Italic.ttf │ ├── Roboto-Regular.ttf │ ├── Roboto-BoldItalic.ttf │ └── LICENSE ├── Noto_Serif │ ├── NotoSerif-Bold.ttf │ ├── NotoSerif-Italic.ttf │ ├── NotoSerif-Regular.ttf │ ├── NotoSerif-BoldItalic.ttf │ └── OFL.txt ├── STIX_Two │ ├── STIXTwoText-Bold.ttf │ ├── STIXTwoText-Italic.ttf │ ├── STIXTwoMath-Regular.ttf │ ├── STIXTwoText-Regular.ttf │ ├── STIXTwoText-BoldItalic.ttf │ └── OFL.txt ├── rust-toolchain.toml ├── about.toml ├── LICENSE.txt ├── .cargo │ └── config.toml ├── Cargo.toml ├── useful-commands.txt └── about.hbs ├── beautyxt_rs_plain_text_and_markdown ├── .gitignore ├── uniffi-bindgen.rs ├── src │ ├── lib.rs │ └── plain_text.rs ├── uniffi.toml ├── rust-toolchain.toml ├── about.toml ├── .cargo │ └── config.toml ├── Cargo.toml ├── LICENSE.txt ├── useful-commands.txt └── about.hbs ├── app ├── src │ └── main │ │ ├── res │ │ ├── resources.properties │ │ ├── values │ │ │ ├── ic_launcher_background.xml │ │ │ ├── themes.xml │ │ │ ├── strings.xml │ │ │ └── oldtyxt_strings.xml │ │ ├── values-night │ │ │ └── themes.xml │ │ ├── mipmap-anydpi │ │ │ └── ic_launcher.xml │ │ ├── drawable │ │ │ ├── baseline_file_open_24.xml │ │ │ ├── baseline_print_24.xml │ │ │ ├── baseline_save_as_24.xml │ │ │ ├── baseline_preview_24.xml │ │ │ ├── ic_launcher_monochrome.xml │ │ │ ├── baseline_export_notes_24.xml │ │ │ └── ic_launcher_foreground.xml │ │ └── xml │ │ │ ├── backup_rules.xml │ │ │ └── data_extraction_rules.xml │ │ ├── ic_launcher-accrescent.png │ │ ├── aidl │ │ └── oldtyxt │ │ │ └── dev │ │ │ └── soupslurpr │ │ │ └── beautyxt │ │ │ ├── PathAndPfd.aidl │ │ │ ├── IFileViewModelRustLibraryAidlInterface.aidl │ │ │ └── ITypstProjectViewModelRustLibraryAidlInterface.aidl │ │ ├── kotlin │ │ ├── newtyxt │ │ │ └── dev │ │ │ │ └── soupslurpr │ │ │ │ └── beautyxt │ │ │ │ ├── ui │ │ │ │ ├── HomeScreen.kt │ │ │ │ ├── theme │ │ │ │ │ ├── Theme.kt │ │ │ │ │ └── DefaultTheme.kt │ │ │ │ ├── common │ │ │ │ │ └── ScreenLazyColumn.kt │ │ │ │ └── EditorScreen.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── data │ │ │ │ ├── DocumentUriContentRepository.kt │ │ │ │ └── DocumentUriContentDataSource.kt │ │ │ │ ├── Application.kt │ │ │ │ └── BeautyxtApp.kt │ │ ├── oldtyxt │ │ │ └── dev │ │ │ │ └── soupslurpr │ │ │ │ └── beautyxt │ │ │ │ ├── PathAndPfd.kt │ │ │ │ ├── Utils.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── ui │ │ │ │ ├── theme │ │ │ │ │ ├── Color.kt │ │ │ │ │ ├── Type.kt │ │ │ │ │ └── Theme.kt │ │ │ │ ├── TypstRustLibraryCreditsScreen.kt │ │ │ │ ├── PlainTextAndMarkdownRustLibraryCreditsScreen.kt │ │ │ │ ├── LicenseScreen.kt │ │ │ │ ├── PrivacyPolicyScreen.kt │ │ │ │ ├── FileViewModelRustLibraryIsolatedService.kt │ │ │ │ ├── DonationScreen.kt │ │ │ │ ├── ReviewPrivacyPolicyAndLicense.kt │ │ │ │ ├── TypstProjectViewModelRustLibraryIsolatedService.kt │ │ │ │ ├── TypstProjectScreen.kt │ │ │ │ └── StartupScreen.kt │ │ │ │ ├── constants │ │ │ │ └── MimeTypes.kt │ │ │ │ ├── data │ │ │ │ ├── FileUiState.kt │ │ │ │ └── TypstProjectUiState.kt │ │ │ │ └── settings │ │ │ │ ├── PreferencesUiState.kt │ │ │ │ └── PreferencesViewModel.kt │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml ├── .gitignore ├── lint.xml ├── proguard-rules.pro └── build.gradle.kts ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── .idea ├── .gitignore ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── compiler.xml ├── vcs.xml ├── AndroidProjectSystem.xml ├── migrations.xml ├── kotlinc.xml ├── misc.xml ├── gradle.xml ├── runConfigurations.xml ├── inspectionProfiles │ └── Project_Default.xml └── uiDesigner.xml ├── .gitattributes ├── settings.gradle.kts ├── .gitignore ├── README.md ├── LICENSE.txt ├── CONTRIBUTING.md ├── gradle.properties ├── gradlew.bat ├── gradlew └── LICENSE.material-symbols.txt /beautyxt_rs_typst/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /upx.exe 3 | -------------------------------------------------------------------------------- /beautyxt_rs_plain_text_and_markdown/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /app/src/main/res/resources.properties: -------------------------------------------------------------------------------- 1 | unqualifiedResLocale=en-US -------------------------------------------------------------------------------- /beautyxt_rs_typst/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod typst; 2 | 3 | uniffi::setup_scaffolding!(); 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release/ 3 | /src/main/kotlin/oldnewtyxt/dev/soupslurpr/beautyxt/ -------------------------------------------------------------------------------- /beautyxt_rs_typst/uniffi-bindgen.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | uniffi::uniffi_bindgen_main() 3 | } 4 | -------------------------------------------------------------------------------- /beautyxt_rs_plain_text_and_markdown/uniffi-bindgen.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | uniffi::uniffi_bindgen_main() 3 | } 4 | -------------------------------------------------------------------------------- /beautyxt_rs_plain_text_and_markdown/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod markdown; 2 | mod plain_text; 3 | 4 | uniffi::setup_scaffolding!(); 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /beautyxt_rs_typst/uniffi.toml: -------------------------------------------------------------------------------- 1 | [bindings.kotlin] 2 | package_name = "oldtyxt.uniffi.beautyxt_rs_typst_bindings" 3 | android = true -------------------------------------------------------------------------------- /app/src/main/ic_launcher-accrescent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/app/src/main/ic_launcher-accrescent.png -------------------------------------------------------------------------------- /beautyxt_rs_typst/Roboto/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Roboto/Roboto-Bold.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Roboto/Roboto-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Roboto/Roboto-Italic.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Roboto/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Roboto/Roboto-Regular.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Roboto/Roboto-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Roboto/Roboto-BoldItalic.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Noto_Serif/NotoSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Noto_Serif/NotoSerif-Bold.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Noto_Serif/NotoSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Noto_Serif/NotoSerif-Italic.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/STIX_Two/STIXTwoText-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/STIX_Two/STIXTwoText-Bold.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/STIX_Two/STIXTwoText-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/STIX_Two/STIXTwoText-Italic.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Noto_Serif/NotoSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Noto_Serif/NotoSerif-Regular.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/STIX_Two/STIXTwoMath-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/STIX_Two/STIXTwoMath-Regular.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/STIX_Two/STIXTwoText-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/STIX_Two/STIXTwoText-Regular.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/Noto_Serif/NotoSerif-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/Noto_Serif/NotoSerif-BoldItalic.ttf -------------------------------------------------------------------------------- /beautyxt_rs_typst/STIX_Two/STIXTwoText-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soupslurpr/BeauTyXT/HEAD/beautyxt_rs_typst/STIX_Two/STIXTwoText-BoldItalic.ttf -------------------------------------------------------------------------------- /beautyxt_rs_plain_text_and_markdown/uniffi.toml: -------------------------------------------------------------------------------- 1 | [bindings.kotlin] 2 | package_name = "oldtyxt.uniffi.beautyxt_rs_plain_text_and_markdown_bindings" 3 | android = true -------------------------------------------------------------------------------- /beautyxt_rs_typst/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "stable" 3 | targets = ["aarch64-linux-android", "x86_64-linux-android"] 4 | profile = "default" 5 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Annoying and useless 5 | /deploymentTargetDropDown.xml 6 | /deploymentTargetSelector.xml 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #668eff 4 | -------------------------------------------------------------------------------- /beautyxt_rs_plain_text_and_markdown/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "stable" 3 | targets = ["aarch64-linux-android", "x86_64-linux-android"] 4 | profile = "default" 5 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | 37 | 38 | 39 |
40 |
41 |

Third Party Licenses

42 |

This page lists the licenses of the projects used in beautyxt_rs_typst.

43 |
44 | 45 |

Overview of licenses:

46 | 51 | 52 |

All license text:

53 | 67 |
68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /beautyxt_rs_plain_text_and_markdown/about.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 36 | 37 | 38 | 39 |
40 |
41 |

Third Party Licenses

42 |

This page lists the licenses of the projects used in beautyxt_rs_plain_text_and_markdown.

43 |
44 | 45 |

Overview of licenses:

46 | 51 | 52 |

All license text:

53 | 67 |
68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/ui/DonationScreen.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.ui 2 | 3 | import androidx.compose.foundation.Image 4 | import androidx.compose.foundation.layout.Arrangement 5 | import androidx.compose.foundation.layout.Column 6 | import androidx.compose.foundation.layout.Spacer 7 | import androidx.compose.foundation.layout.WindowInsets 8 | import androidx.compose.foundation.layout.asPaddingValues 9 | import androidx.compose.foundation.layout.fillMaxSize 10 | import androidx.compose.foundation.layout.navigationBars 11 | import androidx.compose.foundation.layout.padding 12 | import androidx.compose.foundation.rememberScrollState 13 | import androidx.compose.foundation.text.selection.SelectionContainer 14 | import androidx.compose.foundation.verticalScroll 15 | import androidx.compose.material3.Text 16 | import androidx.compose.runtime.Composable 17 | import androidx.compose.ui.Alignment 18 | import androidx.compose.ui.Modifier 19 | import androidx.compose.ui.res.painterResource 20 | import androidx.compose.ui.unit.dp 21 | import dev.soupslurpr.beautyxt.R 22 | 23 | @Composable 24 | fun DonationScreen() { 25 | val columnVerticalScroll = rememberScrollState() 26 | 27 | Column( 28 | modifier = Modifier 29 | .fillMaxSize() 30 | .padding(horizontal = 16.dp) 31 | .verticalScroll(columnVerticalScroll), 32 | verticalArrangement = Arrangement.Center, 33 | horizontalAlignment = Alignment.CenterHorizontally, 34 | ) { 35 | Text( 36 | "Like BeauTyXT? You can donate to soupslurpr, the lead developer of BeauTyXT to support their work" + 37 | " on BeauTyXT and their other open source projects. Thank you!" 38 | ) 39 | Text("") 40 | Text("Monero address:") 41 | SelectionContainer { 42 | Text("88rAaNowhaC8JG8NJDpcdRWr1gGVmtFPnHWPS9xXvqY44G4XKVi5hZMax2FQ6B8KAcMpzkeJAhNek8qMHZjjwvkEKuiyBKF") 43 | } 44 | Text("") 45 | Image( 46 | painterResource(R.drawable.donation_monero_address_qrcode), 47 | contentDescription = "QR Code for Monero address" 48 | ) 49 | 50 | Spacer(Modifier.padding(WindowInsets.navigationBars.asPaddingValues())) 51 | } 52 | } -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 37 | 38 | 39 | 41 | 42 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/kotlin/newtyxt/dev/soupslurpr/beautyxt/ui/common/ScreenLazyColumn.kt: -------------------------------------------------------------------------------- 1 | package dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.common 2 | 3 | import androidx.compose.foundation.gestures.FlingBehavior 4 | import androidx.compose.foundation.gestures.ScrollableDefaults 5 | import androidx.compose.foundation.layout.Arrangement 6 | import androidx.compose.foundation.layout.PaddingValues 7 | import androidx.compose.foundation.layout.calculateEndPadding 8 | import androidx.compose.foundation.layout.calculateStartPadding 9 | import androidx.compose.foundation.lazy.LazyColumn 10 | import androidx.compose.foundation.lazy.LazyListScope 11 | import androidx.compose.foundation.lazy.LazyListState 12 | import androidx.compose.foundation.lazy.rememberLazyListState 13 | import androidx.compose.runtime.Composable 14 | import androidx.compose.ui.Alignment 15 | import androidx.compose.ui.Modifier 16 | import androidx.compose.ui.platform.LocalLayoutDirection 17 | import androidx.compose.ui.unit.LayoutDirection 18 | import androidx.compose.ui.unit.dp 19 | 20 | @Composable 21 | fun ScreenLazyColumn( 22 | modifier: Modifier = Modifier, 23 | state: LazyListState = rememberLazyListState(), 24 | contentPadding: PaddingValues = PaddingValues(bottom = 16.dp, start = 16.dp, end = 16.dp), 25 | additionalContentPadding: PaddingValues = PaddingValues(all = 0.dp), 26 | reverseLayout: Boolean = false, 27 | verticalArrangement: Arrangement.Vertical = Arrangement.spacedBy(16.dp), 28 | horizontalAlignment: Alignment.Horizontal = Alignment.Start, 29 | flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), 30 | userScrollEnabled: Boolean = true, 31 | layoutDirection: LayoutDirection = LocalLayoutDirection.current, 32 | content: LazyListScope.() -> Unit 33 | ) { 34 | LazyColumn( 35 | modifier = modifier, 36 | state = state, 37 | contentPadding = PaddingValues( 38 | start = contentPadding.calculateStartPadding(layoutDirection) 39 | + additionalContentPadding.calculateStartPadding(layoutDirection), 40 | top = contentPadding.calculateTopPadding() 41 | + additionalContentPadding.calculateTopPadding(), 42 | end = contentPadding.calculateEndPadding(layoutDirection) 43 | + additionalContentPadding.calculateEndPadding(layoutDirection), 44 | bottom = contentPadding.calculateBottomPadding() 45 | + additionalContentPadding.calculateBottomPadding() 46 | ), 47 | reverseLayout = reverseLayout, 48 | verticalArrangement = verticalArrangement, 49 | horizontalAlignment = horizontalAlignment, 50 | flingBehavior = flingBehavior, 51 | userScrollEnabled = userScrollEnabled, 52 | content = content, 53 | ) 54 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/newtyxt/dev/soupslurpr/beautyxt/data/DocumentUriContentDataSource.kt: -------------------------------------------------------------------------------- 1 | package dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.data 2 | 3 | import android.content.ContentResolver 4 | import android.database.ContentObserver 5 | import android.net.Uri 6 | import android.os.CancellationSignal 7 | import android.os.Handler 8 | import android.os.Looper 9 | import android.os.ParcelFileDescriptor 10 | import kotlinx.coroutines.channels.awaitClose 11 | import kotlinx.coroutines.channels.trySendBlocking 12 | import kotlinx.coroutines.flow.Flow 13 | import kotlinx.coroutines.flow.callbackFlow 14 | import javax.inject.Inject 15 | 16 | class DocumentUriContentDataSource @Inject constructor( 17 | private val contentResolver: ContentResolver 18 | ) { 19 | // REMINDER that unfortunately, we might not be notified of changes if apps don't call 20 | // contentResolver.notifyChange() when they finish writing 21 | fun documentUriContentFlow(originalUri: Uri): Flow = callbackFlow { 22 | val observer = object : ContentObserver(Handler(Looper.getMainLooper())) { 23 | override fun deliverSelfNotifications(): Boolean { 24 | return false 25 | } 26 | 27 | override fun onChange(selfChange: Boolean) { 28 | this.onChange(selfChange, null) 29 | } 30 | 31 | override fun onChange(selfChange: Boolean, uri: Uri?) { 32 | val chosenUri = uri ?: originalUri 33 | val cancellationSignal = CancellationSignal() 34 | val stringBuilder = StringBuilder() 35 | 36 | try { 37 | ParcelFileDescriptor.AutoCloseInputStream( 38 | this@DocumentUriContentDataSource.contentResolver.openFileDescriptor( 39 | chosenUri, "r", cancellationSignal 40 | ) 41 | ).use { inputStream -> 42 | inputStream.bufferedReader(charset = Charsets.UTF_8).use { reader -> 43 | var line: String? = reader.readLine() 44 | while (line != null) { 45 | stringBuilder.appendLine(line) 46 | line = reader.readLine() 47 | } 48 | } 49 | } 50 | trySendBlocking(stringBuilder.toString()) 51 | } catch (e: Exception) { 52 | throw e 53 | // close(e) 54 | } 55 | } 56 | } 57 | 58 | this@DocumentUriContentDataSource.contentResolver.registerContentObserver( 59 | originalUri, false, observer 60 | ) 61 | 62 | // TODO: maybe don't do this 63 | observer.onChange(true) 64 | 65 | awaitClose { 66 | this@DocumentUriContentDataSource.contentResolver.unregisterContentObserver(observer) 67 | } 68 | } 69 | 70 | // TODO: check Document.COLUMN_FLAGS to see if we can write to the document 71 | // TODO: also call contentResolver.notifyChange() when finished writing 72 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.ui.theme 2 | 3 | import android.os.Build 4 | import androidx.compose.foundation.isSystemInDarkTheme 5 | import androidx.compose.material3.MaterialTheme 6 | import androidx.compose.material3.darkColorScheme 7 | import androidx.compose.material3.dynamicDarkColorScheme 8 | import androidx.compose.material3.dynamicLightColorScheme 9 | import androidx.compose.material3.lightColorScheme 10 | import androidx.compose.runtime.Composable 11 | import androidx.compose.runtime.collectAsState 12 | import androidx.compose.runtime.getValue 13 | import androidx.compose.ui.graphics.Color 14 | import androidx.compose.ui.platform.LocalContext 15 | import oldtyxt.dev.soupslurpr.beautyxt.settings.PreferencesViewModel 16 | 17 | /** 18 | * Dark color scheme for devices < Android 12, which do not support dynamic color. 19 | */ 20 | private val DarkColorScheme = darkColorScheme( 21 | primary = Purple80, 22 | secondary = PurpleGrey80, 23 | tertiary = Pink80, 24 | ) 25 | 26 | /** 27 | * Light color scheme for devices < Android 12, which do not support dynamic color. 28 | */ 29 | private val LightColorScheme = lightColorScheme( 30 | primary = Purple40, 31 | secondary = PurpleGrey40, 32 | tertiary = Pink40, 33 | 34 | /* Other default colors to override 35 | background = Color(0xFFFFFBFE), 36 | surface = Color(0xFFFFFBFE), 37 | onPrimary = Color.White, 38 | onSecondary = Color.White, 39 | onTertiary = Color.White, 40 | onBackground = Color(0xFF1C1B1F), 41 | onSurface = Color(0xFF1C1B1F), 42 | */ 43 | ) 44 | 45 | @Composable 46 | fun BeauTyXTTheme( 47 | darkTheme: Boolean = isSystemInDarkTheme(), 48 | // Dynamic color is available on Android 12+ 49 | dynamicColor: Boolean = true, 50 | preferencesViewModel: PreferencesViewModel, 51 | content: @Composable () -> Unit 52 | ) { 53 | val settingsUiState by preferencesViewModel.uiState.collectAsState() 54 | 55 | val pitchBlackBackground = settingsUiState.pitchBlackBackground.second.value and darkTheme 56 | 57 | val colorScheme = when { 58 | dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { 59 | val context = LocalContext.current 60 | if (darkTheme) { 61 | if (pitchBlackBackground) { 62 | dynamicDarkColorScheme(context).copy( 63 | background = Color.Black, 64 | surface = Color.Black, 65 | ) 66 | } else { 67 | dynamicDarkColorScheme(context) 68 | } 69 | } else { 70 | dynamicLightColorScheme(context) 71 | } 72 | } 73 | 74 | darkTheme -> { 75 | if (pitchBlackBackground) { 76 | DarkColorScheme.copy( 77 | background = Color.Black, 78 | surface = Color.Black 79 | ) 80 | } else { 81 | DarkColorScheme 82 | } 83 | } 84 | 85 | else -> LightColorScheme 86 | } 87 | 88 | MaterialTheme( 89 | colorScheme = colorScheme, 90 | typography = Typography, 91 | content = content 92 | ) 93 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | activityCompose = "1.10.1" 3 | androidGradlePlugin = "8.13.0" 4 | coil = "3.3.0" 5 | coilCompose = "3.3.0" 6 | coilSvg = "3.3.0" 7 | composeBom = "2025.08.01" 8 | coreKtx = "1.17.0" 9 | datastorePreferences = "1.1.7" 10 | documentfile = "1.1.0" 11 | hilt = "2.57.1" 12 | hiltNavigationCompose = "1.2.0" 13 | jna = "5.17.0" 14 | kotlin = "2.2.20" 15 | kotlinxSerializationJson = "1.9.0" 16 | ksp = "2.2.10-2.0.2" 17 | lifecycleRuntimeKtx = "2.9.3" 18 | navigationCompose = "2.9.3" 19 | pagingCompose = "3.3.6" 20 | 21 | [libraries] 22 | androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" } 23 | androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" } 24 | androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } 25 | androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" } 26 | androidx-documentfile = { module = "androidx.documentfile:documentfile", version.ref = "documentfile" } 27 | androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigationCompose" } 28 | androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } 29 | androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" } 30 | androidx-material3 = { module = "androidx.compose.material3:material3" } 31 | androidx-material3-adaptive-navigation-suite = { module = "androidx.compose.material3:material3-adaptive-navigation-suite" } 32 | androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" } 33 | androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "pagingCompose" } 34 | androidx-ui = { module = "androidx.compose.ui:ui" } 35 | androidx-ui-graphics = { module = "androidx.compose.ui:ui-graphics" } 36 | androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } 37 | androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } 38 | coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } 39 | coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" } 40 | coil-svg = { module = "io.coil-kt.coil3:coil-svg", version.ref = "coilSvg" } 41 | hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } 42 | hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" } 43 | jna = { module = "net.java.dev.jna:jna", version.ref = "jna" } 44 | kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } 45 | 46 | [plugins] 47 | android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } 48 | kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } 49 | kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } 50 | kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } 51 | kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } 52 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } 53 | hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt"} -------------------------------------------------------------------------------- /app/src/main/kotlin/newtyxt/dev/soupslurpr/beautyxt/ui/EditorScreen.kt: -------------------------------------------------------------------------------- 1 | package dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui 2 | 3 | import android.net.Uri 4 | import androidx.compose.material3.CircularProgressIndicator 5 | import androidx.compose.material3.Text 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.runtime.LaunchedEffect 8 | import androidx.compose.runtime.getValue 9 | import androidx.lifecycle.ViewModel 10 | import androidx.lifecycle.compose.collectAsStateWithLifecycle 11 | import androidx.lifecycle.viewModelScope 12 | import androidx.lifecycle.viewmodel.compose.viewModel 13 | import dagger.hilt.android.lifecycle.HiltViewModel 14 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.data.DocumentUriContentRepository 15 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.common.ScreenLazyColumn 16 | import kotlinx.coroutines.flow.MutableStateFlow 17 | import kotlinx.coroutines.flow.StateFlow 18 | import kotlinx.coroutines.flow.asStateFlow 19 | import kotlinx.coroutines.flow.update 20 | import kotlinx.coroutines.launch 21 | import javax.inject.Inject 22 | 23 | data class EditorScreenUiState( 24 | val fileName: String? = null, val text: String? = null, val uri: Uri? = null 25 | ) 26 | 27 | @HiltViewModel 28 | class EditorViewModel @Inject constructor( 29 | private val documentUriContentRepository: DocumentUriContentRepository, 30 | ) : ViewModel() { 31 | 32 | private val _uiState = MutableStateFlow(EditorScreenUiState()) 33 | val uiState: StateFlow = _uiState.asStateFlow() 34 | 35 | fun setUri(uri: Uri) { 36 | _uiState.update { currentState -> 37 | currentState.copy( 38 | uri = uri 39 | ) 40 | } 41 | 42 | viewModelScope.launch { 43 | documentUriContentRepository.documentUriContentFlow( 44 | uri = uri 45 | ).collect { documentUriContent -> 46 | _uiState.update { currentState -> 47 | currentState.copy( 48 | text = documentUriContent 49 | ) 50 | } 51 | } 52 | } 53 | } 54 | } 55 | 56 | /** 57 | * The modular UI for editing text files. 58 | */ 59 | @Composable 60 | fun EditorScreen( 61 | uri: Uri, 62 | viewModel: EditorViewModel = viewModel() 63 | ) { 64 | val uiState by viewModel.uiState.collectAsStateWithLifecycle() 65 | 66 | // TODO: let's not do this. instead here's the idea: 67 | // make repositories and data sources activity scoped, then in the activity start set a 68 | // repository for intent information or something to the intent's information and then have 69 | // that same repository as a parameter for the EditorViewModel and have hilt inject it ofc 70 | // . 71 | // i think a repository scoped to activity retained is the correct solution honestly. 72 | // try it. 73 | LaunchedEffect(true) { 74 | if (uiState.uri == null) { 75 | viewModel.setUri(uri) 76 | } 77 | } 78 | 79 | ScreenLazyColumn { 80 | item { 81 | Text(text = "HELLO!?") 82 | } 83 | item { 84 | if (uiState.text == null) { 85 | CircularProgressIndicator() 86 | } else { 87 | Text( 88 | text = uiState.text!! 89 | ) 90 | } 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 18 | 23 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 70 | 71 | -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/ui/ReviewPrivacyPolicyAndLicense.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.ui 2 | 3 | import androidx.compose.foundation.layout.Column 4 | import androidx.compose.foundation.layout.Spacer 5 | import androidx.compose.foundation.layout.WindowInsets 6 | import androidx.compose.foundation.layout.asPaddingValues 7 | import androidx.compose.foundation.layout.navigationBars 8 | import androidx.compose.foundation.layout.padding 9 | import androidx.compose.foundation.rememberScrollState 10 | import androidx.compose.foundation.verticalScroll 11 | import androidx.compose.material3.Button 12 | import androidx.compose.material3.Checkbox 13 | import androidx.compose.material3.ExperimentalMaterial3Api 14 | import androidx.compose.material3.LargeTopAppBar 15 | import androidx.compose.material3.Scaffold 16 | import androidx.compose.material3.Text 17 | import androidx.compose.runtime.Composable 18 | import androidx.compose.runtime.collectAsState 19 | import androidx.compose.runtime.getValue 20 | import androidx.compose.runtime.mutableStateOf 21 | import androidx.compose.runtime.remember 22 | import androidx.compose.runtime.rememberCoroutineScope 23 | import androidx.compose.runtime.setValue 24 | import androidx.compose.ui.Modifier 25 | import androidx.compose.ui.res.stringResource 26 | import androidx.compose.ui.text.font.FontWeight 27 | import androidx.compose.ui.unit.dp 28 | import dev.soupslurpr.beautyxt.R 29 | import kotlinx.coroutines.launch 30 | import oldtyxt.dev.soupslurpr.beautyxt.settings.PreferencesViewModel 31 | 32 | @OptIn(ExperimentalMaterial3Api::class) 33 | @Composable 34 | fun ReviewPrivacyPolicyAndLicense( 35 | preferencesViewModel: PreferencesViewModel, 36 | ) { 37 | val preferencesUiState by preferencesViewModel.uiState.collectAsState() 38 | val coroutineScope = rememberCoroutineScope() 39 | var checked by remember { mutableStateOf(false) } 40 | 41 | Scaffold( 42 | topBar = { 43 | LargeTopAppBar( 44 | title = { 45 | Text(text = stringResource(R.string.oldtyxt_review_privacy_policy_and_license)) 46 | } 47 | ) 48 | } 49 | ) { innerPadding -> 50 | Column( 51 | modifier = Modifier 52 | .verticalScroll(rememberScrollState()) 53 | .padding(16.dp) 54 | .padding(innerPadding) 55 | ) { 56 | Text( 57 | text = stringResource(R.string.oldtyxt_full_privacy_policy) + "\n\n\n\n" + stringResource( 58 | R.string.oldtyxt_full_license 59 | ) + "\n\n\n\n" 60 | ) 61 | Text( 62 | text = stringResource(R.string.oldtyxt_privacy_policy_and_license_checkbox_text), 63 | fontWeight = FontWeight.Bold 64 | ) 65 | Checkbox( 66 | checked = checked, 67 | onCheckedChange = { 68 | checked = it 69 | } 70 | ) 71 | Button( 72 | onClick = { 73 | coroutineScope.launch { 74 | preferencesViewModel.setPreference( 75 | preferencesUiState.acceptedPrivacyPolicyAndLicense.first, 76 | checked 77 | ) 78 | } 79 | }, 80 | enabled = checked 81 | ) { 82 | Text(text = stringResource(R.string.oldtyxt_continue_to_app)) 83 | } 84 | 85 | Spacer(Modifier.padding(WindowInsets.navigationBars.asPaddingValues())) 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) 3 | alias(libs.plugins.kotlin.android) 4 | alias(libs.plugins.kotlin.compose.compiler) 5 | alias(libs.plugins.kotlin.serialization) 6 | alias(libs.plugins.kotlin.parcelize) 7 | alias(libs.plugins.ksp) 8 | alias(libs.plugins.hilt) 9 | } 10 | 11 | android { 12 | namespace = "dev.soupslurpr.beautyxt" 13 | compileSdk = 36 14 | buildToolsVersion = "36.0.0" 15 | ndkVersion = "28.2.13676358" 16 | 17 | defaultConfig { 18 | applicationId = "dev.soupslurpr.beautyxt" 19 | minSdk = 29 20 | targetSdk = 36 21 | versionCode = 57 22 | versionName = versionCode.toString() 23 | 24 | vectorDrawables { 25 | useSupportLibrary = true 26 | } 27 | 28 | ndk { 29 | abiFilters.clear() 30 | abiFilters.addAll(listOf("arm64-v8a", "x86_64")) 31 | } 32 | } 33 | 34 | compileOptions { 35 | sourceCompatibility = JavaVersion.VERSION_21 36 | targetCompatibility = JavaVersion.VERSION_21 37 | } 38 | kotlinOptions { 39 | jvmTarget = "21" 40 | } 41 | buildFeatures { 42 | compose = true 43 | aidl = true 44 | buildConfig = true 45 | } 46 | bundle { 47 | language { 48 | /** Disable splits for language for now since Accrescent does not support automatically 49 | * fetching language splits when language is changed and instead needs a reinstall of the app. 50 | * Remove once Accrescent gets support. 51 | */ 52 | enableSplit = false 53 | } 54 | } 55 | androidResources { 56 | generateLocaleConfig = true 57 | } 58 | buildTypes { 59 | release { 60 | isMinifyEnabled = true 61 | isShrinkResources = true 62 | proguardFiles( 63 | getDefaultProguardFile("proguard-android-optimize.txt"), 64 | "proguard-rules.pro" 65 | ) 66 | } 67 | debug { 68 | applicationIdSuffix = ".debug" 69 | versionNameSuffix = "-debug" 70 | signingConfig = signingConfigs.getByName("debug") 71 | } 72 | create("staging") { 73 | initWith(getByName("release")) 74 | applicationIdSuffix = ".debug" 75 | versionNameSuffix = "-debug" 76 | signingConfig = signingConfigs.getByName("debug") 77 | } 78 | } 79 | } 80 | 81 | dependencies { 82 | implementation(libs.androidx.core.ktx) 83 | implementation(libs.androidx.lifecycle.runtime.ktx) 84 | implementation(libs.androidx.activity.compose) 85 | implementation(libs.androidx.navigation.compose) 86 | implementation(libs.androidx.datastore.preferences) 87 | implementation(libs.androidx.documentfile) 88 | implementation(libs.kotlinx.serialization.json) 89 | 90 | ksp(libs.hilt.android.compiler) 91 | implementation(libs.hilt.android) 92 | implementation(libs.androidx.hilt.navigation.compose) 93 | implementation(libs.androidx.paging.compose) 94 | 95 | implementation(platform(libs.androidx.compose.bom)) 96 | implementation(libs.androidx.ui) 97 | implementation(libs.androidx.ui.graphics) 98 | implementation(libs.androidx.ui.tooling.preview) 99 | implementation(libs.androidx.material3) 100 | implementation(libs.androidx.material3.adaptive.navigation.suite) 101 | implementation(libs.androidx.material.icons.extended) 102 | debugImplementation(libs.androidx.ui.tooling) 103 | 104 | implementation("${libs.jna.get()}@aar") 105 | implementation(libs.coil) 106 | implementation(libs.coil.compose) 107 | implementation(libs.coil.svg) 108 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/settings/PreferencesUiState.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.settings 2 | 3 | import androidx.compose.runtime.MutableState 4 | import androidx.compose.runtime.mutableStateOf 5 | import androidx.datastore.preferences.core.Preferences 6 | import androidx.datastore.preferences.core.booleanPreferencesKey 7 | 8 | /** Preference pairs, the first is the preference key, and the second is the default value. */ 9 | data class PreferencesUiState( 10 | /** Whether the preferences are loaded. **/ 11 | val isPreferencesLoaded: MutableState = mutableStateOf(false), 12 | 13 | /** Whether NewTyXT will be used instead of OldTyXT. **/ 14 | val newtyxt: Pair, MutableState> = Pair( 15 | booleanPreferencesKey("NEWTYXT"), 16 | mutableStateOf(false) 17 | ), 18 | 19 | /** Pitch black background. */ 20 | val pitchBlackBackground: Pair, MutableState> = Pair( 21 | (booleanPreferencesKey("PITCH_BLACK_BACKGROUND")), 22 | mutableStateOf(false) 23 | ), 24 | 25 | /** Whether the user has accepted the privacy policy and license. */ 26 | val acceptedPrivacyPolicyAndLicense: Pair, MutableState> = Pair( 27 | (booleanPreferencesKey("ACCEPTED_PRIVACY_POLICY_AND_LICENSE")), 28 | mutableStateOf(false) 29 | ), 30 | 31 | /** Render Markdown (.md) files on the bottom side of the screen. */ 32 | val renderMarkdown: Pair, MutableState> = Pair( 33 | (booleanPreferencesKey("RENDER_MARKDOWN")), 34 | mutableStateOf(true) 35 | ), 36 | 37 | /** Whether to show Typst project warnings and errors below the Typst project preview */ 38 | val typstProjectShowWarningsAndErrors: Pair, MutableState> = Pair( 39 | (booleanPreferencesKey("TYPST_PROJECT_SHOW_WARNINGS_AND_ERRORS")), 40 | mutableStateOf(true) 41 | ), 42 | 43 | /** Experimental feature that shows a button when a markdown file is open which will toggle 44 | * a fullscreen view of the rendered markdown preview. 45 | */ 46 | val experimentalFeaturePreviewRenderedMarkdownInFullscreen: Pair, MutableState> = Pair( 47 | (booleanPreferencesKey("EXPERIMENTAL_FEATURE_PREVIEW_RENDERED_MARKDOWN_IN_FULLSCREEN")), 48 | mutableStateOf(false) 49 | ), 50 | 51 | /** Experimental feature that shows a button when a Typst project is open which will toggle a fullscreen view of 52 | * the rendered Typst project preview. 53 | */ 54 | val experimentalFeaturePreviewRenderedTypstProjectInFullscreen: Pair, 55 | MutableState> = Pair( 56 | (booleanPreferencesKey 57 | ("EXPERIMENTAL_FEATURE_PREVIEW_RENDERED_TYPST_PROJECT_IN_FULLSCREEN")), 58 | mutableStateOf(false) 59 | ), 60 | 61 | /** Experimental feature that shows the open files of any type button. It is an experimental 62 | * feature as it currently corrupts some files such as but not limited to .pdf's, .odt's, and 63 | * probably more. 64 | */ 65 | val experimentalFeatureOpenAnyFileType: Pair, MutableState> = Pair( 66 | (booleanPreferencesKey("EXPERIMENTAL_FEATURE_OPEN_ANY_FILE_TYPE")), 67 | mutableStateOf(false) 68 | ), 69 | 70 | /** Experimental feature that shows an export option on markdown files to export to .docx. 71 | * It does not support all markdown yet and will crash when trying to export a file with unsupported markdown. 72 | */ 73 | val experimentalFeatureExportMarkdownToDocx: Pair, MutableState> = Pair( 74 | (booleanPreferencesKey("EXPERIMENTAL_FEATURE_EXPORT_MARKDOWN_TO_DOCX")), 75 | mutableStateOf(false) 76 | ), 77 | ) -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 68 | -------------------------------------------------------------------------------- /app/src/main/kotlin/newtyxt/dev/soupslurpr/beautyxt/BeautyxtApp.kt: -------------------------------------------------------------------------------- 1 | package dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import androidx.activity.compose.LocalActivity 6 | import androidx.compose.foundation.layout.padding 7 | import androidx.compose.material.icons.Icons 8 | import androidx.compose.material.icons.automirrored.filled.ArrowBack 9 | import androidx.compose.material3.ExperimentalMaterial3Api 10 | import androidx.compose.material3.Icon 11 | import androidx.compose.material3.IconButton 12 | import androidx.compose.material3.Scaffold 13 | import androidx.compose.material3.Text 14 | import androidx.compose.material3.TopAppBar 15 | import androidx.compose.material3.TopAppBarDefaults 16 | import androidx.compose.material3.rememberTopAppBarState 17 | import androidx.compose.runtime.Composable 18 | import androidx.compose.ui.Modifier 19 | import androidx.compose.ui.res.stringResource 20 | import androidx.compose.ui.text.style.TextOverflow 21 | import androidx.hilt.navigation.compose.hiltViewModel 22 | import androidx.navigation.NavHostController 23 | import androidx.navigation.compose.NavHost 24 | import androidx.navigation.compose.composable 25 | import androidx.navigation.compose.rememberNavController 26 | import androidx.navigation.navDeepLink 27 | import dev.soupslurpr.beautyxt.R 28 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.EditorScreen 29 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.EditorViewModel 30 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.HomeScreen 31 | import kotlinx.serialization.Serializable 32 | 33 | @Serializable 34 | object Home 35 | 36 | @Serializable 37 | object Editor 38 | //@Serializable 39 | //data class Editor(val uriString: String) { 40 | // companion object { 41 | // fun from(savedStateHandle: SavedStateHandle) = savedStateHandle.toRoute() 42 | // } 43 | //} 44 | 45 | @OptIn(ExperimentalMaterial3Api::class) 46 | @Composable 47 | fun BeautyxtApp( 48 | navController: NavHostController = rememberNavController() 49 | ) { 50 | val topAppBarScrollBehavior = 51 | TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState()) 52 | 53 | Scaffold( 54 | topBar = { 55 | TopAppBar( 56 | title = { 57 | Text( 58 | text = "NewTyXT! Yeah, title support needs to be implemented", 59 | maxLines = 1, 60 | overflow = TextOverflow.Ellipsis 61 | ) 62 | }, 63 | navigationIcon = { 64 | if (navController.previousBackStackEntry != null) { 65 | IconButton(onClick = { navController.navigateUp() }) { 66 | Icon( 67 | imageVector = Icons.AutoMirrored.Filled.ArrowBack, 68 | contentDescription = stringResource(id = R.string.navigate_up_button_description) 69 | ) 70 | } 71 | } 72 | }, 73 | actions = {}, 74 | scrollBehavior = topAppBarScrollBehavior 75 | ) 76 | } 77 | ) { innerPadding -> 78 | NavHost( 79 | navController = navController, 80 | startDestination = Home, 81 | // TODO: remove this, it's just until things settle down 82 | modifier = Modifier.padding(innerPadding) 83 | ) { 84 | composable { 85 | HomeScreen() 86 | } 87 | composable( 88 | deepLinks = listOf( 89 | navDeepLink { 90 | this.action = Intent.ACTION_VIEW 91 | this.mimeType = "text/*" 92 | }, 93 | navDeepLink { 94 | this.action = Intent.ACTION_EDIT 95 | this.mimeType = "text/*" 96 | } 97 | ) 98 | ) { 99 | val viewModel = hiltViewModel() 100 | EditorScreen(LocalActivity.current?.intent?.data ?: Uri.EMPTY, viewModel) 101 | } 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /beautyxt_rs_typst/Noto_Serif/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /beautyxt_rs_typst/STIX_Two/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2001-2021 The STIX Fonts Project Authors (https://github.com/stipub/stixfonts), with Reserved Font Name "TM Math". STIX Fonts™ is a trademark of The Institute of Electrical and Electronics Engineers, Inc. 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | ----------------------------------------------------------- 8 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 9 | ----------------------------------------------------------- 10 | 11 | PREAMBLE 12 | The goals of the Open Font License (OFL) are to stimulate worldwide 13 | development of collaborative font projects, to support the font creation 14 | efforts of academic and linguistic communities, and to provide a free and 15 | open framework in which fonts may be shared and improved in partnership 16 | with others. 17 | 18 | The OFL allows the licensed fonts to be used, studied, modified and 19 | redistributed freely as long as they are not sold by themselves. The 20 | fonts, including any derivative works, can be bundled, embedded, 21 | redistributed and/or sold with any software provided that any reserved 22 | names are not used by derivative works. The fonts and derivatives, 23 | however, cannot be released under any other type of license. The 24 | requirement for fonts to remain under this license does not apply 25 | to any document created using the fonts or their derivatives. 26 | 27 | DEFINITIONS 28 | "Font Software" refers to the set of files released by the Copyright 29 | Holder(s) under this license and clearly marked as such. This may 30 | include source files, build scripts and documentation. 31 | 32 | "Reserved Font Name" refers to any names specified as such after the 33 | copyright statement(s). 34 | 35 | "Original Version" refers to the collection of Font Software components as 36 | distributed by the Copyright Holder(s). 37 | 38 | "Modified Version" refers to any derivative made by adding to, deleting, 39 | or substituting -- in part or in whole -- any of the components of the 40 | Original Version, by changing formats or by porting the Font Software to a 41 | new environment. 42 | 43 | "Author" refers to any designer, engineer, programmer, technical 44 | writer or other person who contributed to the Font Software. 45 | 46 | PERMISSION & CONDITIONS 47 | Permission is hereby granted, free of charge, to any person obtaining 48 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 49 | redistribute, and sell modified and unmodified copies of the Font 50 | Software, subject to the following conditions: 51 | 52 | 1) Neither the Font Software nor any of its individual components, 53 | in Original or Modified Versions, may be sold by itself. 54 | 55 | 2) Original or Modified Versions of the Font Software may be bundled, 56 | redistributed and/or sold with any software, provided that each copy 57 | contains the above copyright notice and this license. These can be 58 | included either as stand-alone text files, human-readable headers or 59 | in the appropriate machine-readable metadata fields within text or 60 | binary files as long as those fields can be easily viewed by the user. 61 | 62 | 3) No Modified Version of the Font Software may use the Reserved Font 63 | Name(s) unless explicit written permission is granted by the corresponding 64 | Copyright Holder. This restriction only applies to the primary font name as 65 | presented to the users. 66 | 67 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 68 | Software shall not be used to promote, endorse or advertise any 69 | Modified Version, except to acknowledge the contribution(s) of the 70 | Copyright Holder(s) and the Author(s) or with their explicit written 71 | permission. 72 | 73 | 5) The Font Software, modified or unmodified, in part or in whole, 74 | must be distributed entirely under this license, and must not be 75 | distributed under any other license. The requirement for fonts to 76 | remain under this license does not apply to any document created 77 | using the Font Software. 78 | 79 | TERMINATION 80 | This license becomes null and void if any of the above conditions are 81 | not met. 82 | 83 | DISCLAIMER 84 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 85 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 86 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 87 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 88 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 89 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 90 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 91 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 92 | OTHER DEALINGS IN THE FONT SOFTWARE. 93 | -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/ui/TypstProjectViewModelRustLibraryIsolatedService.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.ui 2 | 3 | import android.app.Service 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import android.os.IBinder 7 | import androidx.core.os.bundleOf 8 | import oldtyxt.dev.soupslurpr.beautyxt.ITypstProjectViewModelRustLibraryAidlInterface 9 | import oldtyxt.dev.soupslurpr.beautyxt.PathAndPfd 10 | 11 | class TypstProjectViewModelRustLibraryIsolatedService : Service() { 12 | private val binder = object : ITypstProjectViewModelRustLibraryAidlInterface.Stub() { 13 | override fun initializeTypstWorld() { 14 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.initializeTypstWorld() 15 | } 16 | 17 | override fun setMainTypstProjectFile(papfd: PathAndPfd?) { 18 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.setMainTypstProjectFile( 19 | oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstProjectFilePathAndFd( 20 | papfd!!.path, 21 | papfd.pfd.detachFd() 22 | ) 23 | ) 24 | } 25 | 26 | override fun addTypstProjectFiles(papfdList: MutableList?) { 27 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.addTypstProjectFiles( 28 | papfdList!!.map { papfd -> 29 | oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstProjectFilePathAndFd( 30 | papfd.path, 31 | papfd.pfd.detachFd() 32 | ) 33 | } 34 | ) 35 | } 36 | 37 | override fun getTypstProjectFileText(path: String?): String { 38 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.getTypstProjectFileText( 39 | path!! 40 | ) 41 | } 42 | 43 | override fun getTypstSvg(): Bundle { 44 | val bundle = bundleOf() 45 | 46 | try { 47 | bundle.putByteArray("svg", oldtyxt.uniffi.beautyxt_rs_typst_bindings.getTypstSvg()) 48 | } catch (e: oldtyxt.uniffi.beautyxt_rs_typst_bindings.RenderException.VecCustomSourceDiagnostic) { 49 | e.customSourceDiagnostics.forEachIndexed { index, typstCustomSourceDiagnostic -> 50 | bundle.putString( 51 | "severity$index", when (typstCustomSourceDiagnostic.severity) { 52 | oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstCustomSeverity.WARNING -> "WARNING" 53 | oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstCustomSeverity.ERROR -> "ERROR" 54 | } 55 | ) 56 | 57 | bundle.putLong("span$index", typstCustomSourceDiagnostic.span.toLong()) 58 | 59 | bundle.putString("message$index", typstCustomSourceDiagnostic.message) 60 | 61 | bundle.putInt("trace$index", typstCustomSourceDiagnostic.trace.size - 1) 62 | typstCustomSourceDiagnostic.trace.forEachIndexed { traceIndex, typstCustomTracepoint -> 63 | val prefix = "trace${index}name${traceIndex}" 64 | when (typstCustomTracepoint) { 65 | is oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstCustomTracepoint.Call -> { 66 | bundle.putString(prefix, "Call") 67 | bundle.putString("${prefix}string", typstCustomTracepoint.string) 68 | bundle.putLong("${prefix}span", typstCustomTracepoint.span.toLong()) 69 | } 70 | 71 | is oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstCustomTracepoint.Import -> { 72 | bundle.putString(prefix, "Import") 73 | bundle.putLong("${prefix}span", typstCustomTracepoint.span.toLong()) 74 | } 75 | 76 | is oldtyxt.uniffi.beautyxt_rs_typst_bindings.TypstCustomTracepoint.Show -> { 77 | bundle.putString(prefix, "Show") 78 | bundle.putString("${prefix}string", typstCustomTracepoint.string) 79 | bundle.putLong("${prefix}span", typstCustomTracepoint.span.toLong()) 80 | } 81 | } 82 | } 83 | 84 | bundle.putStringArrayList( 85 | "hints$index", 86 | ArrayList(typstCustomSourceDiagnostic.hints) 87 | ) 88 | } 89 | } 90 | 91 | return bundle 92 | } 93 | 94 | override fun getTypstPdf(): ByteArray { 95 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.getTypstPdf() 96 | } 97 | 98 | override fun updateTypstProjectFile(newText: String?, path: String?): String { 99 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.updateTypstProjectFile( 100 | newText!!, 101 | path!! 102 | ) 103 | } 104 | 105 | override fun clearTypstProjectFiles() { 106 | return oldtyxt.uniffi.beautyxt_rs_typst_bindings.clearTypstProjectFiles() 107 | } 108 | } 109 | 110 | override fun onBind(intent: Intent?): IBinder { 111 | return binder 112 | } 113 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/settings/PreferencesViewModel.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.settings 2 | 3 | import androidx.compose.runtime.mutableStateOf 4 | import androidx.datastore.core.DataStore 5 | import androidx.datastore.preferences.core.Preferences 6 | import androidx.datastore.preferences.core.edit 7 | import androidx.lifecycle.ViewModel 8 | import androidx.lifecycle.ViewModelProvider 9 | import androidx.lifecycle.viewModelScope 10 | import kotlinx.coroutines.flow.MutableStateFlow 11 | import kotlinx.coroutines.flow.StateFlow 12 | import kotlinx.coroutines.flow.asStateFlow 13 | import kotlinx.coroutines.flow.collect 14 | import kotlinx.coroutines.flow.map 15 | import kotlinx.coroutines.flow.update 16 | import kotlinx.coroutines.launch 17 | 18 | class PreferencesViewModel(private val dataStore: DataStore) : ViewModel() { 19 | /** 20 | * Settings state 21 | */ 22 | private val _uiState = MutableStateFlow(PreferencesUiState()) 23 | val uiState: StateFlow = _uiState.asStateFlow() 24 | 25 | init { 26 | viewModelScope.launch { 27 | populateSettingsFromDatastore() 28 | } 29 | } 30 | 31 | /** 32 | * Populate the values of the settings from the Preferences DataStore. 33 | * This function is only called from this ViewModel's init 34 | */ 35 | private suspend fun populateSettingsFromDatastore() { 36 | dataStore.data.map { settings -> 37 | _uiState.update { currentState -> 38 | currentState.copy( 39 | isPreferencesLoaded = mutableStateOf(true), 40 | newtyxt = Pair( 41 | uiState.value.newtyxt.first, 42 | mutableStateOf( 43 | settings[uiState.value.newtyxt.first] ?: uiState.value.newtyxt.second 44 | .value 45 | ) 46 | ), 47 | pitchBlackBackground = Pair( 48 | uiState.value.pitchBlackBackground.first, 49 | mutableStateOf( 50 | settings[uiState.value.pitchBlackBackground.first] ?: uiState.value 51 | .pitchBlackBackground.second.value 52 | ) 53 | ), 54 | acceptedPrivacyPolicyAndLicense = Pair( 55 | uiState.value.acceptedPrivacyPolicyAndLicense.first, 56 | mutableStateOf( 57 | settings[uiState.value.acceptedPrivacyPolicyAndLicense.first] 58 | ?: uiState.value 59 | .acceptedPrivacyPolicyAndLicense.second.value 60 | ) 61 | ), 62 | renderMarkdown = Pair( 63 | uiState.value.renderMarkdown.first, 64 | mutableStateOf( 65 | settings[uiState.value.renderMarkdown.first] 66 | ?: uiState.value.renderMarkdown 67 | .second.value 68 | ) 69 | ), 70 | typstProjectShowWarningsAndErrors = Pair( 71 | uiState.value.typstProjectShowWarningsAndErrors.first, 72 | mutableStateOf( 73 | settings[uiState.value.typstProjectShowWarningsAndErrors.first] 74 | ?: uiState.value 75 | .typstProjectShowWarningsAndErrors.second.value 76 | ) 77 | ), 78 | experimentalFeaturePreviewRenderedMarkdownInFullscreen = Pair( 79 | uiState.value.experimentalFeaturePreviewRenderedMarkdownInFullscreen.first, 80 | mutableStateOf( 81 | settings[uiState.value.experimentalFeaturePreviewRenderedMarkdownInFullscreen 82 | .first] 83 | ?: uiState.value.experimentalFeaturePreviewRenderedMarkdownInFullscreen.second.value 84 | ) 85 | ), 86 | experimentalFeaturePreviewRenderedTypstProjectInFullscreen = Pair( 87 | uiState.value.experimentalFeaturePreviewRenderedTypstProjectInFullscreen.first, 88 | mutableStateOf( 89 | settings[uiState.value.experimentalFeaturePreviewRenderedTypstProjectInFullscreen.first] 90 | ?: uiState.value.experimentalFeaturePreviewRenderedTypstProjectInFullscreen.second.value 91 | ) 92 | ), 93 | experimentalFeatureOpenAnyFileType = Pair( 94 | uiState.value.experimentalFeatureOpenAnyFileType.first, 95 | mutableStateOf( 96 | settings[uiState.value.experimentalFeatureOpenAnyFileType.first] 97 | ?: uiState 98 | .value.experimentalFeatureOpenAnyFileType.second.value 99 | ) 100 | ), 101 | experimentalFeatureExportMarkdownToDocx = Pair( 102 | uiState.value.experimentalFeatureExportMarkdownToDocx.first, 103 | mutableStateOf( 104 | settings[uiState.value.experimentalFeatureExportMarkdownToDocx.first] 105 | ?: uiState.value.experimentalFeatureExportMarkdownToDocx.second.value 106 | ) 107 | ) 108 | ) 109 | } 110 | }.collect() 111 | } 112 | 113 | /** 114 | * Set a preference to a value and save to Preferences DataStore 115 | */ 116 | suspend fun setPreference(key: Preferences.Key, value: Boolean) { 117 | dataStore.edit { preferences -> 118 | preferences[key] = value 119 | } 120 | } 121 | 122 | class PreferencesViewModelFactory(private val dataStore: DataStore) : 123 | ViewModelProvider.Factory { 124 | override fun create(modelClass: Class): T { 125 | if (modelClass.isAssignableFrom(PreferencesViewModel::class.java)) { 126 | @Suppress("UNCHECKED_CAST") 127 | return PreferencesViewModel(dataStore) as T 128 | } 129 | throw IllegalArgumentException("Unknown ViewModel class $modelClass") 130 | } 131 | } 132 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/newtyxt/dev/soupslurpr/beautyxt/ui/theme/DefaultTheme.kt: -------------------------------------------------------------------------------- 1 | package dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.theme 2 | 3 | import androidx.compose.material3.darkColorScheme 4 | import androidx.compose.material3.lightColorScheme 5 | import androidx.compose.ui.graphics.Color 6 | 7 | val primaryLight = Color(0xFF445E91) 8 | val onPrimaryLight = Color(0xFFFFFFFF) 9 | val primaryContainerLight = Color(0xFFD8E2FF) 10 | val onPrimaryContainerLight = Color(0xFF001A41) 11 | val secondaryLight = Color(0xFF575E71) 12 | val onSecondaryLight = Color(0xFFFFFFFF) 13 | val secondaryContainerLight = Color(0xFFDBE2F9) 14 | val onSecondaryContainerLight = Color(0xFF141B2C) 15 | val tertiaryLight = Color(0xFF715573) 16 | val onTertiaryLight = Color(0xFFFFFFFF) 17 | val tertiaryContainerLight = Color(0xFFFBD7FC) 18 | val onTertiaryContainerLight = Color(0xFF29132D) 19 | val errorLight = Color(0xFFBA1A1A) 20 | val onErrorLight = Color(0xFFFFFFFF) 21 | val errorContainerLight = Color(0xFFFFDAD6) 22 | val onErrorContainerLight = Color(0xFF410002) 23 | val backgroundLight = Color(0xFFF9F9FF) 24 | val onBackgroundLight = Color(0xFF1A1B20) 25 | val surfaceLight = Color(0xFFF9F9FF) 26 | val onSurfaceLight = Color(0xFF1A1B20) 27 | val surfaceVariantLight = Color(0xFFE1E2EC) 28 | val onSurfaceVariantLight = Color(0xFF44474F) 29 | val outlineLight = Color(0xFF74777F) 30 | val outlineVariantLight = Color(0xFFC4C6D0) 31 | val scrimLight = Color(0xFF000000) 32 | val inverseSurfaceLight = Color(0xFF2F3036) 33 | val inverseOnSurfaceLight = Color(0xFFF0F0F7) 34 | val inversePrimaryLight = Color(0xFFADC6FF) 35 | val surfaceDimLight = Color(0xFFD9D9E0) 36 | val surfaceBrightLight = Color(0xFFF9F9FF) 37 | val surfaceContainerLowestLight = Color(0xFFFFFFFF) 38 | val surfaceContainerLowLight = Color(0xFFF3F3FA) 39 | val surfaceContainerLight = Color(0xFFEDEDF4) 40 | val surfaceContainerHighLight = Color(0xFFE8E7EE) 41 | val surfaceContainerHighestLight = Color(0xFFE2E2E9) 42 | 43 | val primaryDark = Color(0xFFADC6FF) 44 | val onPrimaryDark = Color(0xFF102F60) 45 | val primaryContainerDark = Color(0xFF2B4678) 46 | val onPrimaryContainerDark = Color(0xFFD8E2FF) 47 | val secondaryDark = Color(0xFFBFC6DC) 48 | val onSecondaryDark = Color(0xFF293041) 49 | val secondaryContainerDark = Color(0xFF3F4759) 50 | val onSecondaryContainerDark = Color(0xFFDBE2F9) 51 | val tertiaryDark = Color(0xFFDEBCDF) 52 | val onTertiaryDark = Color(0xFF402843) 53 | val tertiaryContainerDark = Color(0xFF583E5B) 54 | val onTertiaryContainerDark = Color(0xFFFBD7FC) 55 | val errorDark = Color(0xFFFFB4AB) 56 | val onErrorDark = Color(0xFF690005) 57 | val errorContainerDark = Color(0xFF93000A) 58 | val onErrorContainerDark = Color(0xFFFFDAD6) 59 | val backgroundDark = Color(0xFF111318) 60 | val onBackgroundDark = Color(0xFFE2E2E9) 61 | val surfaceDark = Color(0xFF111318) 62 | val onSurfaceDark = Color(0xFFE2E2E9) 63 | val surfaceVariantDark = Color(0xFF44474F) 64 | val onSurfaceVariantDark = Color(0xFFC4C6D0) 65 | val outlineDark = Color(0xFF8E9099) 66 | val outlineVariantDark = Color(0xFF44474F) 67 | val scrimDark = Color(0xFF000000) 68 | val inverseSurfaceDark = Color(0xFFE2E2E9) 69 | val inverseOnSurfaceDark = Color(0xFF2F3036) 70 | val inversePrimaryDark = Color(0xFF445E91) 71 | val surfaceDimDark = Color(0xFF111318) 72 | val surfaceBrightDark = Color(0xFF37393E) 73 | val surfaceContainerLowestDark = Color(0xFF0C0E13) 74 | val surfaceContainerLowDark = Color(0xFF1A1B20) 75 | val surfaceContainerDark = Color(0xFF1E1F25) 76 | val surfaceContainerHighDark = Color(0xFF282A2F) 77 | val surfaceContainerHighestDark = Color(0xFF33353A) 78 | 79 | val defaultLightScheme = lightColorScheme( 80 | primary = primaryLight, 81 | onPrimary = onPrimaryLight, 82 | primaryContainer = primaryContainerLight, 83 | onPrimaryContainer = onPrimaryContainerLight, 84 | secondary = secondaryLight, 85 | onSecondary = onSecondaryLight, 86 | secondaryContainer = secondaryContainerLight, 87 | onSecondaryContainer = onSecondaryContainerLight, 88 | tertiary = tertiaryLight, 89 | onTertiary = onTertiaryLight, 90 | tertiaryContainer = tertiaryContainerLight, 91 | onTertiaryContainer = onTertiaryContainerLight, 92 | error = errorLight, 93 | onError = onErrorLight, 94 | errorContainer = errorContainerLight, 95 | onErrorContainer = onErrorContainerLight, 96 | background = backgroundLight, 97 | onBackground = onBackgroundLight, 98 | surface = surfaceLight, 99 | onSurface = onSurfaceLight, 100 | surfaceVariant = surfaceVariantLight, 101 | onSurfaceVariant = onSurfaceVariantLight, 102 | outline = outlineLight, 103 | outlineVariant = outlineVariantLight, 104 | scrim = scrimLight, 105 | inverseSurface = inverseSurfaceLight, 106 | inverseOnSurface = inverseOnSurfaceLight, 107 | inversePrimary = inversePrimaryLight, 108 | surfaceDim = surfaceDimLight, 109 | surfaceBright = surfaceBrightLight, 110 | surfaceContainerLowest = surfaceContainerLowestLight, 111 | surfaceContainerLow = surfaceContainerLowLight, 112 | surfaceContainer = surfaceContainerLight, 113 | surfaceContainerHigh = surfaceContainerHighLight, 114 | surfaceContainerHighest = surfaceContainerHighestLight, 115 | ) 116 | 117 | val defaultDarkScheme = darkColorScheme( 118 | primary = primaryDark, 119 | onPrimary = onPrimaryDark, 120 | primaryContainer = primaryContainerDark, 121 | onPrimaryContainer = onPrimaryContainerDark, 122 | secondary = secondaryDark, 123 | onSecondary = onSecondaryDark, 124 | secondaryContainer = secondaryContainerDark, 125 | onSecondaryContainer = onSecondaryContainerDark, 126 | tertiary = tertiaryDark, 127 | onTertiary = onTertiaryDark, 128 | tertiaryContainer = tertiaryContainerDark, 129 | onTertiaryContainer = onTertiaryContainerDark, 130 | error = errorDark, 131 | onError = onErrorDark, 132 | errorContainer = errorContainerDark, 133 | onErrorContainer = onErrorContainerDark, 134 | background = backgroundDark, 135 | onBackground = onBackgroundDark, 136 | surface = surfaceDark, 137 | onSurface = onSurfaceDark, 138 | surfaceVariant = surfaceVariantDark, 139 | onSurfaceVariant = onSurfaceVariantDark, 140 | outline = outlineDark, 141 | outlineVariant = outlineVariantDark, 142 | scrim = scrimDark, 143 | inverseSurface = inverseSurfaceDark, 144 | inverseOnSurface = inverseOnSurfaceDark, 145 | inversePrimary = inversePrimaryDark, 146 | surfaceDim = surfaceDimDark, 147 | surfaceBright = surfaceBrightDark, 148 | surfaceContainerLowest = surfaceContainerLowestDark, 149 | surfaceContainerLow = surfaceContainerLowDark, 150 | surfaceContainer = surfaceContainerDark, 151 | surfaceContainerHigh = surfaceContainerHighDark, 152 | surfaceContainerHighest = surfaceContainerHighestDark, 153 | ) -------------------------------------------------------------------------------- /app/src/main/kotlin/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package dev.soupslurpr.beautyxt 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.os.Build 6 | import android.os.Bundle 7 | import android.os.StrictMode 8 | import androidx.activity.ComponentActivity 9 | import androidx.activity.compose.setContent 10 | import androidx.activity.enableEdgeToEdge 11 | import androidx.compose.runtime.collectAsState 12 | import androidx.compose.runtime.getValue 13 | import androidx.compose.ui.Modifier 14 | import androidx.compose.ui.platform.LocalContext 15 | import androidx.lifecycle.viewmodel.compose.viewModel 16 | import dagger.hilt.android.AndroidEntryPoint 17 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.BeautyxtApp 18 | import dev.soupslurpr.beautyxt.newtyxt.dev.soupslurpr.beautyxt.ui.theme.BeautyxtTheme 19 | import oldtyxt.dev.soupslurpr.beautyxt.oldtyxtDataStore 20 | 21 | /** 22 | * BeauTyXT is currently split up into two parts: OldTyXT and NewTyXT. 23 | * 24 | * The version that's shipped is currently OldTyXT. 25 | * 26 | * OldTyXT is effectively deprecated. No new features will be added to OldTyXT. OldTyXT will 27 | * still be maintained until NewTyXT can fully replace it. 28 | * 29 | * NewTyXT is a rewrite which aims to adhere to Android development best practices. 30 | * NewTyXT is work-in-progress. Once basic text file editing is implemented, the setting to switch 31 | * between OldTyXT and NewTyXT will be exposed in the UI to facilitate public testing. 32 | */ 33 | @AndroidEntryPoint 34 | class MainActivity : ComponentActivity() { 35 | override fun onCreate(savedInstanceState: Bundle?) { 36 | if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) && BuildConfig.DEBUG) { 37 | StrictMode.setVmPolicy( 38 | StrictMode.VmPolicy.Builder() 39 | .detectAll() 40 | .penaltyLog() 41 | .build() 42 | ) 43 | } 44 | enableEdgeToEdge() 45 | super.onCreate(savedInstanceState) 46 | 47 | setContent { 48 | val oldtyxtPreferencesViewModel: oldtyxt.dev.soupslurpr.beautyxt.settings.PreferencesViewModel = 49 | viewModel( 50 | factory = oldtyxt.dev.soupslurpr.beautyxt.settings.PreferencesViewModel 51 | .PreferencesViewModelFactory(oldtyxtDataStore) 52 | ) 53 | 54 | val oldtyxtPreferencesUiState by oldtyxtPreferencesViewModel.uiState.collectAsState() 55 | 56 | if (oldtyxtPreferencesUiState.isPreferencesLoaded.value) { 57 | if (oldtyxtPreferencesUiState.newtyxt.second.value) { 58 | BeautyxtTheme { 59 | BeautyxtApp() 60 | } 61 | } else { 62 | val fileViewModel: oldtyxt.dev.soupslurpr.beautyxt.ui.FileViewModel = 63 | viewModel() 64 | 65 | val typstProjectViewModel: oldtyxt.dev.soupslurpr.beautyxt.ui 66 | .TypstProjectViewModel = viewModel() 67 | 68 | val isActionViewOrEdit = (intent.action==Intent.ACTION_VIEW) or 69 | (intent.action==Intent.ACTION_EDIT) 70 | 71 | val isActionSend = intent.action==Intent.ACTION_SEND 72 | 73 | if (isActionViewOrEdit) { 74 | val readOnly = intent.flags and Intent.FLAG_GRANT_WRITE_URI_PERMISSION==0 75 | 76 | fileViewModel.setReadOnly(readOnly) 77 | 78 | val uri: Uri = intent.data 79 | ?: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { 80 | intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri::class.java) 81 | } else { 82 | intent.getParcelableExtra(Intent.EXTRA_STREAM) 83 | } ?: throw RuntimeException( 84 | "intent" + 85 | ".data was" + 86 | " unexpectedly null!" 87 | ) 88 | 89 | fileViewModel.bindIsolatedService( 90 | uri, 91 | oldtyxtPreferencesUiState.renderMarkdown.second.value, 92 | false, 93 | ) 94 | fileViewModel.setUri(uri, LocalContext.current) 95 | } else if (isActionSend) { 96 | val extraText = intent.getStringExtra(Intent.EXTRA_TEXT) 97 | val extraStream: Uri? = 98 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { 99 | intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri::class.java) 100 | } else { 101 | intent.getParcelableExtra(Intent.EXTRA_STREAM) 102 | } 103 | 104 | if (extraStream!=null) { 105 | val readOnly = 106 | intent.flags and Intent.FLAG_GRANT_WRITE_URI_PERMISSION==0 107 | 108 | fileViewModel.setReadOnly(readOnly) 109 | 110 | fileViewModel.bindIsolatedService( 111 | extraStream, 112 | oldtyxtPreferencesUiState.renderMarkdown.second.value, 113 | false, 114 | ) 115 | fileViewModel.setUri(extraStream, LocalContext.current) 116 | } else if (extraText!=null) { 117 | throw RuntimeException("Sharing text is not supported yet!") // TODO: Handle this 118 | } 119 | } 120 | 121 | oldtyxt.dev.soupslurpr.beautyxt.ui.theme.BeauTyXTTheme( 122 | preferencesViewModel = oldtyxtPreferencesViewModel 123 | ) { 124 | if (!oldtyxtPreferencesUiState.acceptedPrivacyPolicyAndLicense.second.value) { 125 | oldtyxt.dev.soupslurpr.beautyxt.ui.ReviewPrivacyPolicyAndLicense( 126 | preferencesViewModel = oldtyxtPreferencesViewModel 127 | ) 128 | } else if (oldtyxtPreferencesUiState.acceptedPrivacyPolicyAndLicense.second.value) { 129 | oldtyxt.dev.soupslurpr.beautyxt.BeauTyXTApp( 130 | modifier = Modifier, 131 | fileViewModel = fileViewModel, 132 | typstProjectViewModel = typstProjectViewModel, 133 | preferencesViewModel = oldtyxtPreferencesViewModel, 134 | isActionViewOrEdit = isActionViewOrEdit, 135 | isActionSend = isActionSend, 136 | ) 137 | } 138 | } 139 | } 140 | } 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH="\\\"\\\"" 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/ui/TypstProjectScreen.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.ui 2 | 3 | import android.content.res.Configuration 4 | import android.net.Uri 5 | import androidx.compose.foundation.background 6 | import androidx.compose.foundation.layout.Column 7 | import androidx.compose.foundation.layout.Row 8 | import androidx.compose.foundation.layout.fillMaxSize 9 | import androidx.compose.foundation.layout.fillMaxWidth 10 | import androidx.compose.foundation.layout.imePadding 11 | import androidx.compose.foundation.layout.padding 12 | import androidx.compose.foundation.rememberScrollState 13 | import androidx.compose.foundation.verticalScroll 14 | import androidx.compose.material3.MaterialTheme 15 | import androidx.compose.material3.MaterialTheme.typography 16 | import androidx.compose.material3.OutlinedTextFieldDefaults 17 | import androidx.compose.material3.Text 18 | import androidx.compose.material3.TextField 19 | import androidx.compose.runtime.Composable 20 | import androidx.compose.runtime.LaunchedEffect 21 | import androidx.compose.runtime.collectAsState 22 | import androidx.compose.runtime.getValue 23 | import androidx.compose.ui.Modifier 24 | import androidx.compose.ui.graphics.Color 25 | import androidx.compose.ui.platform.LocalConfiguration 26 | import androidx.compose.ui.platform.LocalContext 27 | import androidx.compose.ui.res.stringResource 28 | import androidx.compose.ui.text.font.FontWeight 29 | import androidx.compose.ui.text.style.TextAlign 30 | import androidx.compose.ui.unit.dp 31 | import coil3.compose.AsyncImage 32 | import coil3.request.ImageRequest 33 | import coil3.svg.SvgDecoder 34 | import dev.soupslurpr.beautyxt.R 35 | import kotlinx.coroutines.Dispatchers 36 | import oldtyxt.dev.soupslurpr.beautyxt.settings.PreferencesUiState 37 | 38 | @Composable 39 | fun TypstProjectScreen( 40 | typstProjectViewModel: TypstProjectViewModel, 41 | preferencesUiState: PreferencesUiState, 42 | navigateUp: () -> Unit, 43 | previewTypstProjectRenderedToFullscreen: Boolean, 44 | ) { 45 | val context = LocalContext.current 46 | 47 | val typstProjectUiState by typstProjectViewModel.uiState.collectAsState() 48 | 49 | val content = typstProjectUiState.currentOpenedContent.value 50 | 51 | val imageRequest = ImageRequest.Builder(context = context) 52 | .decoderFactory(SvgDecoder.Factory()) 53 | .data(typstProjectUiState.renderedProjectSvg.value) 54 | // Can't use IO because it blinks if we do. 55 | .coroutineContext(Dispatchers.Main.immediate) 56 | .build() 57 | 58 | val svgPreviewVerticalScroll = rememberScrollState() 59 | 60 | val isPortrait = LocalConfiguration.current.orientation==Configuration.ORIENTATION_PORTRAIT 61 | 62 | /** This is needed in the event that the TypstProjectViewModel or TypstProjectUiState is destroyed or cleared so 63 | * that it automatically goes to the last screen or start screen instead of being in an invalid project. 64 | */ 65 | LaunchedEffect(typstProjectUiState.projectFolderUri.value) { 66 | if (typstProjectUiState.projectFolderUri.value==Uri.EMPTY) { 67 | navigateUp() 68 | } 69 | } 70 | 71 | if (isPortrait) { 72 | Column( 73 | modifier = Modifier.imePadding() 74 | ) { 75 | TypstProjectTextField( 76 | modifier = Modifier 77 | .fillMaxSize() 78 | .weight( 79 | if (previewTypstProjectRenderedToFullscreen) { 80 | 0.00000001f 81 | } else { 82 | 1f 83 | } 84 | ), 85 | content = content, 86 | displayName = typstProjectUiState.currentOpenedDisplayName.value, 87 | ) { 88 | val currentOpenedPath = typstProjectUiState.currentOpenedPath.value 89 | 90 | typstProjectViewModel.updateProjectFileWithNewText(it, currentOpenedPath) 91 | 92 | typstProjectViewModel.renderProjectToSvgs(typstProjectViewModel.rustService!!) 93 | } 94 | 95 | Column( 96 | modifier = Modifier 97 | .fillMaxWidth() 98 | .weight(1f) 99 | ) { 100 | Text( 101 | text = stringResource(R.string.oldtyxt_rendered_typst_project_preview), 102 | modifier = Modifier.padding(horizontal = 16.dp, vertical = 0.dp), 103 | textAlign = TextAlign.Center, 104 | color = MaterialTheme.colorScheme.primary, 105 | fontWeight = FontWeight.Bold, 106 | style = typography.bodySmall, 107 | ) 108 | 109 | ScrollableSvgDocumentPreview( 110 | modifier = Modifier 111 | .verticalScroll(svgPreviewVerticalScroll) 112 | .fillMaxWidth() 113 | .background(Color.White) 114 | .weight(1f), 115 | imageRequest = imageRequest, 116 | ) 117 | 118 | if (preferencesUiState.typstProjectShowWarningsAndErrors.second.value && typstProjectUiState 119 | .sourceDiagnostics 120 | .isNotEmpty() 121 | ) { 122 | WarningsAndErrors( 123 | modifier = Modifier 124 | .verticalScroll(rememberScrollState()) 125 | .fillMaxWidth() 126 | .weight(0.25f), 127 | sourceDiagnostics = typstProjectUiState.sourceDiagnostics.toList() 128 | ) 129 | } 130 | } 131 | } 132 | } else { 133 | Row( 134 | modifier = Modifier.imePadding() 135 | ) { 136 | TypstProjectTextField( 137 | modifier = Modifier 138 | .fillMaxSize() 139 | .weight( 140 | if (previewTypstProjectRenderedToFullscreen) { 141 | 0.00000001f 142 | } else { 143 | 1f 144 | } 145 | ), 146 | content = content, 147 | displayName = typstProjectUiState.currentOpenedDisplayName.value, 148 | ) { 149 | val currentOpenedPath = typstProjectUiState.currentOpenedPath.value 150 | 151 | typstProjectViewModel.updateProjectFileWithNewText(it, currentOpenedPath) 152 | 153 | typstProjectViewModel.renderProjectToSvgs(typstProjectViewModel.rustService!!) 154 | } 155 | 156 | Column( 157 | modifier = Modifier 158 | .fillMaxWidth() 159 | .weight(1f) 160 | ) { 161 | Text( 162 | text = stringResource(R.string.oldtyxt_rendered_typst_project_preview), 163 | modifier = Modifier.padding(top = 8.dp), 164 | textAlign = TextAlign.Center, 165 | color = MaterialTheme.colorScheme.primary, 166 | fontWeight = FontWeight.Bold, 167 | style = typography.bodySmall, 168 | ) 169 | 170 | ScrollableSvgDocumentPreview( 171 | modifier = Modifier 172 | .verticalScroll(svgPreviewVerticalScroll) 173 | .fillMaxWidth() 174 | .background(Color.White) 175 | .weight(1f), 176 | imageRequest = imageRequest, 177 | ) 178 | 179 | if (preferencesUiState.typstProjectShowWarningsAndErrors.second.value && typstProjectUiState 180 | .sourceDiagnostics.isNotEmpty() 181 | ) { 182 | WarningsAndErrors( 183 | modifier = Modifier 184 | .verticalScroll(rememberScrollState()) 185 | .fillMaxWidth() 186 | .weight(0.25f), 187 | sourceDiagnostics = typstProjectUiState.sourceDiagnostics.toList() 188 | ) 189 | } 190 | } 191 | } 192 | } 193 | } 194 | 195 | @Composable 196 | fun TypstProjectTextField( 197 | modifier: Modifier = Modifier, 198 | content: String, 199 | displayName: String, // The display name might not necessarily be the file name! 200 | onValueChanged: (String) -> Unit 201 | ) { 202 | TextField( 203 | modifier = modifier, 204 | value = content, 205 | onValueChange = { 206 | onValueChanged(it) 207 | }, 208 | label = { 209 | Text( 210 | text = displayName, 211 | textAlign = TextAlign.Center, 212 | color = MaterialTheme.colorScheme.primary, 213 | fontWeight = FontWeight.Bold 214 | ) 215 | }, 216 | colors = OutlinedTextFieldDefaults.colors( 217 | focusedBorderColor = Color.Transparent, 218 | unfocusedBorderColor = Color.Transparent 219 | ), 220 | ) 221 | } 222 | 223 | @Composable 224 | fun ScrollableSvgDocumentPreview( 225 | modifier: Modifier = Modifier, 226 | imageRequest: ImageRequest, 227 | ) { 228 | AsyncImage( 229 | modifier = modifier, 230 | model = imageRequest, 231 | contentDescription = null, 232 | ) 233 | } 234 | 235 | @Composable 236 | fun WarningsAndErrors( 237 | modifier: Modifier = Modifier, 238 | sourceDiagnostics: List, 239 | ) { 240 | Column( 241 | modifier = modifier 242 | ) { 243 | sourceDiagnostics.forEach { 244 | Text(it.message) 245 | } 246 | } 247 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/oldtyxt/dev/soupslurpr/beautyxt/ui/StartupScreen.kt: -------------------------------------------------------------------------------- 1 | package oldtyxt.dev.soupslurpr.beautyxt.ui 2 | 3 | import androidx.compose.foundation.Image 4 | import androidx.compose.foundation.layout.Arrangement 5 | import androidx.compose.foundation.layout.Column 6 | import androidx.compose.foundation.layout.Spacer 7 | import androidx.compose.foundation.layout.WindowInsets 8 | import androidx.compose.foundation.layout.asPaddingValues 9 | import androidx.compose.foundation.layout.fillMaxWidth 10 | import androidx.compose.foundation.layout.navigationBars 11 | import androidx.compose.foundation.layout.padding 12 | import androidx.compose.foundation.layout.size 13 | import androidx.compose.foundation.layout.width 14 | import androidx.compose.foundation.layout.wrapContentHeight 15 | import androidx.compose.foundation.layout.wrapContentWidth 16 | import androidx.compose.foundation.rememberScrollState 17 | import androidx.compose.foundation.verticalScroll 18 | import androidx.compose.material.icons.Icons 19 | import androidx.compose.material.icons.filled.Add 20 | import androidx.compose.material.icons.filled.Settings 21 | import androidx.compose.material3.AlertDialogDefaults 22 | import androidx.compose.material3.BasicAlertDialog 23 | import androidx.compose.material3.ExperimentalMaterial3Api 24 | import androidx.compose.material3.FilledTonalButton 25 | import androidx.compose.material3.Icon 26 | import androidx.compose.material3.MaterialTheme 27 | import androidx.compose.material3.Surface 28 | import androidx.compose.material3.Text 29 | import androidx.compose.runtime.Composable 30 | import androidx.compose.runtime.LaunchedEffect 31 | import androidx.compose.runtime.getValue 32 | import androidx.compose.runtime.mutableStateOf 33 | import androidx.compose.runtime.remember 34 | import androidx.compose.runtime.setValue 35 | import androidx.compose.ui.Alignment 36 | import androidx.compose.ui.Modifier 37 | import androidx.compose.ui.res.painterResource 38 | import androidx.compose.ui.res.stringResource 39 | import androidx.compose.ui.text.style.TextAlign 40 | import androidx.compose.ui.unit.dp 41 | import dev.soupslurpr.beautyxt.R 42 | import oldtyxt.dev.soupslurpr.beautyxt.settings.PreferencesUiState 43 | 44 | /** 45 | * Composable on startup that shows options like opening an existing file, 46 | * and creating a new one. 47 | */ 48 | @Composable 49 | fun StartupScreen( 50 | modifier: Modifier, 51 | splashMessage: String, 52 | onOpenTxtButtonClicked: () -> Unit, 53 | onOpenMdButtonClicked: () -> Unit, 54 | onOpenTypstProjectButtonClicked: () -> Unit, 55 | onOpenAnyButtonClicked: () -> Unit, 56 | onCreateTxtButtonClicked: () -> Unit, 57 | onCreateMdButtonClicked: () -> Unit, 58 | onCreateTypstProjectButtonClicked: () -> Unit, 59 | onSettingsButtonClicked: () -> Unit, 60 | fileViewModel: FileViewModel, 61 | preferencesUiState: PreferencesUiState, 62 | typstProjectViewModel: TypstProjectViewModel, 63 | ) { 64 | var isOpenFileTypeAlertDialogShown by remember { mutableStateOf(false) } 65 | var isCreateFileTypeAlertDialogShown by remember { mutableStateOf(false) } 66 | 67 | // clear FileUiState when exiting file editor and going back to startup screen. 68 | LaunchedEffect(key1 = Unit) { 69 | if (fileViewModel.rustService != null) { 70 | fileViewModel.clearUiState() 71 | } 72 | if (typstProjectViewModel.rustService != null) { 73 | typstProjectViewModel.clearUiState() 74 | } 75 | } 76 | 77 | Column( 78 | modifier = modifier 79 | .padding(16.dp) 80 | .fillMaxWidth() 81 | .verticalScroll(rememberScrollState()), 82 | horizontalAlignment = Alignment.CenterHorizontally, 83 | verticalArrangement = Arrangement.spacedBy(16.dp) 84 | ) { 85 | Image( 86 | painter = painterResource(R.drawable.ic_launcher_foreground), 87 | contentDescription = null, 88 | modifier = modifier.size(200.dp) 89 | ) 90 | Text( 91 | text = stringResource(R.string.oldtyxt_welcome), 92 | style = MaterialTheme.typography.headlineLarge 93 | ) 94 | Text( 95 | text = splashMessage, 96 | style = MaterialTheme.typography.bodySmall, 97 | textAlign = TextAlign.Center 98 | ) 99 | FilledTonalButton( 100 | modifier = modifier.fillMaxWidth(), 101 | onClick = { isOpenFileTypeAlertDialogShown = true } 102 | ) { 103 | Icon( 104 | painter = painterResource(R.drawable.baseline_file_open_24), 105 | contentDescription = null 106 | ) 107 | Spacer(modifier = modifier.width(8.dp)) 108 | Text(stringResource(R.string.oldtyxt_open)) 109 | FileTypeSelectionDialog( 110 | isShown = isOpenFileTypeAlertDialogShown, 111 | onDismissRequest = { isOpenFileTypeAlertDialogShown = false } 112 | ) { 113 | Text( 114 | text = stringResource(R.string.oldtyxt_open), 115 | style = MaterialTheme.typography.headlineSmall 116 | ) 117 | FilledTonalButton( 118 | modifier = Modifier.fillMaxWidth(), 119 | onClick = { 120 | onOpenTxtButtonClicked() 121 | isOpenFileTypeAlertDialogShown = false 122 | } 123 | ) { 124 | Text(text = stringResource(R.string.oldtyxt_txt)) 125 | } 126 | FilledTonalButton( 127 | modifier = Modifier.fillMaxWidth(), 128 | onClick = { 129 | onOpenMdButtonClicked() 130 | isOpenFileTypeAlertDialogShown = false 131 | } 132 | ) { 133 | Text(text = stringResource(R.string.oldtyxt_md)) 134 | } 135 | FilledTonalButton( 136 | modifier = Modifier.fillMaxWidth(), 137 | onClick = { 138 | onOpenTypstProjectButtonClicked() 139 | isOpenFileTypeAlertDialogShown = false 140 | } 141 | ) { 142 | Text(text = stringResource(R.string.oldtyxt_typst_project)) 143 | } 144 | if (preferencesUiState.experimentalFeatureOpenAnyFileType.second.value) { 145 | FilledTonalButton( 146 | modifier = Modifier.fillMaxWidth(), 147 | onClick = { 148 | onOpenAnyButtonClicked() 149 | isOpenFileTypeAlertDialogShown = false 150 | } 151 | ) { 152 | Text(text = stringResource(R.string.oldtyxt_any)) 153 | } 154 | } 155 | } 156 | } 157 | FilledTonalButton( 158 | modifier = modifier.fillMaxWidth(), 159 | onClick = { isCreateFileTypeAlertDialogShown = true } 160 | ) { 161 | Icon( 162 | imageVector = Icons.Filled.Add, 163 | contentDescription = null 164 | ) 165 | Spacer(modifier = modifier.width(8.dp)) 166 | Text(stringResource(R.string.oldtyxt_create)) 167 | FileTypeSelectionDialog( 168 | isShown = isCreateFileTypeAlertDialogShown, 169 | onDismissRequest = { isCreateFileTypeAlertDialogShown = false }, 170 | ) { 171 | Text( 172 | text = stringResource(R.string.oldtyxt_create), 173 | style = MaterialTheme.typography.headlineSmall 174 | ) 175 | FilledTonalButton( 176 | modifier = Modifier.fillMaxWidth(), 177 | onClick = { 178 | isCreateFileTypeAlertDialogShown = false 179 | onCreateTxtButtonClicked() 180 | }, 181 | ) { 182 | Text(text = stringResource(R.string.oldtyxt_txt)) 183 | } 184 | FilledTonalButton( 185 | modifier = Modifier.fillMaxWidth(), 186 | onClick = { 187 | isCreateFileTypeAlertDialogShown = false 188 | onCreateMdButtonClicked() 189 | }, 190 | ) { 191 | Text(text = stringResource(R.string.oldtyxt_md)) 192 | } 193 | FilledTonalButton( 194 | modifier = Modifier.fillMaxWidth(), 195 | onClick = { 196 | isCreateFileTypeAlertDialogShown = false 197 | onCreateTypstProjectButtonClicked() 198 | }, 199 | ) { 200 | Text( 201 | text = stringResource( 202 | R.string.oldtyxt_create_typst_project, 203 | stringResource(R.string.oldtyxt_typst_project) 204 | ) 205 | ) 206 | } 207 | } 208 | } 209 | FilledTonalButton( 210 | modifier = modifier.fillMaxWidth(), 211 | onClick = { onSettingsButtonClicked() } 212 | ) { 213 | Icon( 214 | imageVector = Icons.Filled.Settings, 215 | contentDescription = null 216 | ) 217 | Spacer(modifier = modifier.width(8.dp)) 218 | Text(stringResource(R.string.oldtyxt_settings)) 219 | } 220 | 221 | Spacer(Modifier.padding(WindowInsets.navigationBars.asPaddingValues())) 222 | } 223 | } 224 | 225 | @Composable 226 | @OptIn(ExperimentalMaterial3Api::class) 227 | fun FileTypeSelectionDialog( 228 | isShown: Boolean, 229 | onDismissRequest: () -> Unit, 230 | content: @Composable () -> Unit, 231 | ) { 232 | if (isShown) { 233 | BasicAlertDialog(onDismissRequest = onDismissRequest) { 234 | Surface( 235 | modifier = Modifier 236 | .wrapContentWidth() 237 | .wrapContentHeight(), 238 | shape = MaterialTheme.shapes.large, 239 | tonalElevation = AlertDialogDefaults.TonalElevation 240 | ) { 241 | Column( 242 | modifier = Modifier.padding(16.dp), 243 | horizontalAlignment = Alignment.CenterHorizontally, 244 | verticalArrangement = Arrangement.spacedBy(8.dp) 245 | ) { 246 | content() 247 | } 248 | } 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /app/src/main/res/values/oldtyxt_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BeauTyXT 3 | Settings 4 | Back 5 | Welcome to BeauTyXT! 6 | File Editor 7 | Source code 8 | View BeauTyXT\'s source code on the GitHub website in your web browser 9 | Privacy policy 10 | View BeauTyXT\'s privacy policy in app 11 | License 12 | Privacy policy 13 | BeauTyXT\'s License 14 | View BeauTyXT\'s License in app 15 | Credits 16 | Credits 17 | View open source licenses of code that BeauTyXT uses in app 18 | Any 19 | Plain Text (.txt & .text) 20 | Pitch black background 21 | Replaces background with pitch black background when dark theme is on 22 | About 23 | Theme 24 | File Info 25 | Name 26 | Size 27 | MIME Type 28 | Bytes 29 | BeauTyXT\'s Website 30 | Open BeauTyXT\'s website in your web browser 31 | Review BeauTyXT\'s privacy policy and license (scroll down) 32 | BeauTyXT privacy policy\n\nThis app does not use any sensitive permissions, makes no internet connections, and does not store any data in itself other than preferences. This app uses the Android Storage Access Framework (SAF) to interact with files you choose to access, which can be stored in and exported to various locations of your choice. You are responsible for where you choose to store and export your files to. This app does not access, collect, or transmit data from these locations beyond these purposes.\n\nBeauTyXT\'s privacy policy may be updated from time to time.\n\nLast updated: July 15, 2023. 33 | ISC License\n\nCopyright (c) 2023-2025 soupslurpr\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE. 34 | By checking the checkbox and continuing, you agree to BeauTyXT\'s privacy policy and license, which are shown above. 35 | Continue 36 | Options dropdown menu 37 | Render Markdown 38 | Render %1$s files on the bottom side of the screen 39 | Markdown (.md & .markdown) 40 | Export 41 | Export As 42 | Cancel 43 | Confirm 44 | HTML (.html) 45 | Read Only 46 | Rendered Markdown 47 | Preview Markdown rendered to HTML 48 | Experimental Features 49 | Fullscreen 50 | Markdown Preview Button 51 | Shows a button when a markdown file is open which will toggle a fullscreen view of the rendered markdown preview.\nExperimental because it has a few issues. 52 | Open Any File Type 53 | Shows Any file type 54 | option in the open an existing file dialog.\nWARNING PLEASE READ OR RISK LOSING DATA: Do NOT edit files 55 | that have binary content in them or else you will risk corruption! Some examples of such files are pdf\'s, 56 | odt\'s, and more. 57 | Plain Text and 58 | Markdown Rust Library Credits 59 | Office Open XML (.docx) 60 | Export %1$s to %2$s 61 | Adds an export 62 | option for %1$s files to export to %2$s.\nNot all Markdown is supported for 63 | conversion yet, BeauTyXT will crash when trying to export a %1$s file using unsupported 64 | functionality.\nCurrently only Heading, Break, Emphasis, Strong, and alignment with <div style="text-align: 65 | center">text here</div> (center, left, right) are supported. 66 | Print 67 | Words 68 | Characters 69 | Print Options 70 | Left Margin 71 | INVALID SIZE 72 | Inches 73 | Right Margin 74 | Top Margin 75 | Bottom Margin 76 | Delete File 77 | Are you really sure you want to do 78 | this?\nDeleted files are irrecoverable (gone forever!) 79 | Share 80 | Share As 81 | Typst project 82 | Open 83 | Create 84 | %1$s (Create a new folder from the menu and give access to it) 85 | PDF (.pdf) 86 | Edit another file in the Typst project 87 | Create and edit another file in the Typst project 88 | Show warnings and errors 89 | Show warnings and errors below the %1$s preview 90 | Rendered Typst project preview 91 | Toggle previewing Typst project in fullscreen 92 | Fullscreen Typst Preview Button 93 | Shows a button when a Typst project is open which will toggle a fullscreen preview of the rendered Typst project.\nExperimental because it has a few issues. 94 | Donation 95 | Donation 96 | View how to donate to BeauTyXT\'s lead developer in-app 97 | View Credits for Rust library for Plain Text and Markdown support 98 | View Credits for Rust library for Typst support 99 | Typst Rust Library Credits 100 | 101 | -------------------------------------------------------------------------------- /beautyxt_rs_typst/Roboto/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE.material-symbols.txt: -------------------------------------------------------------------------------- 1 | A copy of the license for the following files only: 2 | 3 | app/src/main/res/drawable/baseline_export_notes_24.xml 4 | app/src/main/res/drawable/baseline_file_open_24.xml 5 | app/src/main/res/drawable/baseline_output_24.xml 6 | app/src/main/res/drawable/baseline_preview_24.xml 7 | app/src/main/res/drawable/baseline_print_24.xml 8 | app/src/main/res/drawable/baseline_save_as_24.xml 9 | 10 | is provided below. 11 | 12 | Apache License 13 | Version 2.0, January 2004 14 | http://www.apache.org/licenses/ 15 | 16 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 17 | 18 | 1. Definitions. 19 | 20 | "License" shall mean the terms and conditions for use, reproduction, 21 | and distribution as defined by Sections 1 through 9 of this document. 22 | 23 | "Licensor" shall mean the copyright owner or entity authorized by 24 | the copyright owner that is granting the License. 25 | 26 | "Legal Entity" shall mean the union of the acting entity and all 27 | other entities that control, are controlled by, or are under common 28 | control with that entity. For the purposes of this definition, 29 | "control" means (i) the power, direct or indirect, to cause the 30 | direction or management of such entity, whether by contract or 31 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 32 | outstanding shares, or (iii) beneficial ownership of such entity. 33 | 34 | "You" (or "Your") shall mean an individual or Legal Entity 35 | exercising permissions granted by this License. 36 | 37 | "Source" form shall mean the preferred form for making modifications, 38 | including but not limited to software source code, documentation 39 | source, and configuration files. 40 | 41 | "Object" form shall mean any form resulting from mechanical 42 | transformation or translation of a Source form, including but 43 | not limited to compiled object code, generated documentation, 44 | and conversions to other media types. 45 | 46 | "Work" shall mean the work of authorship, whether in Source or 47 | Object form, made available under the License, as indicated by a 48 | copyright notice that is included in or attached to the work 49 | (an example is provided in the Appendix below). 50 | 51 | "Derivative Works" shall mean any work, whether in Source or Object 52 | form, that is based on (or derived from) the Work and for which the 53 | editorial revisions, annotations, elaborations, or other modifications 54 | represent, as a whole, an original work of authorship. For the purposes 55 | of this License, Derivative Works shall not include works that remain 56 | separable from, or merely link (or bind by name) to the interfaces of, 57 | the Work and Derivative Works thereof. 58 | 59 | "Contribution" shall mean any work of authorship, including 60 | the original version of the Work and any modifications or additions 61 | to that Work or Derivative Works thereof, that is intentionally 62 | submitted to Licensor for inclusion in the Work by the copyright owner 63 | or by an individual or Legal Entity authorized to submit on behalf of 64 | the copyright owner. For the purposes of this definition, "submitted" 65 | means any form of electronic, verbal, or written communication sent 66 | to the Licensor or its representatives, including but not limited to 67 | communication on electronic mailing lists, source code control systems, 68 | and issue tracking systems that are managed by, or on behalf of, the 69 | Licensor for the purpose of discussing and improving the Work, but 70 | excluding communication that is conspicuously marked or otherwise 71 | designated in writing by the copyright owner as "Not a Contribution." 72 | 73 | "Contributor" shall mean Licensor and any individual or Legal Entity 74 | on behalf of whom a Contribution has been received by Licensor and 75 | subsequently incorporated within the Work. 76 | 77 | 2. Grant of Copyright License. Subject to the terms and conditions of 78 | this License, each Contributor hereby grants to You a perpetual, 79 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 80 | copyright license to reproduce, prepare Derivative Works of, 81 | publicly display, publicly perform, sublicense, and distribute the 82 | Work and such Derivative Works in Source or Object form. 83 | 84 | 3. Grant of Patent License. Subject to the terms and conditions of 85 | this License, each Contributor hereby grants to You a perpetual, 86 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 87 | (except as stated in this section) patent license to make, have made, 88 | use, offer to sell, sell, import, and otherwise transfer the Work, 89 | where such license applies only to those patent claims licensable 90 | by such Contributor that are necessarily infringed by their 91 | Contribution(s) alone or by combination of their Contribution(s) 92 | with the Work to which such Contribution(s) was submitted. If You 93 | institute patent litigation against any entity (including a 94 | cross-claim or counterclaim in a lawsuit) alleging that the Work 95 | or a Contribution incorporated within the Work constitutes direct 96 | or contributory patent infringement, then any patent licenses 97 | granted to You under this License for that Work shall terminate 98 | as of the date such litigation is filed. 99 | 100 | 4. Redistribution. You may reproduce and distribute copies of the 101 | Work or Derivative Works thereof in any medium, with or without 102 | modifications, and in Source or Object form, provided that You 103 | meet the following conditions: 104 | 105 | (a) You must give any other recipients of the Work or 106 | Derivative Works a copy of this License; and 107 | 108 | (b) You must cause any modified files to carry prominent notices 109 | stating that You changed the files; and 110 | 111 | (c) You must retain, in the Source form of any Derivative Works 112 | that You distribute, all copyright, patent, trademark, and 113 | attribution notices from the Source form of the Work, 114 | excluding those notices that do not pertain to any part of 115 | the Derivative Works; and 116 | 117 | (d) If the Work includes a "NOTICE" text file as part of its 118 | distribution, then any Derivative Works that You distribute must 119 | include a readable copy of the attribution notices contained 120 | within such NOTICE file, excluding those notices that do not 121 | pertain to any part of the Derivative Works, in at least one 122 | of the following places: within a NOTICE text file distributed 123 | as part of the Derivative Works; within the Source form or 124 | documentation, if provided along with the Derivative Works; or, 125 | within a display generated by the Derivative Works, if and 126 | wherever such third-party notices normally appear. The contents 127 | of the NOTICE file are for informational purposes only and 128 | do not modify the License. You may add Your own attribution 129 | notices within Derivative Works that You distribute, alongside 130 | or as an addendum to the NOTICE text from the Work, provided 131 | that such additional attribution notices cannot be construed 132 | as modifying the License. 133 | 134 | You may add Your own copyright statement to Your modifications and 135 | may provide additional or different license terms and conditions 136 | for use, reproduction, or distribution of Your modifications, or 137 | for any such Derivative Works as a whole, provided Your use, 138 | reproduction, and distribution of the Work otherwise complies with 139 | the conditions stated in this License. 140 | 141 | 5. Submission of Contributions. Unless You explicitly state otherwise, 142 | any Contribution intentionally submitted for inclusion in the Work 143 | by You to the Licensor shall be under the terms and conditions of 144 | this License, without any additional terms or conditions. 145 | Notwithstanding the above, nothing herein shall supersede or modify 146 | the terms of any separate license agreement you may have executed 147 | with Licensor regarding such Contributions. 148 | 149 | 6. Trademarks. This License does not grant permission to use the trade 150 | names, trademarks, service marks, or product names of the Licensor, 151 | except as required for reasonable and customary use in describing the 152 | origin of the Work and reproducing the content of the NOTICE file. 153 | 154 | 7. Disclaimer of Warranty. Unless required by applicable law or 155 | agreed to in writing, Licensor provides the Work (and each 156 | Contributor provides its Contributions) on an "AS IS" BASIS, 157 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 158 | implied, including, without limitation, any warranties or conditions 159 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 160 | PARTICULAR PURPOSE. You are solely responsible for determining the 161 | appropriateness of using or redistributing the Work and assume any 162 | risks associated with Your exercise of permissions under this License. 163 | 164 | 8. Limitation of Liability. In no event and under no legal theory, 165 | whether in tort (including negligence), contract, or otherwise, 166 | unless required by applicable law (such as deliberate and grossly 167 | negligent acts) or agreed to in writing, shall any Contributor be 168 | liable to You for damages, including any direct, indirect, special, 169 | incidental, or consequential damages of any character arising as a 170 | result of this License or out of the use or inability to use the 171 | Work (including but not limited to damages for loss of goodwill, 172 | work stoppage, computer failure or malfunction, or any and all 173 | other commercial damages or losses), even if such Contributor 174 | has been advised of the possibility of such damages. 175 | 176 | 9. Accepting Warranty or Additional Liability. While redistributing 177 | the Work or Derivative Works thereof, You may choose to offer, 178 | and charge a fee for, acceptance of support, warranty, indemnity, 179 | or other liability obligations and/or rights consistent with this 180 | License. However, in accepting such obligations, You may act only 181 | on Your own behalf and on Your sole responsibility, not on behalf 182 | of any other Contributor, and only if You agree to indemnify, 183 | defend, and hold each Contributor harmless for any liability 184 | incurred by, or claims asserted against, such Contributor by reason 185 | of your accepting any such warranty or additional liability. 186 | 187 | END OF TERMS AND CONDITIONS 188 | 189 | APPENDIX: How to apply the Apache License to your work. 190 | 191 | To apply the Apache License to your work, attach the following 192 | boilerplate notice, with the fields enclosed by brackets "[]" 193 | replaced with your own identifying information. (Don't include 194 | the brackets!) The text should be enclosed in the appropriate 195 | comment syntax for the file format. We also recommend that a 196 | file or class name and description of purpose be included on the 197 | same "printed page" as the copyright notice for easier 198 | identification within third-party archives. 199 | 200 | Copyright [yyyy] [name of copyright owner] 201 | 202 | Licensed under the Apache License, Version 2.0 (the "License"); 203 | you may not use this file except in compliance with the License. 204 | You may obtain a copy of the License at 205 | 206 | http://www.apache.org/licenses/LICENSE-2.0 207 | 208 | Unless required by applicable law or agreed to in writing, software 209 | distributed under the License is distributed on an "AS IS" BASIS, 210 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 211 | See the License for the specific language governing permissions and 212 | limitations under the License. --------------------------------------------------------------------------------