-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create LICENSE, tell users about license and (non-)affiliation, creat…
…e about page
- Loading branch information
1 parent
95ca764
commit 6b2b0a1
Showing
11 changed files
with
914 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...c/main/java/ru/herobrine1st/e621/ui/component/legal/LicenseAndDisclaimerInitialDialogs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package ru.herobrine1st.e621.ui.component.legal | ||
|
||
import android.widget.Toast | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.Text | ||
import androidx.compose.material.TextButton | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.OpenInBrowser | ||
import androidx.compose.runtime.* | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.res.stringResource | ||
import ru.herobrine1st.e621.R | ||
import ru.herobrine1st.e621.ui.dialog.ActionDialog | ||
|
||
@Composable | ||
fun LicenseAndDisclaimerInitialDialogs( | ||
hasShownBefore: Boolean, | ||
onCompletion: () -> Unit | ||
) { | ||
// Why: I want users to know that this application is free software | ||
// Also non-affiliation disclaimer may be useful.. sometimes | ||
val context = LocalContext.current | ||
|
||
var showLicenseDialog by remember(hasShownBefore) { mutableStateOf(!hasShownBefore) } | ||
var showNonAffiliationDisclaimerDialog by remember { mutableStateOf(false) } | ||
|
||
if (showLicenseDialog) { | ||
val uriHandler = LocalUriHandler.current | ||
val licenseUrl = stringResource(R.string.license_url) | ||
ActionDialog( | ||
title = stringResource(R.string.license_word), | ||
onDismissRequest = { | ||
Toast.makeText(context, R.string.explicitly_click_button, Toast.LENGTH_SHORT).show() | ||
}, | ||
actions = { | ||
TextButton( | ||
onClick = { | ||
uriHandler.openUri(licenseUrl) | ||
} | ||
) { | ||
Text(stringResource(R.string.license_name_short)) | ||
Icon( | ||
Icons.Default.OpenInBrowser, | ||
contentDescription = stringResource(R.string.open_in_browser) | ||
) | ||
} | ||
TextButton( | ||
onClick = { | ||
showLicenseDialog = false | ||
showNonAffiliationDisclaimerDialog = true | ||
} | ||
) { | ||
Text(stringResource(R.string.i_understand)) | ||
} | ||
} | ||
) { | ||
Text(stringResource(R.string.license_brief)) | ||
} | ||
} | ||
if (showNonAffiliationDisclaimerDialog) { | ||
ActionDialog( | ||
title = stringResource(R.string.disclaimer), | ||
onDismissRequest = { | ||
Toast.makeText(context, R.string.explicitly_click_button, Toast.LENGTH_SHORT).show() | ||
}, | ||
actions = { | ||
TextButton( | ||
onClick = { | ||
showNonAffiliationDisclaimerDialog = false | ||
onCompletion() | ||
} | ||
) { | ||
Text(stringResource(R.string.i_understand)) | ||
} | ||
} | ||
) { | ||
Text(stringResource(R.string.non_affiliation_disclaimer)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
app/src/main/java/ru/herobrine1st/e621/ui/screen/settings/SettingsAbout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package ru.herobrine1st.e621.ui.screen.settings | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material.* | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.OpenInBrowser | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.alpha | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import ru.herobrine1st.e621.BuildConfig | ||
import ru.herobrine1st.e621.R | ||
|
||
@Composable | ||
@Preview | ||
fun SettingsAbout() { | ||
LazyColumn(verticalArrangement = Arrangement.spacedBy(8.dp)) { | ||
item {} // "padding" | ||
item { | ||
Card(Modifier.padding(horizontal = 8.dp)) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
modifier = Modifier.fillMaxWidth() | ||
) { | ||
Box { | ||
Image( | ||
painterResource(R.drawable.ic_launcher_foreground), | ||
contentDescription = null, | ||
modifier = Modifier.size(128.dp) | ||
) | ||
} | ||
Column { | ||
Text( | ||
stringResource(R.string.app_name), | ||
style = MaterialTheme.typography.subtitle1 | ||
) | ||
Spacer(modifier = Modifier.size(2.dp)) | ||
Text( | ||
stringResource( | ||
R.string.app_description, | ||
BuildConfig.DEEP_LINK_BASE_URL | ||
), | ||
Modifier.alpha(ContentAlpha.medium), | ||
style = MaterialTheme.typography.caption | ||
) | ||
} | ||
} | ||
} | ||
} | ||
item { | ||
Card( | ||
modifier = Modifier | ||
.padding(horizontal = 8.dp) | ||
.fillMaxWidth() | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.padding(8.dp) | ||
.fillMaxWidth() | ||
) { | ||
Text(stringResource(R.string.disclaimer), style = MaterialTheme.typography.h6) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text(stringResource(R.string.non_affiliation_disclaimer)) | ||
} | ||
} | ||
} | ||
item { | ||
Card( | ||
modifier = Modifier | ||
.padding(horizontal = 8.dp) | ||
.fillMaxWidth() | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.padding(8.dp) | ||
.fillMaxWidth() | ||
) { | ||
val uriHandler = LocalUriHandler.current | ||
val licenseUrl = stringResource(R.string.license_url) | ||
Text(stringResource(R.string.license_word), style = MaterialTheme.typography.h6) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text(stringResource(R.string.license_brief)) | ||
OutlinedButton( | ||
modifier = Modifier | ||
.fillMaxWidth(), | ||
onClick = { uriHandler.openUri(licenseUrl) }) { | ||
Text(stringResource(R.string.license_name)) | ||
Icon( | ||
Icons.Default.OpenInBrowser, | ||
contentDescription = stringResource(R.string.open_in_browser) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
item {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters