Skip to content

Commit

Permalink
Add donation section in Settings -> About
Browse files Browse the repository at this point in the history
  • Loading branch information
soupslurpr committed Jan 9, 2024
1 parent f1517ac commit 4b6d815
Show file tree
Hide file tree
Showing 6 changed files with 2,616 additions and 3 deletions.
1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions app/src/main/kotlin/dev/soupslurpr/beautyxt/BeauTyXT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import dev.soupslurpr.beautyxt.constants.mimeTypePlainText
import dev.soupslurpr.beautyxt.settings.PreferencesUiState
import dev.soupslurpr.beautyxt.settings.PreferencesViewModel
import dev.soupslurpr.beautyxt.ui.CreditsScreen
import dev.soupslurpr.beautyxt.ui.DonationScreen
import dev.soupslurpr.beautyxt.ui.FileEditScreen
import dev.soupslurpr.beautyxt.ui.FileViewModel
import dev.soupslurpr.beautyxt.ui.LicenseScreen
Expand All @@ -99,7 +100,8 @@ enum class BeauTyXTScreens(@StringRes val title: Int) {
License(title = R.string.license),
PrivacyPolicy(title = R.string.privacy_policy),
Credits(title = R.string.credits),
RustLibraryCredits(title = R.string.rust_library_credits);
RustLibraryCredits(title = R.string.rust_library_credits),
Donation(title = R.string.donation),
}

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -1398,7 +1400,10 @@ ${
onCreditsIconButtonClicked = {
navController.navigate(BeauTyXTScreens.Credits.name)
},
preferencesViewModel = preferencesViewModel
preferencesViewModel = preferencesViewModel,
onDonationSettingsItemClicked = {
navController.navigate(BeauTyXTScreens.Donation.name)
}
)
}
composable(route = BeauTyXTScreens.License.name) {
Expand All @@ -1415,6 +1420,9 @@ ${
composable(route = BeauTyXTScreens.RustLibraryCredits.name) {
RustLibraryCreditsScreen()
}
composable(route = BeauTyXTScreens.Donation.name) {
DonationScreen()
}
}
}
}
Expand Down
52 changes: 52 additions & 0 deletions app/src/main/kotlin/dev/soupslurpr/beautyxt/ui/DonationScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package dev.soupslurpr.beautyxt.ui

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import dev.soupslurpr.beautyxt.R

@Composable
fun DonationScreen() {
val columnVerticalScroll = rememberScrollState()

Column(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 16.dp)
.verticalScroll(columnVerticalScroll),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
"Like BeauTyXT? You can donate to soupslurpr, the lead developer of BeauTyXT to support their work" +
" on BeauTyXT and their other open source projects. Thank you!"
)
Text("")
Text("Monero address:")
SelectionContainer {
Text("88rAaNowhaC8JG8NJDpcdRWr1gGVmtFPnHWPS9xXvqY44G4XKVi5hZMax2FQ6B8KAcMpzkeJAhNek8qMHZjjwvkEKuiyBKF")
}
Text("")
Image(
painterResource(R.drawable.donation_monero_address_qrcode),
contentDescription = "QR Code for Monero address"
)

Spacer(Modifier.padding(WindowInsets.navigationBars.asPaddingValues()))
}
}
13 changes: 13 additions & 0 deletions app/src/main/kotlin/dev/soupslurpr/beautyxt/ui/SettingsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fun SettingsScreen(
onPrivacyPolicyIconButtonClicked: () -> Unit,
onCreditsIconButtonClicked: () -> Unit,
preferencesViewModel: PreferencesViewModel,
onDonationSettingsItemClicked: () -> Unit,
) {
val localUriHandler = LocalUriHandler.current
val preferencesUiState by preferencesViewModel.uiState.collectAsState()
Expand Down Expand Up @@ -168,6 +169,18 @@ fun SettingsScreen(
)
}
)
SettingsItem(
stringResource(R.string.donation_setting_name),
stringResource(R.string.donation_setting_description),
hasIcon = true,
onClickIconSetting = { onDonationSettingsItemClicked() },
icon = {
Icon(
Icons.Filled.Info,
null
)
}
)
}

Column {
Expand Down

0 comments on commit 4b6d815

Please sign in to comment.